Chi-Tech
MeshTutorial_07_3DExtrudedMesh.h
Go to the documentation of this file.
1/** \page MeshTutorial_07 Mesh Tutorial 7: A 3D Extruded Mesh
2
3 The idea behind extruded meshes is that the 3D complex geometrical features
4 can be reasonably well projected into a 2D plane. This 2D geometry is then meshed
5 (it is expected that this 2D mesh is unstructured).
6
7 Then, the 2D meshes is extruded and appropriate material IDs/boundary IDs
8 in 3D are provided to complete the 3D mesh.
9
10Thus, in order to obtain a 3D extruded mesh, you need
11 1. A 2D mesh
12 2. Extrusion data
13
14## The 2D mesh
15 Currently, Chi-Tech can read in VTU and OBJ files. In the case of VTU files, you
16 may provide an additional field such as 2D material IDs (i.e., material IDs that
17 correspond to the 2D geometry).
18
19 You may create your 2D mesh with our favorite mesh generator. To convert that mesh
20 into an object readable by Chi-Tech, you want need to use mesh converters (in Python,
21 there is meshio but there are other possibilities).
22
23\code
24 chiMeshHandlerCreate()
25
26 mesh2d_file = "your_mesh.obj"
27 umesh = chiUnpartitionedMeshFromWavefrontOBJ(mesh2d_file)
28\endcode
29or
30\code
31 chiMeshHandlerCreate()
32
33 mesh2d_file = "your_mesh.vtu"
34 umesh = chiUnpartitionedMeshFromVTU(mesh2d_file, "attribute")
35\endcode
36
37 ## The extrusion process
38
39 \code
40 chiSurfaceMesherCreate(SURFACEMESHER_PREDEFINED)
41 chiVolumeMesherCreate(VOLUMEMESHER_UNPARTITIONED, umesh)
42 chiVolumeMesherCreate(VOLUMEMESHER_EXTRUDER,
43 ExtruderTemplateType.UNPARTITIONED_MESH,
44 umesh);
45
46 nbr_planes_in_layer = 10
47 height=0.1
48 chiVolumeMesherSetProperty(EXTRUSION_LAYER,height,nbr_planes_in_layer,"Charlie");
49 chiVolumeMesherSetProperty(EXTRUSION_LAYER,height,nbr_planes_in_layer,"Chuck");
50 chiVolumeMesherSetProperty(EXTRUSION_LAYER,height,nbr_planes_in_layer,"Bob");
51 chiVolumeMesherSetProperty(EXTRUSION_LAYER,height,nbr_planes_in_layer,"SarahConner");
52
53 chiVolumeMesherSetProperty(PARTITION_TYPE,KBA_STYLE_XYZ)
54 chiVolumeMesherSetKBAPartitioningPxPyPz(1,1,1)
55
56 chiSurfaceMesherExecute();
57 chiVolumeMesherExecute();
58
59 chiMeshHandlerExportMeshToVTK("export_mesh_without_IDs")
60 \endcode
61
62 ## Completing the 3D mesh
63
64 To complete the 3D mesh, we need to provide material IDs and boundary IDs.
65 We use the concept of a logical volume (LV). For each material zone, we will assign
66 a material ID for cells (identified by their centroids) that are included in the LV.
67
68 We have several ways of defining a Logical Volume, LV:
69 1. Using pre-defined volumes, such as RPP (rectangular paralleliped)and RCC (right circular cylinder),
70 2. Using a surface mesh read in as an```.obj``` file,
71 3. Using lua functions to describe the surface mesh of the LV.
72
73 This should be repeated as many times as necessary to assign all 3D material IDs.
74
75 ### LV of pre-defined type
76 \code
77-- Logical Volumes
78my_LV = chiLogicalVolumeCreate(RCC, 0, 0, 0.1, 0, 0, 0.2, 0.4)
79chiVolumeMesherSetProperty(MATID_FROMLOGICAL, Air, 1)
80chiMeshHandlerExportMeshToVTK("export_mesh_with_IDs")
81 \endcode
82
83 ### LV defined as read-in surfaces
84 \code
85surf_LV = chiSurfaceMeshCreate()
86chiSurfaceMeshImportFromOBJFile(surf_LV, "LV_file.obj", false)
87my_LV = chiLogicalVolumeCreate(SURFACE, surf_LV)
88
89 chiVolumeMesherSetProperty(MATID_FROMLOGICAL, Air, 1)
90chiMeshHandlerExportMeshToVTK("export_mesh_with_IDs")
91 \endcode
92
93 ### LV using a Lua function
94 \code
95chiVolumeMesherSetProperty(MATID_FROM_LUA_FUNCTION, "my_LV_func.lua")
96chiMeshHandlerExportMeshToVTK("export_mesh_with_IDs")
97 \endcode
98
99 where the Lua function was previously defined, e.g.,
100 \code
101aaa
102 \endcode
103*/