CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [mesh manipulation] How to use refineHexMesh just in 2 direction? (https://www.cfd-online.com/Forums/openfoam-meshing/125651-how-use-refinehexmesh-just-2-direction.html)

ripperjack October 28, 2013 14:58

How to use refineHexMesh just in 2 direction?
 
Hi all,

I am simulating a case with a very large mesh (>40 million). I need to generate a coarse mesh first, and decompose it, and then refine the mesh using refineMesh.

Unfortunely, refineMesh just "refine" the mesh but it can not interpolate the initial value so I need to use refineHexMesh instead. But again, refineHexMesh will automatically refine the mesh in all x,y,z direction, which is not what I want.

In wall-normal direction (y), I need to control the mesh directly and I will specify the mesh distribution in the coarse mesh and I just want to refine in the x, and z direction. I can just refine in x,z direction using refineMesh (I can add some lines in refineMeshDict), but I can not do similar thing by using refineHexMesh.

So is there any way I can do it? I tried many ways but all failed...

Tons of thanks in advance!

Best regards,

wyldckat October 28, 2013 15:52

Greetings Ping,

Just a quick question: have you tried looking at the source code of refineMesh and refineHexMesh to see if it would be possible to add the map fields feature to refineMesh?

On the other hand, do you want to only refine in 2 directions because the case is in 2D or is there another reason?

Best regards,
Bruno

ripperjack October 29, 2013 08:37

Quote:

Originally Posted by wyldckat (Post 459496)
Greetings Ping,

Just a quick question: have you tried looking at the source code of refineMesh and refineHexMesh to see if it would be possible to add the map fields feature to refineMesh?

On the other hand, do you want to only refine in 2 directions because the case is in 2D or is there another reason?

Best regards,
Bruno

Dear Bruno,

Thanks very much, I took a look at the source code of refineMesh, refineHexMesh. They are very different, I took a shoot to add something into refineMesh but no success yet, I will keep trying. Anyway it is a good suggestion thanks!

BTW: I want to just refine in x, z direction because in y direction, the mesh is not uniform, and I want to explicitly control the grid distribution, e.g., the first grid above the wall, how many grid below y+=10, etc. I do not know if I can get the same grid distribution by using refineMesh in y direction.

Regards,

wyldckat November 2, 2013 17:17

Hi Ping,

I gave it a try myself, but refineMesh uses one way of cutting meshes that seems to be very different from the refineHexMesh one, where the latter relies on polyTopoChange to map the fields from one mesh to the other. Therefore, it's not possible to easily adapt the code from one to another :(

Nonetheless, have you tried using mapFields with these options?
Code:

mapFields -parallelSource -parallelTarget
It will load and unload one processor-mesh at a time, not all at once, therefore it can run in serial mode (i.e. not parallel).

Best regards,
Bruno

ripperjack November 2, 2013 19:13

Quote:

Originally Posted by wyldckat (Post 460281)
Hi Ping,

I gave it a try myself, but refineMesh uses one way of cutting meshes that seems to be very different from the refineHexMesh one, where the latter relies on polyTopoChange to map the fields from one mesh to the other. Therefore, it's not possible to easily adapt the code from one to another :(

Nonetheless, have you tried using mapFields with these options?
Code:

mapFields -parallelSource -parallelTarget
It will load and unload one processor-mesh at a time, not all at once, therefore it can run in serial mode (i.e. not parallel).

Best regards,
Bruno

Dear Bruno,

Wow, this works perfect, and it is exact what I need! Tons of thanks!

Have a great weekend!

Regards,

Chatur Ramalingum April 8, 2014 16:19

Dear Mr. Wyldcat:
Sir, I would to understand the differences between refineMesh and refineHexMesh. It seems that refineMesh can be run soon after we run blockMesh to create the initial coarse mesh. With refineHexMesh, it appears that we are required to run cellSet before running refineHexMesh. Is this true? Is there an example that shows how to use refineHexMesh and cellSet. I checked the tutorials in OF2.3.x, but was not able to find an example.

Thanking you,
Chatur

wyldckat April 13, 2014 15:19

Greetings Chatur,

On the wiki there is a bit more information:
Essentially the refineHexMesh utility is a specific implementation of some features used in refineMesh, more specifically, it only takes care of refining hexahedral cells.

As for a tutorial that demonstrates using refineHexMesh, run this command:
Code:

find $FOAM_TUTORIALS -name Allrun | xargs grep refineHexMesh
It will show you that the tutorial "incompressible/simpleFoam/pipeCyclic" uses this utility.

Best regards,
Bruno

lramutti May 21, 2014 18:53

Hey guys,

I have a mesh that I have developed in Fluent - roughly 2 million cells - and I was wondering if I could use refineMesh settings to refine it even more in OpenFOAM. The reason why I do not want to refine it in Fluent is because I cannot control the number of elements of refinement. On top of the that I am dealing with an unstructured grid meshed as tets. Would it be possible to do so?

Cheers

wyldckat May 31, 2014 13:43

Hi Lucas,

I would advise you against using tetrahedral cells for OpenFOAM simulations cases. They can be used, but additional care must be taken into account when generating the mesh... well, in general, one should be always careful when generating a mesh, but with tets more care is required. To give you an idea of what I'm talking about, have a look into this blog post: OpenFOAM: Interesting cases of bad meshes and bad initial conditions

Nonetheless, although I have not tested this yet, I do believe that refineMesh should be able to refine tetrahedral cells, i.e. decompose them into smaller tetrahedral cells.

Best regards,
Bruno


All times are GMT -4. The time now is 03:27.