LaGriT Example: Octree Refine Hex, Intersect Object

This example outline the steps to:

Create a hex mesh
Create two surface meshes
Octree refine hex mesh where it is intersected by the surface meshes
Connect/noadd octree nodes into a tet mesh
Color nodes of tet mesh based on geometry of defined by surfaces
Connect octree nodes into a tet mesh
Resolve material interfaces by automatic point addition

LaGriT Input Control Files:

input.lgi
create_hex_mesh.mlgi
create_surface_mesh.mlgi
refine_object.mlgi
amr2lagrit_10.mlgi
geometry.mlgi

Image Gallery

*--* ex_intersect_refine_octree
*--* Header Begin
*--* LAGriT Example Input file
* Carl Gable
* gable -at- lanl -dot- gov
*
*
*--* Create a hex mesh
*--* Create two surface meshes
*--* Octree refine hex mesh where it is intersected by the surface meshes
*--* Connect/noadd octree nodes into a tet mesh
*--* Color nodes of tet mesh based on geometry of defined by surfaces
*--* Connect octree nodes into a tet mesh
*--* Resolve material interfaces by automatic point addition
*--*
*--*----------------------------------------------------
*--* Header End
*--* ex_intersect_refine_octree
*--*
**
* infile driver_intersect_refine.lgi
* create_hex_mesh.mlgi
* create_surface_mesh.mlgi
* refine_object.mlgi
* amr2lagrit_10.mlgi
* geometry.mlgi
*
*========================================================================
*
* Create a hex mesh with extents 0.1 0.1 0.1 to 0.9 0.9 0.9
*
define / CMO_HEX / cmo_1
infile create_hex_mesh.mlgi
dump / gmv / hex_l0.gmv / CMO_HEX
*
* Create a quad surface mesh
* and then assign the Z coordinate by z=sin(y)
*
define / CMO_OBJ / cmo_2
infile create_surface_mesh.mlgi
cmo/setatt//ipolydat/no
dump / gmv / surf1.gmv / CMO_OBJ
*
* Copy the surface into another mesh object and rotate it
* around a line.
*
cmo / copy / cmo_3 / cmo_2
cmo / select / cmo_3
cmo / printatt / -def- / -xyz- / minmax
rotateln / 1 0 0 / nocopy / -1.0 0.5 0.5 / 2.0 0.5 0.5 / 70.0
cmo / printatt / -def- / -xyz- / minmax
rotateln / 1 0 0 / nocopy / -1.0 0.4 0.48 / 2.0 0.6 0.51 / -10.0
cmo / printatt / -def- / -xyz- / minmax
dump / gmv / surf2.gmv / CMO_OBJ
*
*
addmesh / append / cmo_tmp / cmo_2 / cmo_3
cmo / setatt / cmo_tmp / ipolydat / no
dump / gmv / geometry_surfaces.gmv / cmo_tmp

dump / gmv / geometry_surfaces.gmv / cmo_tmp LaGriT: Geometry Surfaces


cmo / delete / cmo_tmp
*
*========================================================================
*
* Refine the hex mesh using octree refinement. In this example
* the elements that are refined are determined by intersecting the
* quad surfaces with the hex mesh. However, any other criteria could
* used. The main thing is that the user creates an element set and
* then refines that element set.
*
* If you enter LEVEL = N, refine (itetlev) will go to N+1
*
* L0 - Level 0, base mesh
* L1 - Level 1, refine base mesh once
* L2 - Level 2, refine base mesh twice
* etc.
*
*========================================================================
*
* Three new integer element attributes will be created as part of the
* book keeping for the octree mesh data structure.
*
* When elements are refined
* the original element (parent) is not removed when eight child elements
* are created. For example, if you have a single hex and refine it, you
* will then have 9 elements, 1 itetlev=N element and 8 children of the
* original perent element refined to itetlev = N+1.
*
* itetlev = level of refinement
* = 0 not refined
* = 1 refined once
* = 2 refined twice
* etc.
*
* itetpar = pointer to parent element
* Each refined element contains an integer pointer to the
* element number of the element that was refined to create it.
*
* itetkid = pointer to first of 8 child (kid) elements created by refinement
* of parent element.
*
*========================================================================
*
define / CMO_OBJ / cmo_2
define / LEVEL / 2
define / LOOP_MAX / 3
define / ATT_NAME_E / in_obj
*
* Refine to octree itetlev= 2 elements that are intersected by cmo_2
*
loop / do / LOOP_VAR 1 LOOP_MAX 1 / loop_end infile refine_object.mlgi
intersect_elements / CMO_HEX / CMO_OBJ / in_obj
cmo/setatt//ipolydat/no
dump / gmv / hex_l3_obj1.gmv / CMO_HEX
*
* Refine to octree itetlev= 3 elements that are intersected by cmo_3
*
define / CMO_OBJ / cmo_3
define / LEVEL / 3
define / LOOP_MAX / 4
*
loop / do / LOOP_VAR 1 LOOP_MAX 1 / loop_end infile refine_object.mlgi
cmo / setatt / CMO_HEX / in_obj / 1 0 0 / 0
intersect_elements / CMO_HEX / cmo_2 / in_obj
intersect_elements / CMO_HEX / cmo_3 / in_obj
dump / gmv / hex_l3_obj2.gmv / CMO_HEX
*
* Now convert the hex mesh from an octree data structrue to
* a hex mesh without overlapping elements.
*
* In effect this removes all parent elements. After this step, one
* cannot continue to treat this as an octree mesh within LaGriT however,
* graphics packages (other than GMV) will allow you to view the mesh
* without the appearance of overlapping elements.
*
cmo / status / brief
infile amr2lagrit_10.mlgi
cmo / status / brief
*
dump / gmv / hex_l3_no_octree.gmv / CMO_HEX

dump / gmv / hex_l3_no_octree.gmv / CMO_HEX LaGriT: Hex Octree Refine


*
*========================================================================
*
* Now create a tet mesh using the points to create the tets and the
* surfaces to define geometry.
*
cmo / create / cmo_tet1 / / / tet
copypts / cmo_tet1 / CMO_HEX
cmo / select / cmo_tet1
*
geometry/create/ cmo_tet1 / geom_sheets
cmo/geometry/ cmo_tet1 / geom_sheets
infile geometry.mlgi
*
setpts
*
* Connect to create a tet mesh but do not add any points to resolve
* material interfaces.
*
connect / noadd
cmo/setatt//ipolydat/no
dump / gmv / tets_noadd.gmv / cmo_tet1

dump / gmv / tets_noadd.gmv / cmo_tet1 LaGriT: connect / noadd

cmo status

*========================================================================

cmo / create / cmo_tet2 / / / tet
copypts / cmo_tet2 / CMO_HEX
cmo / select / cmo_tet2
*
cmo/geometry/ cmo_tet2 / geom_sheets
cmo/constraint/cmo_tet2/cmo_tet1
*
setpts
*
* Connect to create a tet mesh. Add points to resolve material interfaces.
*
connect
settets
cmo/setatt//ipolydat/no
dump / gmv / tets_add.gmv / cmo_tet2

dump / gmv / tets_add.gmv / cmo_tet2 LaGriT: tets refine interface


*****************************************
*
finish

 

Image Gallery:

Click on image to enlarge.

geometry_01
LaGriT Finite Element Mesh
geometry_02
LaGriT Finite Element Mesh
hex_octree_01
LaGriT Finite Element Mesh
hex_octree_02
LaGriT Finite Element Mesh
hex_octree_03
LaGriT Finite Element Mesh
hex_octree_04
LaGriT Finite Element Mesh
tets_add_01
LaGriT Finite Element Mesh
tets_add_02
LaGriT Finite Element Mesh
tets_add_03
LaGriT Finite Element Mesh
tets_add_04
LaGriT Finite Element Mesh
tets_noadd_01
LaGriT Finite Element Mesh
tets_noadd_02
LaGriT Finite Element Mesh