CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Possible to select Cells next to a SPHERE surface? (https://www.cfd-online.com/Forums/openfoam/180592-possible-select-cells-next-sphere-surface.html)

keepfit November 26, 2016 13:12

Possible to select Cells next to a SPHERE surface?
 
Hi Foamers,

Is it possible to use script over OpenFOAM to select specific cells to generate a new CellSet for use of mesh refinment? Since the topoSet tool does not have this type of source.

As shown below, I want to refine the mesh around a sphere surface given the center O (x, y, z) and radius R. Note that inside this "sphere", cells do exist, i.e. the entire fluid domain is filled with uniform mesh via blockMesh.

The reason why I want to do this, is because I want to test the Fictitous Domain Method (or Immersed boundary method) to calculate
the drag over a solid 3D sphere. Inside this "sphere", U is treated as the velocity of solid sphere (Zero in this case) over time via rigid constrain.

https://65.media.tumblr.com/00615987...ssaho1_540.png

I know I can use snappyHexMesh to refine cells inside a sphere with a STL mesh file:

Code:

limitRegions
{
  sphere3D.stl  // O (x, y, z), rad = R
  {
    mode    inside;
    levels    ((1e10 4));
  }
}

However, since the cells next to the sphere surface need to be very fine, and if we refine the cells inside the sphere, the amount of cells increase significantly. How to solve this issue? If we have a script like this:

Code:

...
for (AllCells)
  { 
    // D: distance between cell center to O (x, y, z)
    // H: thickness of refinement (e.g R/10)

    if ( | D - R | <= H)
      do  Add Cell-ID  to CellSet
  }

then we can use this CellSet in "refineMeshDict". I never did this before, is there any way to achieve this for the mesh pre-processing?

best regards,

David

JNSN November 29, 2016 08:56

Hi David,

you should have a look at topoSet. E.g. you can create to cellSets with cell centres within a sphere with different radii. Then subtract one from the other. There are also other possibilities with topoSet, e.g. selection based on cell centres nearest to a list of coordinates or selection based on stl-surface. See a full list of possibilites in
Code:

$FOAM_UTILITIES/mesh/manipulation/topoSet/topoSetDict
Hope this helps,
Jan

keepfit November 30, 2016 16:47

Quote:

Originally Posted by JNSN (Post 627392)
Hi David,

you should have a look at topoSet. E.g. you can create to cellSets with cell centres within a sphere with different radii. Then subtract one from the other. There are also other possibilities with topoSet, e.g. selection based on cell centres nearest to a list of coordinates or selection based on stl-surface. See a full list of possibilites in
Code:

$FOAM_UTILITIES/mesh/manipulation/topoSet/topoSetDict
Hope this helps,
Jan

Thanks Jan for the information! I noticed that the topoSet on openfoamwiki.net is out-dated which is based on OF 2.1. For OF 3.0.x and above, the "sphere" source for cells inside does exist. I think I can get this job done.

By the way, I thougght about to refine this specific region with a tedious but straight-forward method: i.e. create two closed mesh, which cover the cells between sphere-1 and sphere-2.Howvere, it seems that the "limitRegions" in sHM still does not work for both 3.0.x and 4.x. Maybe this feature is still not included?

cheers,

David


All times are GMT -4. The time now is 11:54.