Grid Project:   Barrow Ice Wedge Polygon

Method Overview

-rw-r--r-- 1 tam sftus  9766208 Apr 30 15:26 proto_full_poly.gmv
-rw-r--r-- 1 tam sftus 20472393 Apr 30 15:26 proto_full_poly.inp
lagrit < write_exo.lgi
     uses output_faceset.mlgi

READ THE COLORED MESH (itetclr)

read/proto_full_poly.gmv/mo_hex                                                 
  ATTRIBUTE NAME       MIN               MAX         DIFFERENCE    LENGTH  
   imt1                      1                5               4     51344  
   itetclr                   1               30              29     94080  
   layertyp   -2.000000000E+00  2.000000000E+00 4.000000000E+00     51344  
   elemclr     3.000000000E+01  3.100000000E+01 1.000000000E+00     51344  
   itetclr_    1.000000000E+00  5.000000000E+00 4.000000000E+00     94080  
   ikey_utr    1.000000000E+00  9.408000000E+04 9.407900000E+04     94080  

IDENTIFY FACESETS for top (and other 5 directions)

## IMPORTANT ###################
The cells MUST be pre-sorted by itetclr material values
Exodus will reorder elements internally, we do not want the
cells to be re-ordered. If they are, faceset correlation to
the cell numbers will no longer be correct.
Check that facesets are correct by reading the exo file into GMV
and selecting Surfaces under Display.
In dump exodus (internal to lagrit):
dump/exo/prism_one.exo/moprism
ExodusII: Start writing to file: prism_one.exo using cmo: moprism
cmo/set_id/moprism/element/e_num_temp
cmo/addatt/moprism e_num_temp/VINT/scalar/nelements/linear/permanent//0
sort/moprism/index/ascending/ikey_utr/itetclr/e_num_temp
cmo/addatt/moprism/ikey_utr/vint/scalar/nelements///gax/0
 SORT: order key written to attribute: ikey_utr

#--------- BEFORE EXTRACT --------------------------------------
# sort based on itetclr values and cell location
# secondary sort conventions are up to user
# xmed, ymed, zmed will arrange into columns (after itetclr sort)

createpts / median
sort / mohex / index / ascending / ikey / itetclr xmed ymed zmed
reorder / mohex / ikey
  dump / gmv / out_tmp_sort1.gmv / mohex
  cmo / DELATT / mohex / ikey

# sort nodes based on mesh convention z, y, then x
sort / mohex / index / ascending / ikey / zic yic xic
reorder / mohex / ikey
#----------------------------------------------------------------


# Extract the outside surface of the 3D mesh                                             
  For a prism mesh, the extracted surface will have quads on the sides
  and triangles on the top and bottom. 
  The extracted surface will have the element id and element face number
  that were extracted from the 3D mesh elements
  idelem1 and idface1 are written to faceset files
  with each file grouped into seperate faceset files

extract / surfmesh / 1 0 0 / mo_surf / mo_pri / external
cmo / printatt / mo_surf / -all- / minmax

## Set surface elements to direction they face based on normals
#  These values will be written to itetclr, copy to id_side attribute
#  1 = bottom 
#  2 = top
#  3 = east right
#  4 = north back
#  5 = west left
#  6 = south front

settets / normal
cmo / copyatt / mo_surf mo_surf / id_side itetclr
File for viewing facsets as defined with values in id_side:
-rw-r--r-- 1 tam sftus  4620300 May  1 14:47 surf_sides.gmv

Set Up Faceset File

## For each of the 6 values write the faceset file.
   Use infile output_faceset.mlgi
   Which removes all elements not equal to SS_ID value
   Removes all attributes except idelem1 and idface1 
   Write AVS format for element attribute only

Files with each of 6 facesets written in AVS attribute format:
-rw-r--r-- 1 tam sftus 69095 May  1 14:47 fs_1_bot.faceset
-rw-r--r-- 1 tam sftus 75367 May  1 14:47 fs_2_top.faceset
-rw-r--r-- 1 tam sftus 12583 May  1 14:47 fs_3_rig.faceset
-rw-r--r-- 1 tam sftus  6343 May  1 14:47 fs_4_bac.faceset
-rw-r--r-- 1 tam sftus  3223 May  1 14:47 fs_5_lef.faceset
-rw-r--r-- 1 tam sftus  6343 May  1 14:47 fs_6_fro.faceset

Final Files

## After faceset files have been written, write the final files
   that have the mesh materials and the facesets
   Note the file order will detirmine integer value of set in exo
   so have set 1 first, set 2 second, ...
dump / exo / mesh_fsets.exo / mo_pri / / / facesets &
  fs_1_bot.faceset fs_2_top.faceset fs_3_rig.faceset &
  fs_4_bac.faceset fs_5_lef.faceset fs_6_fro.faceset

dump / avs2 / mesh_fsets.inp / mo_pri
dump / gmv /  mesh_fsets.gmv / mo_pri

File Conversion

## Convert binary mesh_fsets.exo with ncdump command:
ncdump_lin64 mesh_fsets.exo > mesh_fsets_ascii.exo

Single Material Mesh

## Provide single material mesh for user
   Set all materials to 1 and write all files again
cmo setatt mo_pri itetclr 1
cmo setatt mo_pri imt 1
resetpts itp
-rw-r--r-- 1 tam sftus  4364616 May  1 14:47 mesh_fsets.exo
-rw-r--r-- 1 tam sftus  7306299 May  1 15:09 mesh_fsets_ascii.exo
-rw-r--r-- 1 tam sftus 15663881 May  1 14:47 mesh_fsets.inp
-rw-r--r-- 1 tam sftus  9766208 May  1 14:47 mesh_fsets.gmv

-rw-r--r-- 1 tam sftus  4362972 May  1 14:47 mesh_fsets_1mat.exo
-rw-r--r-- 1 tam sftus  7304708 May  1 15:09 mesh_fsets_1mat_ascii.exo
-rw-r--r-- 1 tam sftus 15612537 May  1 14:47 mesh_fsets_1mat.inp
-rw-r--r-- 1 tam sftus  7242792 May  1 14:47 mesh_fsets_1mat.gmv

## Save LaGriT run log and output files 
-rw-r--r-- 1 tam sftus    73949 May  1 15:09 write_exo.out
-rw-r--r-- 1 tam sftus    12474 May  1 15:09 write_exo.log

Final Checks

## CHECK that top and bottom sets each have same number elements in set
   Look at outx3dgen lagrit output and exo file mesh_fsets_ascii.exo

LaGriT output:
define/FILENAME/fs_1_bot.faceset                                                
define/SS_ID/1                                                                  
 THE ELTSET e_keep                           HAS       6272 ELEMENTS            

define/FILENAME/fs_2_top.faceset                                                
define/SS_ID/2                                                                  
 THE ELTSET e_keep                           HAS       6272 ELEMENTS            
 
file mesh_fsets_ascii.exo:

 num_side_ss1 = 6272 ;
 num_side_ss2 = 6272 ;
## CHECK that top fs_2_top.faceset has same elem id's 
   that are found in the exo file mesh_fsets_ascii.exo
 elem_ss2 = 87809, 87810, 87811, 87812, 87813, 87814, 87815, 87816, 87817, ...
    94078, 94079, 94080 ;
 side_ss2 = 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
    5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ;


head fs_2_top.faceset
         0          0          0          2          0
00002  1  1
idelem1, integer 
idface1, integer 
   87809  2
   87810  2
   87811  2
   87812  2
   87813  2
   87814  2

tail fs_2_top.faceset
   94078  2
   94079  2
   94080  2
#### End Method ####
################# OLD METHOD NOT WORKING #####################################
  This method fails for undulating surface as interpolate has problems
  mapping triangles to original surface so many top and bottom are 
  tagged as outside. Replaced with settets/normal which works on
  both quad and tri so interpolation is not needed.

  We convert quads to create an all triangle version of this surface.
  This needs to be done because LaGrit does not current compute norms on quads.

  extract/surfmesh/1 0 0/mo_surf/mo_hex/external
  grid2grid/quadtotri2/mo_tri/mo_surf

# calculate area normal for each of the triangles (outside faces of mesh)
  use addatt unit_area_normal to create vector attribute anorm
  then convert vector anorm to scalar attributes xnorm,ynorm,znorm
  These normals will be used to find faces of various directions.

  cmo/addatt/mo_tri/unit_area_normal/xyz/anorm

  cmo/addatt/mo_surf/xnorm/vdouble/scalar/nelements
  cmo/addatt/mo_surf/ynorm/vdouble/scalar/nelements
  cmo/addatt/mo_surf/znorm/vdouble/scalar/nelements

# interpolate the nor
mals on to the original tri/quad surface

******** unexpected errors with interpolate/map ********
  interpolate/map/mo_surf/xnorm/1 0 0/mo_tri/xnorm/keepatt
  WARNING: Sink points not inside source grid:             343
  Total sink points marked:             343 with flag:           1.86

  interpolate/map/mo_surf/ynorm/1 0 0/mo_tri/ynorm/keepatt
  WARNING: Sink points not inside source grid:             343
  Total sink points marked:             343 with flag:           1.88

  interpolate/map/mo_surf/znorm/1 0 0/mo_tri/znorm/delatt
  WARNING: Sink points not inside source grid:             343
  Total sink points marked:             343 with flag:           2.00

**********************************************************

# create element sets for each direction and tag with values for each


************ top and bottom should have same number of elements ****
 eltset/etop/znorm/gt/0.1
 THE ELTSET etop                             HAS       6423 ELEMENTS

 eltset/ebot/znorm/lt/-0.1
 THE ELTSET ebot                             HAS       6121 ELEMENTS
###########################################################################
<< Back to home page