Академический Документы
Профессиональный Документы
Культура Документы
http://openfoamwiki.net/index.php/2D_Mesh_Tuto...
1 de 4
23/05/11 06:53
http://openfoamwiki.net/index.php/2D_Mesh_Tuto...
Surface("front") = {28}; Surface("back") = {6}; Surface("bottom") = {27}; Surface("left") = {15}; Surface("top") = {19}; Surface("right") = {23};
7. In the .geo le, the Extrude statement must be modied to have a single layer, and then should be recombined. Do this by adding the Layers{1} and Recombine commands to the Extrude command. This ensures that the mesh blocks are created only in 2D and then extended to 3D, and not divided in the 3rd axis. For example:
Extrude {0, 0, 10} { Surface{6}; Layers{1}; Recombine; }
8. Save the .geo le in the text editor and then reload in GMSH using Reload under the Geometry menu. There should be no errors produced by GMSH. Below is an example of a 2D mesh .geo le of a simple square:
Point(1) = {-100, 100, 0, 1e+22}; Point(2) = {100, 100, 0, 1e+22}; Point(3) = {100, -100, 0, 1e+22}; Point(4) = {-100, -100, 0, 1e+22}; Line(1) = {1, 2}; Line(2) = {2, 3}; Line(3) = {3, 4}; Line(4) = {4, 1}; Line Loop(6) = {4, 1, 2, 3}; Plane Surface(6) = {6}; Physical Volume("internal") = {1}; Extrude {0, 0, 10} { Surface{6}; Layers{1}; Recombine; } Physical Surface("front") = {28}; Physical Surface("back") = {6}; Physical Surface("bottom") = {27}; Physical Surface("left") = {15}; Physical Surface("top") = {19}; Physical Surface("right") = {23};
2 de 4
23/05/11 06:53
http://openfoamwiki.net/index.php/2D_Mesh_Tuto...
9. Create the mesh in GMSH by selecting 3D from the Mesh menu. If everything is set up correctly (via the Extrude modications), the sides of the 3D mesh should only have straight lines connecting the front face to the back face. This is required for OpenFOAM because for 2D analysis the mesh blocks should only change in two dimensions. OpenFOAM will produce an error if the mesh does not meet this requirement. The size of the mesh elements can be controlled by setting the Element Size Factor under Mesh in the Options window (select Tools->Options from the main menu). The smaller the number, the smaller the mesh elements. For the changes in element size factor to take place, just go back to Geometry, Reload, then back to Mesh and click 3D. 10. Save the mesh by selecting Save from the Mesh menu. This will create a le using the same name as the .geo le, but ending in .msh. This will be used by the OpenFOAM utility gmshToFoam that is shipped with OpenFOAM.
This will create the mesh used by OpenFOAM under the constant/polyMesh directory. If there are any errors, ensure that a proper case directory is set up (refer to OpenFOAM documentation, or use a pre-shipped case directory such as icoFoam or simpleFoam). If the errors indicate no 3D elements exist, or there is another mesh problem, make sure all steps were followed in the GMSH section of this tutorial. 3. Check that the mesh conforms to OpenFOAM standards by running checkMesh from the console. 4. To conrm that the boundaries made it to the OpenFOAM mesh, open the boundary le in the case directory under constant/polyMesh. Each boundary is dened here. For the faces that are along the 3rd dimension, set the type to empty. For example:
back { type
empty;
3 de 4
23/05/11 06:53
http://openfoamwiki.net/index.php/2D_Mesh_Tuto...
2858; 4217;
This will indicate to OpenFOAM that this is a 2D case. Ensure that all other boundaries as dened in the GMSH .geo le are present. There will also be a defaultFaces boundary that should have nFaces = 0 (it is unclear what will happen if nFaces is not 0):
defaultFaces { type nFaces startFace }
patch; 0; 10073;
5. The 2D mesh is now ready to be used by OpenFOAM. Be sure that the boundaries names in the initial conditions les (for example p, U, etc...) match those if the boundary le. For the empty faces (3rd dimension), set the boundary type to empty in these les. 6. If all went well, OpenFOAM should be able to use the new mesh for a 2D case. If things dont go well... OpenFOAM will let you know. Retrieved from "http://openfoamwiki.net/index.php /2D_Mesh_Tutorial_using_GMSH" This page was last modied on 12 September 2010, at 12:15. Content is available under GNU Free Documentation License 1.2.
4 de 4
23/05/11 06:53