Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/lanl/LaGriT
Browse files Browse the repository at this point in the history
  • Loading branch information
ehinrichs committed Jan 16, 2025
2 parents 9d6535a + fde510b commit bce78dd
Show file tree
Hide file tree
Showing 8 changed files with 307 additions and 68 deletions.
82 changes: 30 additions & 52 deletions docs/pages/docs/demos/description_poi_circle.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,19 @@ The objective is to use the command **createpts/poisson_disk** on a circle polyg
- variable resolution mesh with target edge length defined in user_resolution_2.mlgi


### LaGriT command file: [lagrit_input_poi_circle.lgi.txt](input/lagrit_input_poi_circle.lgi.txt)
The following LaGriT command files are used (.txt appended to names so browser can display):

### LaGriT macro called by command file: [user_resolution_1.mlgi](input/user_resolution_1.mlgi)
### LaGriT macro called by command file: [user_resolution_2.mlgi](input/user_resolution_2.mlgi)
- LaGriT main command file: [lagrit_input_poi_circle.lgi.txt](input/lagrit_input_poi_circle.lgi.txt)
- LaGriT macro called by main: [user_resolution_1.mlgi](input/user_resolution_1.mlgi.txt)
- LaGriT macro called by main: [user_resolution_2.mlgi](input/user_resolution_2.mlgi.txt)

### LaGriT output report: [lagrit_output_poi_circle.out.txt](output/lagrit_output_poi_circle.out.txt)
- LaGriT output report for this demo: [lagrit_output_poi_circle.out.txt](input/lagrit_output_poi_circle.out.txt)


Create the Input Polygon

<a href="input/poi_circle_poly.png" > <img width="250" src="input/poi_circle_poly.png"> </a>


Create poisson disk point distribution and connect into triangles using h = 0.1
<a href="output/poi_output02_tri_h0.1_lines.png" > <img width="250" src="output/poi_output02_tri_h0.1_emin.png"> </a>

Create poisson disk point distribution and connect into triangles using h = 0.05
<a href="output/poi_output03_tri_h0.05_lines.png" > <img width="250" src="output/poi_output03_tri_h0.05_emin.png"> </a>



## Steps for this Example:
*Click on images for full size views.*

### Step 1. Create Input Polygon
Build a unit circle polygon with number of points (NP) = 17. One node will be removed because vertices are distributed from 0-360 degrees so last overlaps first. The command 'filter' removes the duplicate vertex.

Build a unit circle polygon
NP=17 because vertices are distributed from 0-360 degrees
and then 'filter' removes the duplicate vertex

```
define / NP / 17
Expand All @@ -46,42 +31,38 @@ filter / 1 0 0
rmpoint / compress
dump / avs / tmp_polygon_circle_16.poly / mo_pts / 1 0 0 0
```
<a href="input/poi_circle_poly.png" > <img width="250" src="input/poi_circle_poly.png"> </a>

### Step 2a. Compute Poisson Disk vertex distribution with target spacing of 0.1
connect the vertices
add min edge length attribute
### Step 2. Compute Poisson Disk vertex distribution with target spacing of 0.1
Connect the vertices into triangles and add the min edge length attribute "emin".

```
# Compute Poisson Disk vertex distribution with target spacing of 0.1
# Connect the vertices as a Delaunay triangulation
#
define / H_SCALE / 0.1
createpts / poisson_disk / 2d_polygon / mo_poisson_disk / mo_polygon &
/ H_SCALE / connect
quality / edge_min / y
dump / avs / output02_triangle_h_0.1.inp / mo_poisson_disk
```
<a href="output/poi_output02_tri_h0.1_lines.png" > <img width="250" src="output/poi_output02_tri_h0.1_lines.png"> </a> <a href="output/poi_output02_tri_h0.1_emin.png" > <img width="250" src="output/poi_output02_tri_h0.1_emin.png"> </a>

### Step 2b. Compute Poisson Disk vertex distribution with target spacing of 0.05
connect the vertices
add min edge length attribute
### Step 3. Compute Poisson Disk vertex distribution with target spacing of 0.05
Connect the vertices into triangles and add the min edge length attribute "emin".

```
# Decrease the resolution to a target spacing of 0.05
#
define / H_SCALE / 0.05
createpts / poisson_disk / 2d_polygon / mo_poisson_disk / mo_polygon &
/ H_SCALE / connect
quality / edge_min / y
dump / avs / output03_triangle_h_0.05.inp / mo_poisson_disk
```
<a href="output/poi_output03_tri_h0.05_lines.png" > <img width="250" src="output/poi_output03_tri_h0.05_lines.png"> </a> <a href="output/poi_output03_tri_h0.05_emin.png" > <img width="250" src="output/poi_output03_tri_h0.05_emin.png"> </a>

### Step 4. Create a variable resolution mesh based on points
- Resolution is defined in user functions in [user_resolution_1.mlgi](input/user_resolution_1.mlgi.txt)
- Decrease the resolution to a target spacing of 0.01
- The two user defined variables H_SCALE, 10H_SCALE, are used in user_resolution_1.mlgi
- Use the macro file to create points and use the distance from the points for resolution field h(x,y)

### Step 3. Create a variable resolution mesh
# Resolution is defined in user functions defined in user_resolution_1.mlgi
#
# Decrease the resolution to a target spacing of 0.01
#
# The two user defined variables H_SCALE, 10H_SCALE, are used in user_resolution_1.mlgi
#
```
define / H_SCALE / 0.01
define / 10H_SCALE / 0.1
Expand All @@ -92,33 +73,30 @@ dump / avs / output04_triangle_variable_1.inp / mo_poisson_disk
```
<a href="output/poi_output04_tri_var1_lines.png" > <img width="250" src="output/poi_output04_tri_var1_lines.png"> </a>

### Step 4. ######################################
# Create a variable resolution mesh
# Resolution is defined in user functions defined in user_resolution_1.mlgi
#
# Decrease the resolution to a target spacing of 0.01
#
# The two user defined variables H_SCALE, 10H_SCALE, are used in user_resolution_2.mlgi
#
### Step 5. Create a variable resolution mesh based on sin() wave
- Resolution is defined in user functions in [user_resolution_2.mlgi](input/user_resolution_2.mlgi.txt)
- The two user defined variables H_SCALE, 10H_SCALE, are used in user_resolution_2.mlgi
- Use the macro file to create points and use the distance from the points for resolution field h(x,y)

```
define / H_SCALE / 0.01
define / 10H_SCALE / 0.1
createpts / poisson_disk / 2d_polygon / mo_poisson_disk / mo_polygon &
/ H_SCALE / connect / user_resolution_2.mlgi
quality / edge_min / y
dump / avs / output05_triangle_variable_2.inp / mo_poisson_disk
cmo / delete / mo_poisson_disk
```
<a href="output/poi_output05_tri_var2_lines.png" > <img width="250" src="output/poi_output05_tri_var2_lines.png"> </a>

<a href="output/poi_output04_tri_var2_lines.png" > <img width="250" src="output/poi_output04_tri_var2_lines.png"> </a>

### LaGriT Output Report for Mesh Quality

Reading the "lagrit.out" and screen output, the min edge results can be viewed.
Shown below is the quality report of min edge lengths for user_resolution_2.mlgi used in Step 5.

<pre class="lg-output">

quality/edge_min/y
cmo/addatt//edgemin/VDOUBLE/scalar/nelements
finish

epsilonl, epsilonaspect: 6.2803698E-13 2.4771691E-37
--------------------------------------------
Expand Down
13 changes: 5 additions & 8 deletions docs/pages/docs/demos/input/user_resolution_1.mlgi
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ define / H_ATTRIBUTE / h_field_att

# Y = Ax + B
#
# Slope
# 0.1 works
# 0.2 works
# 0.25 works
# 0.29 works
# 0.295 crashes
# 0.299 crashes
# 0.3 crashes
# Slope values to try
# 0.1
# 0.2
# 0.25
# 0.29
#
define / SLOPE / 0.29
# Intersect
Expand Down
45 changes: 45 additions & 0 deletions docs/pages/docs/demos/input/user_resolution_1.mlgi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
define / MO_H_FIELD / mo_poi_h_field
define / H_ATTRIBUTE / h_field_att

# Y = Ax + B
#
# Slope values to try
# 0.1
# 0.2
# 0.25
# 0.29
#
define / SLOPE / 0.29
# Intersect
define / INTERCEPT / 0.0
#
# Create some points and then use the distance from the points to define the user
# defined resolution field h(x,y)
#
cmo / create / mo_pts / / / tet
createpts/xyz/ 1,1,1 /0.1 0.1 0.0/0.1 0.1 0.0/1,1,1/
createpts/xyz/ 1,1,1 /-0.5 -0.7 0.0/-0.5 -0.7 0.0/1,1,1/

compute / distance_field / MO_H_FIELD / mo_pts / dfield

math/multiply/MO_H_FIELD/H_ATTRIBUTE/1,0,0/MO_H_FIELD/dfield/SLOPE/
math/add/MO_H_FIELD/H_ATTRIBUTE/1,0,0/MO_H_FIELD/H_ATTRIBUTE/INTERCEPT/

math / floor / MO_H_FIELD / H_ATTRIBUTE / 1 0 0 / &
MO_H_FIELD / H_ATTRIBUTE / H_SCALE
math / ceiling / MO_H_FIELD / H_ATTRIBUTE / 1 0 0 / &
MO_H_FIELD / H_ATTRIBUTE / 10H_SCALE

cmo / printatt / MO_H_FIELD / H_ATTRIBUTE / minmax
#
# In order to visualize the h(x,y) field, the user can output
# mo_poi_h_field and look at the attribute h_field_att.
# Output will slow things down so output should be commented out
# in production runs.
#
# This is the only place where the user has access to out MO_H_FIELD because it
# will be deleted when createpts / poisson_disk exits.
#
dump / avs / output_h_of_x_y_1.inp / MO_H_FIELD
cmo / delete / mo_pts
finish
6 changes: 2 additions & 4 deletions docs/pages/docs/demos/input/user_resolution_2.mlgi
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ define / H_ATTRIBUTE / h_field_att

# Y = Ax + B
#
# Slope
# Slope values to try
# 0.2 works
# 0.25 works
# 0.29 works
# 0.295 crashes
# 0.299 crashes
# 0.3 crashes
#
define / SLOPE / 0.1
# Intersect
Expand All @@ -18,6 +15,7 @@ define / INTERCEPT / 0.0
# Create some points and then use the distance from the points to define the user
# defined resolution field h(x,y)
#
# use the sin() function to create a set of points in a wave line
cmo / create / mo_pts / / / tet
createpts / line / npoints / / / xmin,ymin,zmin / xmax,ymax,zmax / iiz,ijz,ikz /
createpts / line / 400 / / / -3.95 0.0 0.0 / 3.95 0.0 0.0 / 1 1 1
Expand Down
49 changes: 49 additions & 0 deletions docs/pages/docs/demos/input/user_resolution_2.mlgi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
define / MO_H_FIELD / mo_poi_h_field
define / H_ATTRIBUTE / h_field_att

# Y = Ax + B
#
# Slope values to try
# 0.2 works
# 0.25 works
# 0.29 works
#
define / SLOPE / 0.1
# Intersect
define / INTERCEPT / 0.0
#
# Create some points and then use the distance from the points to define the user
# defined resolution field h(x,y)
#
# use the sin() function to create a set of points in a wave line
cmo / create / mo_pts / / / tet
createpts / line / npoints / / / xmin,ymin,zmin / xmax,ymax,zmax / iiz,ijz,ikz /
createpts / line / 400 / / / -3.95 0.0 0.0 / 3.95 0.0 0.0 / 1 1 1
math / sin / mo_pts / yic / 1 0 0 / mo_pts / xic
math / multiply / mo_pts / yic / 1 0 0 / mo_pts / yic / 0.25
math / multiply / mo_pts / xic / 1 0 0 / mo_pts / xic / 0.25

compute / distance_field / MO_H_FIELD / mo_pts / dfield

math/multiply/MO_H_FIELD/H_ATTRIBUTE/1,0,0/MO_H_FIELD/dfield/SLOPE/
math/add/MO_H_FIELD/H_ATTRIBUTE/1,0,0/MO_H_FIELD/H_ATTRIBUTE/INTERCEPT/

math / floor / MO_H_FIELD / H_ATTRIBUTE / 1 0 0 / &
MO_H_FIELD / H_ATTRIBUTE / H_SCALE
math / ceiling / MO_H_FIELD / H_ATTRIBUTE / 1 0 0 / &
MO_H_FIELD / H_ATTRIBUTE / 10H_SCALE

cmo / printatt / MO_H_FIELD / H_ATTRIBUTE / minmax
#
# In order to visualize the h(x,y) field, the user can output
# mo_poi_h_field and look at the attribute h_field_att.
# Output will slow things down so output should be commented out
# in production runs.
#
#
# This is the only place where the user has access to out MO_H_FIELD because it
# will be deleted when createpts / poisson_disk exits.
#
dump / avs / output_h_of_x_y_2.inp / MO_H_FIELD
cmo / delete / mo_pts
finish
20 changes: 16 additions & 4 deletions docs/pages/tutorial/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,19 @@ Select All, or by one of the categories:
<div class="uk-card-media-top">
<img style="max-height:200px;" src="https://meshing.lanl.gov/proj/examples/stack_fs_from_bndry/mesh_mat_fs5_and_fs8.png" alt="">
</div>
<p>Stack surfaces for Exodus mesh<br> with Boundary and Outlet facesets <br>Advanced</p>
<p>Stack surfaces for Exodus Mesh<br> with Boundary facesets <br>Advanced</p>
</div>
</a>
</div>
</li>
<li data-color="demo">
<div>
<a href="{{ "/pages/docs/demos/description_poi_circle.html" | relative_url }}">
<div class="uk-card uk-card-default uk-card-body uk-card-hover">
<div class="uk-card-media-top">
<img style="max-height:200px;" src="/LaGriT/pages/docs/demos/output/poi_output04_tri_var1_lines.png" alt="">
</div>
<p>Createpts poisson_disk <br> from Circle polygon <br>Advanced</p>
</div>
</a>
</div>
Expand All @@ -181,7 +193,7 @@ Select All, or by one of the categories:
<div class="uk-card-media-top">
<img style="max-height:200px;" src="/LaGriT/pages/docs/demos/output/cyl_stack_hex.png" alt="">
</div>
<p>Create Quad Surface from Hex Sphere <br> Stack surfaces into Hex Cylinder <br>Moderate</p>
<p>2D Surface from Hex Sphere <br> Stack into Hex Cylinder <br>Advanced</p>
</div>
</a>
</div>
Expand All @@ -194,7 +206,7 @@ Select All, or by one of the categories:
<div class="uk-card-media-top">
<img style="max-height:200px;" src="https://lanl.github.io/LaGriT/assets/images/Image229.gif" alt="">
</div>
<p>Tutorial: Tet Mesh using Regions and Ray Shooting<br>Deprecrated</p>
<p>Tutorial: Mesh from Regions and Ray Shooting<br>Deprecrated</p>
</div>
</a>
</div>
Expand All @@ -206,7 +218,7 @@ Select All, or by one of the categories:
<div class="uk-card-media-top">
<img style="max-height:200px;" src="stratigraphy/images/21_tet_01_exo_blocks.png" alt="">
</div>
<p>Tutorial: Octree refined Mesh with <br> Well and Stratigraphic Surfaces <br>Advanced</p>
<p>Tutorial: Octree Mesh with <br> Well and Stratigraphic Surfaces <br>Advanced</p>
</div>
</a>
</div>
Expand Down
55 changes: 55 additions & 0 deletions docs/pages/tutorial/lagrit_introduction/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

Download this Tutorial

# Tutorial LaGriT Introduction

LaGriT consists of mesh **commands** and options that are used to create, modify, optimize, and write files. LaGriT can be run on the command line interactively so commands are entered on at a time at the prompt, or with one or more files containing the LaGriT commands. By convention we use ".lgi" for lagrit input file names and ".mlgi" for macro files called from main command file.

Run lagrit from the command line interactively, or put commands in a file and redirect.
```
lagrit
```
or
```
lagrit < input.lgi
```
**Important Note:** the **`finish`** command must be used to exit interactive session and must be at end of command file.



## Common terms and definitions

### General

Mesh = Grid = elements defining geometric shapes allowing numerical computations for simulations
Node = Vertice = point = mesh object nodes that can be used to connect into elements.
Element = cell = nodes are connected into element types such as line, triangle, or tetrahedral (see page)
structured mesh = elements are arranged in a regular pattern with parallel sides and and orthogonal elements.
unstructured mesh = elements arranged to fit complex geometries
Delaunay = tri or tet elements arranged such that mesh is optimized for compuational accuracy
Voronoi = the vertices of the voronoi volumes correspond to the circumcenters of the Delaunay tri and tets
control volume (CV) method = ensures conservation of mass and energy in fluid flow and heat transfer equations

### LaGriT

Current Mesh Object = cmo = the mesh object that actions will act on by default.
imt = default name for node array with positive integer values indicating color or material
itetclr = default name for element array with positive integer values indicating color or material
itp = boundary tags
geometry = created with **`surface`** and **`region`** commands and is used to set mesh materials


## Step 1. Create a Mesh Object

## Step 2. Check and View the Mesh

## Step 3. Assign materials

## Step 4. Set boundary nodes

## Step 5. Check and View the Mesh

## Step 6. Write Mesh and FEHM Setup Files

## Step 7. Create a zone list for FEHM

Loading

0 comments on commit bce78dd

Please sign in to comment.