Mesh Source Code
mesh.mesh.Mesh
Bases: ABC
This class implements an abstract meshing class.
Source code in aero_optim/mesh/mesh.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
|
__init__(config: dict, datfile: str = '')
Instantiates the abstract Mesh object.
Input
- config (dict): the config file dictionary.
- dat_file (str): path to input_geometry.dat.
Inner
- outdir (str): path/to/outputdirectory
- outfile (str): the core name of all outputed files e.g. outfile.log, outfile.mesh, etc.
- scale (float): geometry scaling factor.
- header (int): the number of header lines in dat_file.
- mesh_format (str): the mesh format (mesh or cgns).
- bl (bool): whether to mesh the boundary layer (True) or not (False).
- bl_thickness (float): the BL meshing cumulated thickness.
- bl_ratio (float): the BL meshing growth ratio.
- bl_size (float): the BL first element size.
- bl_fan_elements (int): the number of BL fan elements.
- mesh_order (int): the order of the mesh.
- structured (bool): whether to recombine triangles (True) or not (False).
- extrusion_layers (int): the number of extrusion layers when generating a 3D mesh.
- extrusion_size (float): the total size of the extruded layers.
- GUI (bool): whether to launch gmsh GUI (True) or not (False).
- nview (int): the number of sub-windows in gmsh GUI.
- quality (bool): whether to display quality metrics in gmsh GUI (True) or not (False).
- pts (list[list[float]]): the geometry coordinates.
- surf_tag (list[int]): flow-field elements tags used to recombine the mesh if structured.
- non_corner_tags (list[int]): non-corner physical entity tags used to define 'Corners'.
- lower_tag (list[int]): lower periodic tags to be identified as one.
- lower_tag (list[int]): upper periodic tags to be identified as one.
Source code in aero_optim/mesh/mesh.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
|
add_corners(mesh: list[str]) -> list[str]
Adds Corners at the end of the mesh file.
Source code in aero_optim/mesh/mesh.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
build_2dmesh()
abstractmethod
Builds the surface mesh of the computational domain.
Source code in aero_optim/mesh/mesh.py
286 287 288 289 290 |
|
build_3dmesh()
Builds a 3D mesh by extrusion
Source code in aero_optim/mesh/mesh.py
292 293 294 295 296 |
|
build_mesh()
Defines the gmsh routine.
Source code in aero_optim/mesh/mesh.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
get_meshfile(mesh_dir: str) -> str
Returns the path to the generated mesh.
Source code in aero_optim/mesh/mesh.py
274 275 276 277 278 |
|
get_nlayer() -> int
Returns the number of layers required to reach bl_thickness given the growth bl_ratio and the first element size bl_size.
Source code in aero_optim/mesh/mesh.py
115 116 117 118 119 120 121 122 123 |
|
merge_refs(mesh: list[str]) -> list[str]
Merges the periodic boundaries references on each side of the domain.
Source code in aero_optim/mesh/mesh.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
|
process_config()
abstractmethod
Makes sure the config file contains the required information.
Source code in aero_optim/mesh/mesh.py
280 281 282 283 284 |
|
reformat_2d(mesh: list[str]) -> list[str]
Fix gmsh default .mesh format in 2D.
Source code in aero_optim/mesh/mesh.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
write_mesh(mesh_dir: str = '') -> str
Writes all output files:
- mesh_dir: the name of the directory where all gmsh generated files are saved.
- format: whether to perform medit formatting (True) or not (False) of the mesh.
- self.outfile: the core name of the outputed files e.g. outfile.log, outfile.mesh, etc.
Source code in aero_optim/mesh/mesh.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
mesh.naca_base_mesh.NACABaseMesh
Bases: Mesh
This class implements a meshing routine for a naca profile.
The computational domain has the following structure:
pt_hi_inlet
! top_side
! !
* * ------------- * pt_hi_outlet
* * * |
* * |
* |
* * |
* |
* <- arc_inlet | <- outlet
* |
* * |
* |
* * |
* * * |
* * ------------- * pt_low_outlet
! !
! bottom_side
pt_low_inlet
Source code in aero_optim/mesh/naca_base_mesh.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
__init__(config: dict, datfile: str = '')
Instantiates the NACABaseMesh object.
Input
- config (dict): the config file dictionary.
- dat_file (str): path to input_geometry.dat.
Inner
- dinlet (float): the radius of the inlet semi-circle.
- doutlet (float): the distance between the airfoil trailing edge and the outlet.
- offset (int): the leading edge portion defined in number of points from the leading edge.
- nodes_inlet (int): the number of nodes to mesh the inlet.
- nodes_outlet (int): the number of nodes to mesh the outlet.
- snodes (int): the number of nodes to mesh the top and bottom sides.
- le (int): the number of nodes to mesh the airfoil leading edge portion.
- low (int): the number of nodes to mesh the airfoil trailing edge lower portion.
- up (int): the number of nodes to mesh the airfoil trailing edge upper portion.
Source code in aero_optim/mesh/naca_base_mesh.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
build_2dmesh()
Builds the surface mesh of the computational domain.
Source code in aero_optim/mesh/naca_base_mesh.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
build_bl(naca_tag: list[int], te_tag: int)
Builds the boundary layer around the airfoil.
Source code in aero_optim/mesh/naca_base_mesh.py
101 102 103 104 105 106 107 108 109 110 111 112 113 |
|
split_naca() -> tuple[list[list[float]], list[list[float]]]
Returns the upper and lower parts of the airfoil as ordered lists (wrt the x axis).
Note
the trailing and leading edges are voluntarily excluded from both parts since the geometry is closed and these points must each have a unique tag.
Source code in aero_optim/mesh/naca_base_mesh.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
mesh.naca_block_mesh.NACABlockMesh
Bases: NACABaseMesh
This class implements a blocking mesh routine for a naca profile based on: https://github.com/ComputationalDomain/CMesh_rae69ck-il
Source code in aero_optim/mesh/naca_block_mesh.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
__init__(config: dict, datfile: str = '')
Instantiates the BlockMesh object.
Input
- config (dict): the config file dictionary.
- dat_file (str): path to input_geometry.dat.
Source code in aero_optim/mesh/naca_block_mesh.py
14 15 16 17 18 19 20 21 22 23 |
|
build_2dmesh()
Builds the surface mesh of the computational domain.
Inner
- R (float): radius of the outer circle.
- d_out (float): distance to the outlet.
- offset (int): offset from leading edge.
- b_width (float): block_width.
- n_inlet (int): nbr of lead edge & inlet nodes.
- r_inlet (float): bump ratio of lead edge & inlet nodes.
- n_vertical (int) : nbr of out & verti nodes.
- r_vertical (float): out & vert growth.
- n_airfoil (int): nbr of nodes on each sides.
- r_airfoil (float): airfoil sides growth.
- n_wake (int): nbr of nodes in the wake dir.
- r_wake (float): wake growth.
Source code in aero_optim/mesh/naca_block_mesh.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
mesh.cascade_mesh.CascadeMesh
Bases: Mesh
This class implements a mesh routine for a compressor cascade geometry.
Source code in aero_optim/mesh/cascade_mesh.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
|
__init__(config: dict, datfile: str = '')
Instantiates the CascadeMesh object.
Input
- config (dict): the config file dictionary.
- dat_file (str): path to input_geometry.dat.
Inner
- doutlet (float): outlet distance to the blade trailing edge.
- dlr_mesh (bool): builds the DLR provided mesh (True) or a simpler for adaptation (False).
- bl_sizefar (float): boundary layer mesh size far from the curves.
- nodes_inlet (int): the number of nodes to mesh the inlet.
- nodes_outlet (int): the number of nodes to mesh the outlet.
- snodes_inlet (int): the number of nodes to mesh the inlet top and bottom sides.
- snodes_outlet (int): the number of nodes to mesh the outlet top and bottom sides.
- c_snodes (int): the number of nodes to mesh the inner sides.
- le (int): the number of nodes to mesh the blade leading edge portion.
- te (int): the number of nodes to mesh the blade trailing edge lower portion.
- nodes_sp2 (int): the number of nodes to mesh the 1st section of the blade suction side.
- nodes_sp3 (int): the number of nodes to mesh the 2nd section of the blade suction side.
- nodes_sp4 (int): the number of nodes to mesh the 3rd section of the blade suction side.
- nodes_sp7 (int): the number of nodes to mesh the 1st section of the blade pressure side.
- nodes_sp8 (int): the number of nodes to mesh the 2nd section of the blade pressure side.
- nodes_ss (int): the number of nodes to mesh the suction side (dlr_mesh set to False).
- nodes_ps (int): the number of nodes to mesh the pressure side (dlr_mesh set to False).
- cyl_vin (float): cylinder field parameter Vin.
- cyl_vout (float): cylinder field parameter Vout.
- cyl_xaxis (float): cylinder field parameter Xaxis.
- cyl_xcenter (float): cylinder field parameter Xcenter.
Note
for the DLR configuration, the blade is split into 9 splines (clockwise from the tip):
- 2 splines (1 and 9) for the leading edge parameterized with le i.e. each spline has le/2 nodes,
- 2 splines (5 and 6) for the trailing edge parameterized with te i.e. each spline has te/2 nodes,
- 3 splines for the suction side (2, 3, 4) of lengths 0.027, 0.038 and 0.061 m, and parameterized with nodes_sp2, nodes_sp3 and nodes_sp4,
- 2 splines for the pressure side (7, 8) of lengths 0.0526 and 0.0167 m, and parameterized with nodes_sp7, nodes_sp8
Source code in aero_optim/mesh/cascade_mesh.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
build_2dmesh()
Builds the surface mesh of the computational domain.
Source code in aero_optim/mesh/cascade_mesh.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|
build_3dmesh()
Performs an extrusion along the z axis. - h_size (float): the total extruded depth.
Source code in aero_optim/mesh/cascade_mesh.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
|
build_bl(blade_tag: list[int])
Builds the boundary layer around the blade.
Source code in aero_optim/mesh/cascade_mesh.py
100 101 102 103 104 105 106 107 108 109 110 111 |
|
build_cylinder_field(radius: float, VIn: float, VOut: float, XAxis: float, XCenter: float, YAxis: float, YCenter: float, ZAxis: float = 0.0) -> int
Builds a cylinder field in the computational domain.
Source code in aero_optim/mesh/cascade_mesh.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
build_minaniso_field(tag: list[int])
Builds a MinAniso field in the computational domain.
Source code in aero_optim/mesh/cascade_mesh.py
134 135 136 137 138 139 140 |
|
reorder_blade() -> list[list[float]]
Returns the blade profile after reordering.
Source code in aero_optim/mesh/cascade_mesh.py
89 90 91 92 93 94 95 96 97 98 |
|