On Jan 28, 2021, at 2:45 PM, 'Fausto Arinos de A. Barbuto' via fipy 
<[email protected]<mailto:[email protected]>> wrote:


Hi,

Is it OK to define the contour of an irregular shape based on its (X,Y)
coordinates only, e.g.:

    X, Y = mesh.faceCenters

    L1 = (X == 0.000) & (Y <= 0.025)
    L2 = (X == 0.025) & (Y >= 0.025)
    T1 = (X <= 0.025) & (Y == 0.025)
    T2 = (X >= 0.025) & (Y == 0.200)
    B1 = (X <= 0.300) & (Y == 0.000)
    B2 = (X >= 0.300) & (Y == 0.050)
    R1 = (X == 0.300) & (Y <= 0.050)
    R2 = (X == 0.500) & (Y >= 0.050)

that is, without caring about mesh.facesLeft, mesh.facesBottom etc? I
find it easier (albeit sillier, too) this way, sometimes.

You absolutely can do this. Internally, that’s all that FiPy is doing, e.g.,

  https://github.com/usnistgov/fipy/blob/master/fipy/meshes/abstractMesh.py#L789


A comment about FiPy's mesh generator function Gmsh2D. It allows one to
define line labels such as:

Physical Line("L1") = {8};
Physical Line("B1") = {1};
Physical Line("B2") = {3};
...

Yet I wasn't able to use those line label definitions directly, like:

    phi = CellVariable(name="phi(x,y)", mesh=mesh, value=0.0, hasOld=True)

    phi.constrain(10.0, L1)
    phi.constrain(0.0, L2)
    phi.faceGrad.constrain(0.0, R1)

and so on and so forth? Do I still have to define the contour as shown
at the beginning of this message? I get error messages saying that L1,
L2, etc, weren't defined.

You need to write:

    phi.constrain(10.0, mesh.physicalFaces["L1"])
    phi.constrain(0.0, mesh.physicalFaces["L2"])
    phi.faceGrad.constrain(0.0, mesh.physicalFaces["R1"])

See the example at
https://www.ctcms.nist.gov/fipy/fipy/generated/fipy.meshes.html#module-fipy.meshes.gmshMesh

-- 
To unsubscribe from this group, send email to [email protected]

View this message at https://list.nist.gov/fipy
--- 
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].

Reply via email to