0

Could I address outer mesh face centers by any FiPy or ... modules? For a cylinder by radius of 'R', related meshes are created O'grid sweep-like on it. As it seems, 'R' is greater than the most outer mesh face centers; so there is a difference between them (FIG.) and can not be addressed by "R" easily.

enter image description here

I need to mention all outer mesh face centers around the cylinder wall (not top and bottom wall). The mesh system are imported by "FiPy Gmsh" (FiPy version = 3.1 and Python 2.7). FiPy 'solver.mesh.getFaceCenters()' get an simple array for mesh face centers. I think the cylinder wall related outer faces of outer hexagonal mesh layer could be addressed by code such below:

reduce(numpy.logical_and, (FORMULAs))               # where FORMULAs are specifying mesh face center coordinates limits

I tried to use the following codes, but it will need some changes for segment '> R', if the FORMULA be applicable.

x,y,z = solver.mesh.getFaceCenters()
np.sqrt(x ** 2 + y  ** 2) > R       #  as FORMULAs

I would be very appreciated if anyone could help me to overcome this issue. I think the best way must be using FiPy and numpy modules.

Ali_Sh
  • 2,667
  • 3
  • 43
  • 66

1 Answers1

1

This is discussed in the documentation for Gmsh2D.

Although it is possible to define such faces parametrically, it is necessary to allow some error in position due to the finite resolution of the discretized mesh. Far better to define the faces you want in the abstract geometry definition and refer to them directly, e.g., your GEO file in Gmsh would have something like

Physical Volume("FORMULA") = {5, 6, 7};

and then your FiPy script would access them with

formula_faces = solver.mesh.physicalFaces["FORUMULA"]
jeguyer
  • 2,379
  • 1
  • 11
  • 15
  • Thank you for your answering Dr.Guyer, The meshing source code is not available in the problem. I think it is not as easy as inner boundary mesh face center determination for outer boundary, because inner points magnitudes are smaller than inner cylinder wall radius but outer boundary points are smaller than outer cylinder wall radius, which makes it hard to addressing them, particularly when meshing system have inappropriate mesh sizes. I have solved the problem by addressing boundary points with looping to number of boundary meshes to find nearest points to cylinder wall radius. – Ali_Sh Mar 13 '21 at 19:53
  • I would be grateful if you could suggest a simple code or method to find number of outer cylinder wall mesh automatically, not manually as I do. – Ali_Sh Mar 13 '21 at 20:12
  • 1
    @Ali_Sh As I've already said, this is all discussed in [the documentation for `Gmsh2D`](https://www.ctcms.nist.gov/fipy/fipy/generated/fipy.meshes.html#module-fipy.meshes.gmshMesh). Specifically, see the definition of `NW`. – jeguyer Mar 13 '21 at 23:40
  • How are you getting Gmsh to generate the mesh in the first place if you don't have the GEO definition? – jeguyer Mar 13 '21 at 23:40
  • The mesh file have been created and exported from OpenFOAM software by another person, then received converted file, '.msh', is imported by FiPy, which have only resulted points and numbers, not definitions. – Ali_Sh Mar 14 '21 at 06:45