|
[Sponsors] |
[mesh manipulation] Converting a 2Dmesh to axisymmetric |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 10, 2016, 02:31 |
|
#201 | |
Senior Member
Freedom
Join Date: May 2014
Posts: 209
Rep Power: 13 |
Dear Davi Barreira,
Quote:
Best regards, Wen |
||
April 17, 2018, 02:27 |
makeAxialMesh problem
|
#202 | |
New Member
luong hung truyen
Join Date: Sep 2016
Posts: 10
Rep Power: 10 |
Quote:
I met the same problem. I found out the solution that we should specify "the offset" I solved the problem by adding "the offset" example: "makeAxialMesh -axis axisPatchName -wedge wedgePatchName -offset 5" here is the reference: https://openfoamwiki.net/index.php/M...s/AxiSymmetric |
||
June 22, 2018, 05:48 |
|
#203 |
Senior Member
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12 |
The Warning occurred during collapseEdges can be solved by change writeFormat from ascii to binary in controlDict.
Code:
--> FOAM Warning : From function wedgePolyPatch::calcGeometry(PstreamBuffers&) in file meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C at line 72 Wedge patch 'frontAndBack_pos' is not planar. At local face at (0.003875 0.067375 0.000169026) the normal (-0.0435786 -1.65279e-18 0.99 905) differs from the average normal (-0.0435779 -4.96938e-20 0.99905) by 4.36392e-13Either correct the patch or split it into planar parts
__________________
https://openfoam.top |
|
August 23, 2018, 15:58 |
makeAxialMesh for OF-5.0
|
#204 |
Member
Kumar
Join Date: Jun 2013
Posts: 47
Rep Power: 13 |
I was trying to compile this utility for OpenFOAM 5.0 and had to make a couple of tiny changes to get rid of some issues during compilation and usage. In case someone is interested:
(1) In function ChangeTypes(polyMesh &mesh, word wedge, word axis, bool hasOffset), axis patches are changed to symmetry patches (instead of symmetryPlane) in the corresponding constructor. I think that with the old symmetryPlane bc, the normals of the patch should be perfectly aligned and in many cases this may not be possible due to round-off errors and OF throws warning/error messages. The symmetry bc is less strict and does away with these. (2) Included "IOdictionary.H" for handling the rotationDict object. Tested with OpenFOAM 5.0. Thanks Bernhard for such a useful utility. |
|
March 15, 2020, 14:43 |
Modification to the code
|
#205 |
New Member
Nicoḷ Badodi
Join Date: Mar 2020
Posts: 20
Rep Power: 6 |
Dear Bernard,
First of all thanks for this utility, I was going crazy and you saved me from descending into a well of desperation!! Second thing, I found some problems while compiling your application, but solved them doing the following changes: Into the file makeAxialMesh.C I added the preprocessor line: #include "IOdictionary.h"into the file options I substituted the lines -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude\ -I$(LIB_SRC)/cfdTools/lnInclude\with -I$(LIB_SRC)/finiteVolume/lnInclude\This was necessary to achieve compilation on my machine with Openfoam7 (version 20190902 100). Hope this will be helpful to anyone is having trouble compiling! I am new to this this forum and to forums in general, so I hope I have done something good by posting this! |
|
March 15, 2020, 18:13 |
|
#206 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Thank you very much. I haven't used the utility for quite some time (not because I don't like it but because I didn't have the need for it) so I didn't stumble on it
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
June 8, 2020, 12:34 |
|
#207 |
New Member
Join Date: May 2020
Posts: 11
Rep Power: 6 |
Hey Guys,
I have a question, i used the Make Axial Mesh funtion to create axissymetric mesh, the axis is type symmetry, is this correct? According to the openfoam user guide (4.3.3) this should be empty i think. For my special case my simulation does only run 0.4 seconds if axisymetric with symetric boundary condition at the axis. Any suggestions? Kind regards Daniel |
|
June 13, 2020, 16:31 |
|
#208 |
New Member
Nicoḷ Badodi
Join Date: Mar 2020
Posts: 20
Rep Power: 6 |
Hi I7aniel,
so I understood some things in the meanwhile: if you have a patch where you should have the symmetry axis, then your mesh is terribly wrong! If the generation of the axysimmetric mesh generation was successful, you would end with only the front and back patches that are of type wedge, and no patches where the axis of symmetry is, because there any face present should have been collapsed to an edge and the resulting empty patch removed. My suggestion to build an axysimmetric mesh is to do that by using the extrudeMesh utility and the extrudeMeshDict to revolve the front patch of your mesh. You can find a template here: https://github.com/OpenFOAM/OpenFOAM...xtrudeMeshDict If you're trying to import the mesh from another software, the situation is a little bit more complicated because the front and back plane of your flat mesh are fused in a single patch and you need to split them, I can explain you how. |
|
October 10, 2021, 15:58 |
Patch Error
|
#209 |
New Member
Chris
Join Date: Apr 2019
Posts: 9
Rep Power: 7 |
Hello, I was also getting the error after running blockMesh and running makeAxialMesh:
"--> FOAM FATAL ERROR: Symmetry plane 'center' is not planar. At local face at (0 1.333333333e-05 1e-05) the normal (-1 0 0) differs from the average normal (-0.352 0 0) by 0.419904 Either split the patch into planar parts or use the symmetry patch type From function virtual void Foam::symmetryPlanePolyPatch::calcGeometry(Foam::P streamBuffers&) in file meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C at line 66." One of the posts here said to apply an offset to get around the issue but offsetting puts a hole in the domain and I don't want to do that. Has there been any further discussion here about how to solve this issue without needing to offset? Thank you. My blockMesh is as shown below: /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1812 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object blockMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // vertices ( (0 0 0) //0 (0.001 0 0) //1 (0.001 0 0.00002) //2 (0 0 0.00002) //3 (0 0.002 0) //4 (0.001 0.002 0) //5 (0.001 0.002 0.00002)//6 (0 0.002 0.00002) //7 (0 0.0025 0) //8 (0.001 0.0025 0) //9 (0.001 0.0025 0.00002) //10 (0 0.0025 0.00002) //11 ); blocks ( hex (0 1 5 4 3 2 6 7) (50 100 1) simpleGrading (1 1 1) hex (4 5 9 8 7 6 10 11) (50 25 1) simpleGrading (1 1 1) ); edges ( ); boundary ( center { type symmetryPlane; faces ( (0 3 7 4) (4 7 11 8) ); } rightWall { type wall; faces ( (1 2 6 5) (5 6 10 9) ); } bottomWall { type wall; faces ( (0 1 2 3) ); } atmosphere { type patch; faces ( (8 9 10 11) ); } frontAndBackPlanes { type patch; faces ( (0 1 5 4) (4 5 9 8) (3 2 6 7) (7 6 10 11) ); } ); mergePatchPairs ( ); // ************************************************** *********************** // Last edited by chw68014; October 10, 2021 at 15:59. Reason: adding additional information |
|
October 11, 2021, 05:05 |
Revolving mesh method
|
#210 | |
New Member
Nicoḷ Badodi
Join Date: Mar 2020
Posts: 20
Rep Power: 6 |
Quote:
I think that you are chosing a wrong symmetry plane.. The plane you use for revolving the mesh and creating a fully axial mesh should lie in the x-y plane.. The method that I'm using now to create axial meshes is the following:
I attached to this answer a test case in which the procedure I just described is implemented starting from your mesh. I hope I helped you! |
||
October 13, 2021, 02:10 |
|
#211 | |
New Member
Chris
Join Date: Apr 2019
Posts: 9
Rep Power: 7 |
Quote:
1) "If you are importing the mesh, use topoSet and createPatch utilities to split the frontAndBackPlanes into two different patches, and use translateMesh to ensure that the patch you want to extrude lies in the x-y plane." Are you saying that, if I use blockMesh to create my mesh and not by importing it, I don't need to use topoSet and createPatch? Or do I need to use them regardless? It seems that way from your Allmesh file. 2) From your instructions, it sounds like I need one patch in the xy plane. As I previously stated, my frontAndBackPlanes patch includes one surface that is offset from but parallel to the xy plane. Is this a problem? If so, how do I fix it? 3) "flipNormals true; //or false, try until you get it" I dont know what you mean by "try until you get it". 4) "estrudeModel sector; //sector if you want to extrude more than one layer or wedge if you want to extrude only one layer" So for a 360 degree revolution about the y axis, would i pick wedge or sector? Thank you so much for the help. Chris W |
||
October 13, 2021, 02:39 |
|
#212 | |
New Member
Nicoḷ Badodi
Join Date: Mar 2020
Posts: 20
Rep Power: 6 |
Quote:
Hi Chris, 1) yes, if you use blockmesh, instead of creating a patch with two faces (front and back) you can directly create two split patches and extrude the one that lies in the x-y plane skipping the topoSet and createPatch passages. In fact what these two commands do is to split the frontAndBack patch that you have in your mesh into two (that I called front_cyc and back_cyc) so you can extrude only one. 2) The fact that your frontAndBack include two surfaces (and one of them does not lie in the x-y plane) is a problem, since with my script you take the patch and revolve it around the axis. Thus you are revolving the whole patch, which is composed of two surfaces, and the software doesn't understand what's happening. 3) so flipNormals tells the software to change the orientation of the patch that is created at the end of the estrusion. If that's true or false it depends on the other parameter exposedPatchName. I never remember which value (True or False) it is right, try it, if you get the right one the software will say nothing, otherwise it will return an error or complain in general 4) For 360° extrusion you need to pick sector, set the angle parameter to 360° and the mergeFaces parameter to true. This will glue together the patches ypu used for the extrusion once the 360° revolution is complete. I attached the mesh I generated using the case I sent you last time by omitting mergeFaces, and you can see it has an internal patch which is the one used for the extrusion that must be removed. PS: I noticed an error in the files I sent you, in the extrudeMeshDict you should change the initial part like this: //constructFrom mesh; constructFrom patch; //constructFrom surface; // If construct from patch/mesh: sourceCase "."; sourcePatches (back_cyc); // If construct from patch: patch to use for back (can be same as sourcePatch) exposedPatchName front_cyc; // If construct from surface: //surface "movingWall.stl"; // Flip surface normals before usage. Valid only for extrude from surface or // patch. flipNormals true; Hope this helps, Nicolo. |
||
October 17, 2021, 16:25 |
|
#213 | |
New Member
Chris
Join Date: Apr 2019
Posts: 9
Rep Power: 7 |
Quote:
Ok, so I split up frontAndBackPlanes into two patches, one called front_cyc in the x-y plane and one called back_cyc, which was offset but parallels from the x-y plane. The changes I made to extrudeMeshDict were to set sourcePatches to front_cyc (the patch in the x-y plane), set exposedPatchName to back_cyc (the offset patch), set mergeFaces to True, and set angle to 180 and nLayers to 1 because it said in the file that nLayers = 1 would provide symmetry. I ran blockMesh, and then ran extrudeMesh and got the error, after some running, as follows: "--> FOAM FATAL ERROR: Points on patch sides do not match to within tolerance 2e-08 From function virtual void Foam:erfectInterface::setRefinement(const indirectPrimitivePatch&, const indirectPrimitivePatch&, Foam:olyTopoChange&) const in file perfectInterface/perfectInterface.C at line 218. FOAM exiting" I attached blockMeshDict and extrudeMeshDict so you can see what may be wrong. Do you see anything obvious I did wrong? Thank you for the help. blockMeshDict.txt extrudeMeshDict.txt |
||
October 18, 2021, 05:08 |
|
#214 | |
New Member
Nicoḷ Badodi
Join Date: Mar 2020
Posts: 20
Rep Power: 6 |
Quote:
OK so there are two ways of providing cyclic symmetry in OpenFOAM:
The resulting mesh should look like the one in the first attached image named mesh_wedge.2. You extrude your mesh by 360°. In this case the configuration is: The error you are getting is because you set the angle at 180° and the front_cyc and back_cyc do not overlap! mergeFaces tryes to stitch them together but since they're distant it can't and throws an error. Also you can't extrude single layers more than few degrees otherwise you get triangles, you lose precision and get highly skewed mesh like the one of the third image in which I extruded 120° with only one layer (nLayer 1; angle 120! mesh_trianglular.jpg BTW I highly suggest you use ParaFoam or ParaView to look at your mesh and try varying the parameters in the files to understand how they affect the mesh cereation. Hope this is clear, Nicoḷ. Last edited by NBad; October 18, 2021 at 05:16. Reason: More detailed |
||
October 19, 2021, 16:00 |
It worked!
|
#215 | |
New Member
Chris
Join Date: Apr 2019
Posts: 9
Rep Power: 7 |
Quote:
My next difficulty is setting the initial conditions for the domain using setFields. I have a setFieldsDict set up right now to have a default oil volume fraction of 0, an oil volume fraction of 1 for a portion of the domain using cellToCylinder (full domain radius up to a height of 0.002 m which is 0.0005 m away from the domain top), and a sphereToCell at a specific point to create a single gas bubble (I think I need to make this a cylinderToCell approximation because of my cylindrical domain now). I tried using setFields out right after creating the domain but I get an error that says: "--> FOAM FATAL IO ERROR: size 62500 is not equal to the given value of 2250000 file: /storage/home/chw119/scratch/TEST/Axisymm/Base_help/0/alpha.oil From function Foam::Field<Type>::Field(const Foam::word&, const Foam::dictionary&, Foam::label) [with Type = double; Foam::label = int] in file /storage/work/asr20/OpenFOAM/OpenFOAM-v1912/src/OpenFOAM/lnInclude/Field.C at line 222. FOAM exiting" I'm assuming setFields is not reading my current mesh correctly and needs me to manipulate the initial condition files in the '0' folder and maybe even setFieldsDict to read the mesh properly. Do you have any examples on how to go about this? I attached one of current files in the 0 folder and my setFieldsDict file to show you what I have right now. Thank you. Chris W setFieldsDict.txt U.txt |
||
October 20, 2021, 04:15 |
|
#216 | |
New Member
Nicoḷ Badodi
Join Date: Mar 2020
Posts: 20
Rep Power: 6 |
Quote:
Dear Chris, I'm happy I could help ! However, I never used the setFields utility, so I can't help you with this new issue. I suggest you look on the internet for the error and try to work out the issue from that. But if I understood correctly your problem, I would suggest you to use the wedge method to build your mesh to reduce the computational effort needed. NB: run checkMesh to check if everything is ok with the mesh!!! I think you might want to change the flipNormals in extrudeMeshDict to false. NNB: you might want to add a second createPatchDict with no patches in it and run the createPatch utility after the extrusion to remove empty patches left from the previous meshing steps, like I did here: createPatchDict1.txt Sincerely, Nicolo. Last edited by NBad; October 20, 2021 at 05:18. |
||
October 29, 2021, 00:45 |
|
#217 | |
New Member
Chris
Join Date: Apr 2019
Posts: 9
Rep Power: 7 |
Quote:
Thank you for the feedback. I ran createPatch using the createPatchDict you attached and it wrote a new 'polyMesh' folder with the mesh files without the empty center patch included within a new folder called '1e-07'. Should I take the polyDict files in that folder and overwrite the polyDict files in the 'constant' folder? I want to make sure the right mesh files are read when the simulation is run. Regarding my earlier mention of setFields, I essentially want to establish an initial condition of half a circular bubble at the rotational axis by setting the void fraction to 0 for a circular region. Would I need to do that prior to running extrudeMesh or do you know of a way to do that after extruding the mesh and removing the empty patches? Thank you for everything. Chris W |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Simplest way of converting a 2d Navier Stokes code to a 2d axisymmetric one | mseka | Main CFD Forum | 1 | September 18, 2017 15:53 |
Axisymmetric Boundary condition | Mohit Singh | SU2 | 3 | July 15, 2015 10:19 |
[mesh manipulation] Converting axisymmetric mesh into fully 3D mesh | tomloh | OpenFOAM Meshing & Mesh Conversion | 0 | April 29, 2012 21:31 |
Difference of final temperature between a plane and an axisymmetric geometry | douchka | FLUENT | 0 | July 7, 2011 09:38 |
URGENT ! Need help on Axisymmetric Flow ! | Suman Kumar | Main CFD Forum | 1 | November 20, 2001 15:51 |