Thanks! Things seem to be working now, though I haven't attempted to implement the open boundary condition talked about in another post yet ... maybe I'll give that a try this week.
Congratulations on being able to open up again! Richard On Oct 17, 2013, at 9:34 AM, Guyer, Jonathan E. Dr. wrote: > For a FaceVariable, you'll need to use > > X = mesh.faceCenters[0] > Y = mesh.faceCenters[1] > > to get the shape right. > > X and Y (or x and y) can be used to set the value because MeshVariables can > be cast to numpy arrays. > > In this case, I'd be inclined to write: > >>>> vel = X * Y * [[1],[0]] + (Y-X) * [[0], [1]] >>>> vel.name = "velocity field" > > The way you've done it is fine, but if the expressions are dynamic (depend on > the solution variables), then it wouldn't update, whereas my expression would. > > > > > > On Oct 7, 2013, at 1:30 PM, Richard Gillilan <[email protected]> wrote: > >> Technically, I think this should be a FaceVariable rather than CellVariable. >> But if I do that substitution, python complains: >> >> ValueError: shape mismatch: objects cannot be broadcast to a single shape >> WARNING: Failure executing file: <A4F.py> >> >> Richard >> >> On Oct 7, 2013, at 1:21 PM, Richard Gillilan wrote: >> >>> Found a manual, but it wasn't a huge amount of help on this problem. But I >>> think I've got it figured out. >>> Here's what I did: >>> >>> def V(x,y): >>> """ dummy vector field with arbitrary math expressions """ >>> return [x*y,y-x] >>> >>> x = mesh.cellCenters[0] >>> y = mesh.cellCenters[1] >>> >> >> FaceVariable? >> >>> vel = CellVariable(name = "velocity field", >>> mesh = mesh, >>> rank = 1, >>> value = V(x,y)) >>> >>> eq = TransientTerm() == >>> (DiffusionTerm(coeff=D)+ExplicitUpwindConvectionTerm(coeff=vel)) >>> >>> ... seems to work when V(x,y) is a general numpy mathematical expression. I >>> don't really grasp why, since the variables x,y are not simple numpy >>> arrays, but it seems to work correctly. Anyone care to enlighten me as to >>> why this works? This must be some kind of Python operator overloading. I >>> must have missed this point somewhere in the manual. >>> >>> Richard >>> >>> _______________________________________________ >>> fipy mailing list >>> [email protected] >>> http://www.ctcms.nist.gov/fipy >>> [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] >>> >> >> >> >> _______________________________________________ >> fipy mailing list >> [email protected] >> http://www.ctcms.nist.gov/fipy >> [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > _______________________________________________ > fipy mailing list > [email protected] > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
