This module contains classes and methods for the manipulation of FEHM grid files. Typically, usage will be limited to reading and writing of grid files, and the use of the spatial and connectivity information provided.
PyFEHM can parse unstructured or structured grids in FEHM format. PyFEHM can construct orthogonal grids of arbitrary complexity using the
fmake
class or by calling fgrid.make()
.
For the purposes of this manual, the variable geo
will be assumed
to refer to a previously defined instance of the fgrid
class.
The smallest quantum of the finite element grid. Node objects and associated
connectivity information are automatically created when a grid file is parsed (fgrid.read()
).
In FEHM, a node is associated with a position in space and a control volume - the region of space uniquely associated with the node. It is connected to other nodes, forming elements and the finite element grid.
When a grid is loaded and associated with an FEHM input file, material properties and zone information are
mapped back onto the nodes. For example, if the ROCK macro has been assigned in an input file, then
density information for a given node is accessed through its density attribute, fnode.density
.
fnode.
index
¶(int) Integer number denoting the node.
fnode.
position
¶(lst[fl64]) List of the node’s coordinates in 2- or 3-D space.
fnode.
vol
¶(fl64) Control volume associated with the node. This information only available if volumes() method called from grid attribute.
fnode.
connected_nodes
¶(lst[fnode]) List of node objects connected to this node. This information only available if full_connectivity=True passed to fgrid.read()
fnode.
connections
¶(lst[fconn]) List of connection objects of which the node is a member.
fnode.
elements
¶(lst[felem]) List of element objects of which the node is a member.
fnode.
permeability
¶(list) permeability values at node.
fnode.
conductivity
¶(list) conductivity values at node.
fnode.
density
¶(fl64) density at node.
fnode.
specific_heat
¶(fl64) specific heat at node.
fnode.
porosity
¶(fl64) porosity at node.
fnode.
youngs_modulus
¶(fl64) Youngs modulus at node.
fnode.
poissons_ratio
¶(fl64) Poissons ratio at node.
fnode.
thermal_expansion
¶(fl64) Coefficient of thermal expansion at node.
fnode.
pressure_coupling
¶(fl64) Biot pressure coupling coefficient at node.
fnode.
rlpmodel
¶(int) index of relative permeability model assigned to node
fnode.
permmodel
¶(int) index of stress-permeability model assigned to node.
fnode.
pormodel
¶(int) index of variable porosity model assigned to node.
fnode.
condmodel
¶(int) index of variable conductivity model assigned to node.
fnode.
Pi
¶(fl64) initial pressure at node.
fnode.
Ti
¶(fl64) initial temperature at node.
fnode.
Si
¶(fl64) initial water saturation at node.
fnode.
S_co2gi
¶(fl64) initial gaseous CO2 saturation at node.
fnode.
S_co2li
¶(fl64) initial liquid CO2 saturation at node.
fnode.
co2aqi
¶(fl64) initial dissolved CO2 concentration at node.
fnode.
strsi
¶(fl64) initial stresses at node.
fnode.
dispi
¶(fl64) initial displacements at node.
fnode.
P
¶(fl64) pressure at node during a simulation.
fnode.
T
¶(fl64) temperature at node.
fnode.
S
¶(fl64) water saturation at node.
fnode.
S_co2g
¶(fl64) gaseous CO2 saturation at node.
fnode.
S_co2l
¶(fl64) liquid CO2 saturation at node.
fnode.
co2aq
¶(fl64) dissolved CO2 concentration at node.
fnode.
strs
¶(list) stresses at node ([xx,yy,xy] for 2D, [xx,yy,zz,xy,yz,xz] for 3D).
fnode.
disp
¶(list) displacements at node ([x,y] for 2D, [x,y,z] for 3D).
The fgrid
object contains all information about the finite element grid.
The grid object corresponds to an FEHM grid file and comprises an assembly of fnode
,
fconn
and felem
objects. This assembly is constructed by reading an
existing FEHM grid files (fgrid.read()
) or by creating an empty fgrid
object and creating
a new mesh using the fgrid.make()
command. Read and write support for FEHM stor files is supported.
fgrid.
node
¶(dict[fnode]) Dictionary of grid nodes, indexed by node integer.
fgrid.
nodelist
¶(lst[fnode]) List of all node objects in the grid.
fgrid.
conn
¶(dict[fconn]) Dictionary of connections, indexed by a two element tuple of the member node integers.
fgrid.
connlist
¶(lst[fconn]) List of all connection objects in the grid.
fgrid.
elem
¶(dict[felem]) Dictionary of elements, indexed by element integer.
fgrid.
elemlist
¶(lst[felem]) List of all element objects in the grid.
fgrid.
xmin
¶Minimum x-coordinate for all nodes.
fgrid.
xmax
¶Maximum x-coordinate for all nodes.
fgrid.
ymin
¶Minimum y-coordinate for all nodes.
fgrid.
ymax
¶Maximum y-coordinate for all nodes.
fgrid.
zmin
¶Minimum z-coordinate for all nodes.
fgrid.
zmax
¶Maximum z-coordinate for all nodes.
fgrid.
dimensions
¶(int) Dimensions of the grid.
fgrid.
number_nodes
¶Number of nodes in grid.
fgrid.
number_elems
¶Number of elements in grid.
fgrid.
read
(gridfilename, full_connectivity=False, octree=False)[source]¶Read data from an FEHM or AVS grid file. If an AVS grid is specified, PyFEHM will write out the corresponding FEHM grid file.
Parameters: |
|
---|
fgrid.
write
(filename=None, format='fehm', compression=True)[source]¶Write grid object to a grid file (FEHM, AVS STOR file formats supported). Stor file support only for orthogonal hexahedral grids.
Parameters: |
|
---|
fgrid.
node_nearest_point
(pos=[])[source]¶Return node object nearest to position in space. Method uses octree structure for speed up if available.
Parameters: | pos (list) – Coordinates, e.g. [2300., -134.8, 0.]. |
---|---|
Returns: | fnode() – node object closest to position. |
fgrid.
plot
(save='', angle=[45, 45], color='k', connections=False, equal_axes=True, xlabel='x / m', ylabel='y / m', zlabel='z / m', title='', font_size='small', cutaway=[])[source]¶Generates and saves a 3-D plot of the grid.
Parameters: |
|
---|
fgrid.
make
(gridfilename, x, y, z, full_connectivity=True, octree=False)[source]¶Generates an orthogonal mesh for input node positions.
The mesh is constructed using the fgrid.
fmake object and an FEHM grid file is written for the mesh.
Parameters: |
|
---|
fgrid.
lagrit_stor
(grid=None, stor=None, exe='c:\\path\\to\\lagrit\\lagrit.exe', overwrite=False)[source]¶Uses LaGriT to create a stor file for the simulation, this will be used in subsequent runs. To create the stor file, LaGriT will convert a mesh comprised of hexahedral elements into one comprising only tetrahedrals. Therefore, a new FEHM grid file will be created and parsed, reflecting the modified element structure.
Parameters: |
|
---|
fgrid.
volumes
(volumefilename)[source]¶Reads a lagrit generated file containing control volume information.
Parameters: | volumefilename (str) – Name of lagrit output file containing control volume information. |
---|
fgrid.
what
¶Print to screen information about the grid.
fgrid
object and read an existing FEHM grid file.fgrid
object and write out the changes to a new FEHM grid file.fgrid.make()
command.lagrit_stor()
method to instruct LaGriT to create a stor file.