On May 13, 2007, at 11:03 PM, Matt Koch wrote:

I think for some reason, my e-mail below never made it to the mailing list ([email protected]), at least it does not seem to show up on "gmane". Perhaps it is because I used the wrong e-mail address in the "from" field?

Looking through our logs, yes, it looks like your message was bounced on May 3rd because it came from an alum.mit.edu address. Did you not get a rejection message at that time? I will be happy to beat on our list admins who should have switched to MailMan a long, long time ago.




1) I have used some meshing functions that allow extraction of the left, right, bottom and top boundaries of a rectangular mesh. However, if I want to work off of GMsh meshes, I need to be able to extract boundaries (and domains) by GMsh's "Physical Line", "Physical Surface" and/or "Physical Volume" ID numbers. Can that be done in FiPy? In other words, how would I assign a constant flux boundary condition to GMsh "Physical Line" 25, for example?

I don't think this is easily obtainable. A mesh imported from gmsh does have some internal mapping tables between gmsh's indices and ours (mesh.nodeToVertexIDs, mesh.unsortedBaseIDs, mesh.cellFaceVertexIDs, mesh.baseFaceVertexIDs, mesh.faceStrToFaceIDs), but I think we may ignore the "Physical ..." objects altogether. I can't promise that any of those internal variables is going to be useful to you, but that's where I'd start.

If that doesn't work, then I think there's presently no choice but to identify faces by coordinates. This mechanism for identifying faces:

    >>> myFaces = mesh.getFaces(filter=???)

is older than the "where=" syntax that we use now, and is very inefficient, but it should work (fortunately, you only have to do it once, at the beginning of a simulation). Unlike "where=", the filter must identify faces one by one. I'm not sure if we have any examples of its use and don't have time to look at the moment, but will post later today if Daniel doesn't beat me to it.


2) I have seen constant flux and constant temperature boundary conditions, but how would I assign something like the typical convective & radiative boundary condition, i.e. -kdT/dn = h(T-T0) + s(T^4-T0^4), which is a combination of both constant flux and constant temperature?

I understand why you view this as a combination of fixed flux and fixed temperature, but it doesn't look to me like it actually *fixes* the temperature; rather, it produces a flux if the temperature ever deviates from the target value. If you actually imposed a FixedValue boundary condition on temperature, then it *could not* deviate from the target value at the boundary and the flux would always be zero by definition. If I'm misunderstanding the problem (quite possible), please correct me.

This *should* be as simple as setting a FixedFlux boundary condition equal to (h(T-T0) + s(T^4-T0^4)) / k. Unfortunately, our FixedFlux boundary conditions don't do the right thing for anything other than zero flux. (If you only have a diffusion term, with no convection, then it might work, but I wouldn't count on it).

The way we've been fudging this in our own codes is to produce a SourceTerm at the boundaries that does the right thing. We expect to automate this process in the next release of FiPy, but in the interim, this is what I would do:

    >>> boundary = FaceVariable(mesh=mesh, value=0)
    >>> faceX = mesh.getFaceCenters()[...,0]
    >>> faceY = mesh.getFaceCenters()[...,1]
    >>> faceZ = mesh.getFaceCenters()[...,2]
>>> boundary.setValue(1, where=(faceX == ???SOMETHING DESCRIBING X ON THE BOUNDARY???) & (faceY == ???SOMETHING DESCRIBING Y ON THE BOUNDARY???) ...)

Do that last step on as many different boundaries as you like, or come up with a single `where` statement that describes all of them.

    >>> deltaT = T.getArithmeticFaceValue() - T0
>>> boundaryFlux = VectorFaceVariable(mesh=mesh, value=boundary * (deltaT * h / k + deltaT ** 4 * s / k))


>>> heatFluxEqn = TransientTerm() == DiffusionTerm() + ??? + boundaryFlux.getDivergence()

Because the boundary condition is nonlinear in T, it will probably be necessary to sweep to convergence.


3) I understand that the FIPY_VIEWER environment variable can be set to the preferred viewer. However, is there a way I could invoke my favorite viewer straight from the Python script, without having to rely on this environment variable?

If, for example, you always wanted to use matplotlib, irrespective of dimensionality (presently you are setting FIPY_VIEWER to "matplotlib"), then you would do

    >>> from fipy.viewers import matplotlibViewer
    >>> viewer = matplotlibViewer.make(vars=...

On the other hand, if you wanted to use matplotlib for 1D plots, but gist for 2D plots, then you would do

    >>> from fipy import Matplotlib1DViewer
    >>> viewer1 = Matplotlib1DViewer(vars=(my1Dvar1, my1Dvar2, ...

and

    >>> from fipy import Gist2DViewer
    >>> viewer2 = Gist2DViewer(vars=(my2Dvar1, my2Dvar2, ...




Reply via email to