LaGriT Example: modify quad surfaces to prevent crossing

Create two quad surface that cross and then use math functions to make the second surface z coordinate equal to the first surface z coordinate where the second surface is below the first surface.
In this example the lower blue surface is material 1, upper gold surface is material 2.
Use math and psets to modify Z values of orange surface 2 to be equal to the Z values of blue surface 1 where it crosses below.


Input Surfaces
Surface 1 blue, Surface 2 orange

Surface 2 set equal to Surface 1
where they crossed

LaGriT Input and Output (copied to .txt)


Input command file: lagrit.input.txt

Output results file: lagrit.out.txt

LaGriT Input Commands

*--* LAGriT Example Input file
*--*
*--* Create two quad surfaces that cross 
*--* Use math commands to make the second surface z values equal
*--* to the first surface z coordinate where the second surface
*--* is below the first surface.
*--* Lower surface material 1 
*--* Upper surface material 2 
*--* Truncate surface 2 where it dips below surface 1
*-------------------------------*
*
* Define parameter to be used later.
*
define/NX/200
define/NY/200                                                                   
define/MIN/0.0                                                                  
define/MAX/10.0  
define/MAX/8.0  

*
* Create the quad surfaces
*
cmo/create/cmo_1///quad                                                         
quadxy NX NY/MIN MIN 0./MAX MIN 0./MAX MAX 0./MIN MAX 0.                        
rzbrick/xyz/NX,NY,1/1,0,0/connect                                               

define/NX/200
define/NY/200                                                                   
define/MIN/ 2.                                                                  
define/MAX/ 12.  
define/MAX/ 10.  

cmo/create/cmo_2///quad                                                         
quadxy NX NY/MIN MIN 0./MAX MIN 0./MAX MAX 0./MIN MAX 0.                        
rzbrick/xyz/NX,NY,1/1,0,0/connect                                               
*
* Use the math command to set the z coordinates to:
*
* z(i)=sin(x(i))
*
math/sin/cmo_1/zic/1,0,0/cmo_1/xic 
math/sin/cmo_2/zic/1,0,0/cmo_2/xic 
cmo select cmo_2
trans/1,0,0/ zero

*
* Set the itetclr and imt values of each surface to different values
*
cmo / setatt / cmo_1 / imt     / 1 0 0 / 1
cmo / setatt / cmo_1 / itetclr / 1 0 0 / 1
cmo / setatt / cmo_2 / imt     / 1 0 0 / 2
cmo / setatt / cmo_2 / itetclr / 1 0 0 / 2
*
cmo/printatt/cmo_1/ zic / minmax
cmo/printatt/cmo_2/ zic / minmax
*
* Output surfaces for viewing
*
dump/gmv/quad1.gmv/cmo_1                                                        
dump/gmv/quad2.gmv/cmo_2                                                        
addmesh/merge/cmo_1_2/cmo_1/cmo_2
dump/gmv/quad1_quad2.gmv/cmo_1_2    
*
* Add a node attribute to store the difference between the surfaces.
*
cmo/addatt/cmo_2/diff_1_2/VDOUBLE/scalar/nnodes
*
* Calculate the distance between the surfaces
*
math/sub/cmo_2/diff_1_2/1 0 0/cmo_1/zic/cmo_2/zic                               
cmo/select/cmo_2
*
* Create a point set which is all points with diff_1_2 less than zero.
*
pset/p_pos/attribute/diff_1_2/1 0 0/0.0/lt                                      
cmo/setatt/cmo_2/diff_1_2/pset get p_pos/0.0  
*
* Add the difference between the surfaces to the second surface.
*
math/add/cmo_2/zic/1 0 0/cmo_2/zic/cmo_2/diff_1_2   
*
*
* Output surfaces for viewing
*
cmo/printatt/cmo_1/ zic / minmax
cmo/printatt/cmo_2/ zic / minmax
*
addmesh/merge/cmo_1_2_s/cmo_1/cmo_2
dump/gmv/quad1_quad2_s.gmv/cmo_1_2_s                                            

finish