Generate a structured quadrilateral 2D mesh Parameters ---------- hexes: bool If True, a mesh consisting of hexahedra is generated. nx : int Number of cells in x-direction. ny : int Number of cells in y-direction. nz : int Number of cells in z
(hexes=True, nx=10, ny=None, nz=None, secondorder=False, periodic_x=False, periodic_y=False, periodic_z=False, mapping = None, cuboid_mapping=False, prism=False)
| 271 | return MakeStructured2DMesh(quads=True, nx=nx, ny=ny, periodic_x=periodic_x, periodic_y=periodic_y, mapping=mapping) |
| 272 | |
| 273 | def MakeStructured3DMesh(hexes=True, nx=10, ny=None, nz=None, secondorder=False, periodic_x=False, periodic_y=False, periodic_z=False, mapping = None, cuboid_mapping=False, prism=False): |
| 274 | """ |
| 275 | Generate a structured quadrilateral 2D mesh |
| 276 | |
| 277 | Parameters |
| 278 | ---------- |
| 279 | hexes: bool |
| 280 | If True, a mesh consisting of hexahedra is generated. |
| 281 | |
| 282 | nx : int |
| 283 | Number of cells in x-direction. |
| 284 | |
| 285 | ny : int |
| 286 | Number of cells in y-direction. |
| 287 | |
| 288 | nz : int |
| 289 | Number of cells in z-direction. |
| 290 | |
| 291 | secondorder : bool |
| 292 | If True, second order curved elements are used. |
| 293 | |
| 294 | periodic_x: bool |
| 295 | If True, the left and right boundaries are identified to generate a periodic mesh in x-direction. |
| 296 | |
| 297 | periodic_y: bool |
| 298 | If True, the top and bottom boundaries are identified to generate a periodic mesh in y-direction. |
| 299 | |
| 300 | periodic_z: bool |
| 301 | If True, the top and bottom boundaries are identified to generate a periodic mesh in z-direction. |
| 302 | |
| 303 | mapping: lambda |
| 304 | Mapping to transform the generated points. If None, the identity mapping is used. |
| 305 | |
| 306 | cuboid_mapping: bool |
| 307 | If True, a straight geometry is assumed. |
| 308 | |
| 309 | prism : bool |
| 310 | If True, a mesh consisting of prism is generated. If hexes and prism is set to True, also a mesh consisting of prism is generated. |
| 311 | |
| 312 | |
| 313 | Returns |
| 314 | ------- |
| 315 | (ngsolve.mesh) |
| 316 | Returns generated 3D NGSolve mesh |
| 317 | |
| 318 | """ |
| 319 | if nz == None: |
| 320 | if ny == None: |
| 321 | nz = nx |
| 322 | else: |
| 323 | raise Exception("MakeStructured3DMesh: No default value for nz if nx and ny are provided") |
| 324 | if ny == None: |
| 325 | ny = nx |
| 326 | |
| 327 | netmesh = Mesh() |
| 328 | netmesh.dim = 3 |
| 329 | |
| 330 | if cuboid_mapping: |