Hi Adrian, It's a little bit of a hack, but I got something to work, see below. Unfortunately, I think you need to explicitly delete the fixed value constraint from the CellVariable's faceConstraints list, which requires some knowledge of FiPy's internals and remember the order in which the constraints were added. I would be nice if "var.constrain" returned some sort of constraint object which could be deleted.
Cheers, Daniel ~~~~ import fipy as fp mesh = fp.Grid1D(nx=10) var = fp.CellVariable(mesh=mesh, value=0.) var.constrain(1., mesh.facesLeft) var.constrain(0., mesh.facesRight) eqn = fp.TransientTerm() == fp.DiffusionTerm() viewer = fp.Viewer(var) dt = 0.1 for _ in range(100): eqn.solve(var, dt=dt) viewer.plot() del var.faceConstraints[0] var.faceGrad.constrain(1., mesh.facesLeft) for _ in range(1000): eqn.solve(var, dt=dt) viewer.plot() ~~~~ On Wed, Jun 21, 2017 at 2:56 PM, Adrian Jacobo <ajac...@mail.rockefeller.edu> wrote: > Hi All, > > I have a problem where I would want to specify fixed value boundary > conditions for times t<t0 and then switch to fixed gradient boundary > conditions for t>=t0. The way I've implemented this is: > > > a.constrain(a_0,(mesh.exteriorFaces)) > > while t<tottime: > if t > = t0: > a.faceGrad.constrain(0.,mesh.exteriorFaces) > eq.solve(dt=timeStepDuration) > t+=dt > > But what it seems to be happening is that the fixed value bc is not > being overwritten by the fixed gradient one. How can I do to remove the > fixed value bc? Is there a way to check the boundary conditions on a > variable? > > Thanks, > Adrian. > > _______________________________________________ > fipy mailing list > fipy@nist.gov > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] -- Daniel Wheeler _______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]