6. Truncate with Polyline

### 6.1 Create boundary surface We now have a mesh with complex stratigraphy encoded in its material ID. However, the domain of this mesh is a rather boring cuboid and doesn't accurately reflect the geospatial domain that we are trying to model. By importing a polyline, the exterior boundary of the mesh can be truncated. As in previous steps, we will use a mesh to define a `region` that will be used for element-wise operations. However, the boundary is a line object. In order to use it as a surface/region, it must be a surface. A polyline can be turned into a vertical surface by 'extruding' it in the vertical (0,0,1) direction: ``` read / avs / basin_bnd_ply_rescale.inp / mo_bndry extrude / mo_fence / mo_bndry / const / 3200. / volume / 0. 0. -1. ``` We will also translate the extrusion so that it covers the vertical extent of the hex mesh: ``` trans / 1 0 0 / 0. 0. -3200. / 0. 0. 0. ```
### 6.2 Truncate mesh Next, we use the boundary to truncate (remove) cells outside the boundary. There are three ways to define 'outside': 1. Only remove a cell if ALL vertices are outside 2. Remove a cell if the centroid (average of all vertices) is outside 3. Remove a cell if one or more vertices are outside ``` cmo / select / MONAME surface / s_bndry / reflect / sheet / mo_fence cmo / select / MONAME region / r_bndry / ge s_bndry pset / p_bndry / region r_bndry ``` **Method 1:** eltset / e_delete1 / exclusive / pset get p_bndry **Method 2:** eltset / e_delete2 / region r_bndry **Method 3:** eltset / e_delete3 / inclusive / pset get p_bndry Next, add the integer cell attribute `id_in_out_bndry`: cmo / addatt / MONAME / id_in_out_bndry / vint / scalar / nelements and 'color' it based on the three element sets created above: ``` cmo / setatt / MONAME / id_in_out_bndry / 1 0 0 / 4 cmo / setatt / MONAME / id_in_out_bndry / eltset get e_delete3 / 3 cmo / setatt / MONAME / id_in_out_bndry / eltset get e_delete2 / 2 cmo / setatt / MONAME / id_in_out_bndry / eltset get e_delete1 / 1 ``` All elements colored 4 (the default value for `id_in_out_bndry`) are elements who evaluate false for all of the above `eltsets`. Create an element set for all `id_in_out_bndry(cell_i) == 4`: ``` eltset / e_delete4 / id_in_out_bndry / eq / 4 eltset / e_delete3 / id_in_out_bndry / eq / 3 eltset / e_delete2 / id_in_out_bndry / eq / 2 eltset / e_delete1 / id_in_out_bndry / eq / 1 ``` Finally, remove all elements 'colored' by method 3 and all elements *not* colored by any of methods 1, 2, or 3: ``` rmpoint / element / eltset get e_delete4 rmpoint / element / eltset get e_delete3 rmpoint / compress resetpts / itp ```