initial upload

This commit is contained in:
2025-12-17 11:00:57 +08:00
parent 2bc7b24a71
commit a09a73537f
4614 changed files with 3478433 additions and 2 deletions

View File

@@ -0,0 +1,93 @@
# Add Node attribute voronoi volume
For a tet or tri mesh, an attribute can be added for each node giving the voronoi volume.
This uses the same routine used to calculate voronoi volumes for the FEHM stor file.
The commands for 3D tet and 2D tri are slightly different.
## 2D Voronoi area node attribute
We do not have a voronoi area option for 2D except as represented each of the x y z components for the Voronoi areas formed by the nodes. As long your surface is planar, you will get the values you want.
That is if your surface has normal in z direction, the z component will be your voronoi area.
In this example we create the attributes xvarea, yvarea, zvarea and write a truncated AVS file
which writes only node attributes. The file can be written for all nodes, or just a selected set.
After reading the tri surface into a mesh object named *mo_tri*:
```
# add attribute to save node id as attribute
# this is important if you subset or re-order nodes
cmo/set_id/mo_tri/ node / id_node
# create 3 attributes with voronoi areas
cmo/addatt/mo_tri/ voronoi_varea / xvarea yvarea zvarea
# display the min and max values of attributes
cmo printatt mo_tri -all- minmax
# turn off extra attributes for writing
cmo/modatt/mo_tri/ itp / ioflag / l
cmo/modatt/mo_tri/ isn / ioflag / l
cmo/modatt/mo_tri/ icr / ioflag / l
# write node attributes with avs flag
dump/avs/node_values.dat/ mo_tri 0 0 1 0
# find nodes along well and subset to the well nodes
# we copy nodes to new cmo to remove connectivity
cmo/create/motmp
copypts/motmp/mo_tri
cmo/select/motmp
pset/pwell/attribute imt/1,0,0/ eq 4
pset/pdel/ not pwell
rmpoint/pset,get,pdel
rmpoint compress
dump/avs/node_well_values.dat/ motmp 0 0 1 0
finish
```
The output AVS attribute file will look similar to this with attribute names first,
and the attribute values for rest of file. In this example
the triangle surface is xz, so voronoi areas are in yvarea attribute.
If you have a planar mesh, only one component of the xvarea, yvarea, zvarea will be non-zero. You can turn off all the attributes you dont want so that when you write out the AVS attributes file it will just be a single column of floating point values, or perhaps more useful would be a file with two columns of output where column 1 would be the integer vertex id number and the second column would be the floating point area.
node_well_values.dat
<pre class="lg-output">
0 0 5 0 0
00005 1 1 1 1 1
imt1, integer
id_node, integer
xvarea, real
yvarea, real
zvarea, real
1 4 182 0.000000000000E+00 -0.100000000000E+05 0.000000000000E+00
2 4 210 0.000000000000E+00 -0.100000000000E+05 0.000000000000E+00
3 4 238 0.000000000000E+00 -0.100000000000E+05 0.000000000000E+00
4 4 266 0.000000000000E+00 -0.100000000000E+05 0.000000000000E+00
</pre>
## 3D Voronoi volume node attribute
The following will create a node attribute with the voronoi volume for each tet node.
The mesh object name is *cmotet* and the added attribute name is *vorvol*.
```
quality
cmo/addatt/cmotet/vor_volume/vorvol
cmo/printatt/cmotet/vovol/minmax
# select set of points by imt and sum voronoi volume
cmo setatt cmotet vol_tot 0.
pset/p1/attribute imt/1,0,0/ eq MATNO
math/sum/cmotet/vol_tot/pset,get,p1/cmotet/vorvol
pset/p1/delete
```

View File

@@ -0,0 +1,14 @@
# Convert Between Feet and Meters
This is a short macro that can be used to convert a mesh's node
coordinate space from feet to meters or vice-versa.
```
# Convert feet to meters.
scale / 1 0 0 / relative / xyz / 0.3048 0.3048 0.3048
# Meters to Feet: *(1/.3048) = 3.280839895...
math / divide / -def- / xic / 1 0 0 / -def- / xic / 0.3048
math / divide / -def- / yic / 1 0 0 / -def- / yic / 0.3048
math / divide / -def- / zic / 1 0 0 / -def- / zic / 0.3048
```

View File

@@ -0,0 +1,55 @@
# reset imt values of truncated mesh
Source imt values are the truncated imt values minus the node values that need to be reset.
This example removes materials greater than MAX_MAT.
The removal can leave behind node values that need to be reset.
We do not want to remove the nodes as we want to keep these cells.
Main command file with the truncation calls:
```
# truncate top of mesh, remove materials gt 8
define CMO cmotet
define MAX_MAT 8
eltset/edel/ itetclr / gt MAX_MAT
rmpoint element eltset,get,edel
rmpoint/compress
resetpts/itp
# FIX imt of nodes left behind after removal of cells
infile reset_truncated_nodes_imt.mlgi
```
Macro File reset_truncated_nodes_imt.mlgi:
```
# macro to fix node imt values left over from truncation
# must define CMO when calling this macro
# must define MAX_MAT
# create set of points with good values
# fix using nearest interpolation from good set
cmo/create/cmotmp
copypts/cmotmp/CMO
cmo/select/cmotmp
pset/pbad/attribute imt/1,0,0/gt MAX_MAT
rmpoint/pset,get,pbad
rmpoint/compress
cmo/select/CMO
pset/pfix/attribute imt/1,0,0/gt MAX_MAT
interpolate/voronoi/CMO imt/pset,get,pfix/ cmotmp imt
cmo/delete/cmotmp
cmo/printatt/CMO/imt minmax
finish
```