This module contains classes and methods for the reading, writing, construction and manipulation of FEHM input files.
An FEHM input file corresponds in PyFEHM to a collection of zones (fzone), macros (fmacro), boundary conditions (fboun), initial conditions (fincon) and other objects. These are all linked together, along with an FEHM grid object (fgrid), to the central fdata structure. Within this framework, zones are linked to macros, nodes are linked to zones and initial conditions, etc. The user is permitted to, say, choose a node and establish which zones and macros it is linked to.
For the purposes of this manual, the variable dat will be assumed to refer to a previously defined fdata object.
Zone object, a tool for defining sets of nodes to which specific properties can be assigned via various macros. (see macro FEHM user manual macro ZONE or ZONN). For the purposes of this manual, the variable zn will be assumed to refer to a previously defined fzone object.
There are several ways to define a zone in FEHM. The default definition (here, assigned fzone.type = 'rect') is that of a box, edges aligned along the coordinate axes, that contains all nodes desired to be in that zone. Alternative definitions include listing those nodes to be included in the zone (type = 'nnum') or the coordinates of those nodes (type = 'list').
Zones are created and associated with an fdata object using fdata.add(). All zones added to the fdata object appear in fdata.zonelist and fdata.zone attributes. Zones in fdata.zone are accessed by either zone index or zone name, e.g., fdata.zone['xmin'] or fdata.zone[12].
FEHM Zone object.
(int) Integer number denoting the zone.
(str) String denoting the zone type. Default is ‘rect’, alternatives are ‘list’, ‘nnum’
(str) Name of the zone. Will appear commented beside the zone definition in the input file. Can be used to index the fdata.zone attribute.
(dict[fnode]) Dictionary of nodes contained within the zone, indexed by node number.
(lst[fnode]) List of nodes contained within the zone.
(str) File name if zone data is or is to be contained in a separate file. If file does not exist, it will be created and written to when the FEHM input file is being written out.
In assigning these attributes, macros corresponding to the zone object will be automatically created. For example, assigning a value to the permeability attribute will create the corresponding permeability macro.
(fl64,*lst*) Permeability properties of zone.
(fl64,*lst*) Conductivity properties of zone.
(fl64) Density of zone.
(fl64) Specific heat of zone.
(fl64) Porosity of zone.
(fl64) Young’s modulus of zone.
(fl64) Poisson’s ratio of zone.
(fl64) Coefficient of thermal expansion of zone.
(fl64) Pressure coupling term of zone.
(fl64) Initial pressure in zone.
(fl64) Initial temperature in zone.
(fl64) Initial saturation in zone.
Create a rectangular zone corresponding to the bounding box delimited by p1 and p2.
Parameters: |
|
---|
Fixes temperatures at nodes within this zone. Temperatures fixed by adding an HFLX macro with high heat flow multiplier.
Parameters: |
|
---|
Fixes pressures at nodes within this zone. Pressures fixed by adding a FLOW macro with high impedance.
Parameters: |
|
---|
Fixes displacement at nodes within this zone. Displacements fixed by adding a STRESSBOUN macro.
Parameters: |
|
---|
Fixes displacement at nodes within this zone. Displacements fixed by adding a STRESSBOUN macro.
Parameters: |
|
---|
Assigns a roller boundary condition to the zone (zero displacement in normal direction).
Parameters: | direction (str, int) – Normal of roller. Specify as string or integer, e.g., 1 = ‘x’, 2 = ‘y’, 3 = ‘z’. Defaults to zone normal for ‘XMIN’, ‘ZMAX’ etc. |
---|
Assigns a free surface boundary condition to the zone (zero stress in normal direction).
Parameters: | direction (str, int) – Normal of free surface. Specify as string or integer, e.g., 1 = ‘x’, 2 = ‘y’, 3 = ‘z’. Defaults to zone normal for ‘XMIN’, ‘ZMAX’ etc. |
---|
Generates and saves a 3-D plot of the zone.
Parameters: |
|
---|
Example:
zn.plot(save='myzone.png', angle = [45,45], xlabel = 'x / m', font_size = 'small', color = 'r')
Returns a contour plot of the top surface of the zone.
Parameters: |
|
---|
Example:
dat.zone[2].topo('zoneDEMtopo.png',method = 'linear')
Print to screen information about the zone.
1. Create a rectangular zone that encompasses all nodes within a horizontal reservoir. Bounding box limits are used as inputs for rect().
2. Create a zone named injectors with index 10 and comprising two previously identified nodes. The zone information will be written out to the auxiliary file zones.macro. The zone is created and added to the dat in a single step.
nd1 = geo.node_nearest_point([100,200,-1500])
nd2 = geo.node_nearest_point([-500,400,-1500])
dat.add(fzone(index=10, type='nnum', name='injectors', nodelist=[nd1.index, nd2], file='zones.macro'))
The macro object, this is how the majority of FEHM’s text inputs are defined.
A macro is a way of telling FEHM to do something specific. It may be as simple as assigning a standard permeability value to every node in the grid. It may be as specific as assigning a stress boundary condition to one edge of the model, a source or sink to one or many nodes, or elastic and rock properties to a particular zone.
The attribute type is set when a new macro is created. Macro names in PyFEHM and FEHM are identical. Thus, to generate a macro object for permeability properties, one supplies the command fmacro('perm').
Macros are applied to a specific spatial domain. This may be the entire model, a previously defined zone, or a set of nodes. This spatial assignment occurs is defined in fmacro.zone.
The macro must be supplied with several pieces of information, informing its operation. E.g., the perm macro requires permeabilities, the rock macro requires density, porosity and specific heat, and the grad macro requires information about an initial gradient in some variable. These properties are set in fmacro.param, a dictionary with keys corresponding to the required pieces of information.
FEHM macro object.
(str) Name of the macro. Macro names are identical to those invoked in FEHM.
(fzone, lst[fzone], tuple[int,int,int], zone key) The zone, zones or nodes to which the macro is assigned. Note, only permmodel and rlp can be assigned lists of zones. Optionally, a key (index or string) may be passed, in which case the zone will be retrieved when the macro is added to the model.
(dict[fl64]) A dictionary of values defining the operation of the macro. See table below for macro-specific dictionary keys.
(str) Macro subtype, required for STRESSBOUN or BODYFORCE macros.
(str) File string where information about the macro is stored. If file does not currently exist, it will be created and written to when the FEHM input file is written.
The table below shows the parameter names available to be set for each macro. Parameters are accessed/set via the param attribute, e.g., to set the density property for a ROCK macro write
Warnings will be printed if a parameter is not set when the FEHM data file is written.
Macro Parameters (Units) FEHM variable Notes pres pressure (MPa) PHRD temperature (degC) TIND saturation IEOSD perm kx (m^2, log10(m^2)) PNXD ky PNYD kz PNZD cond cond_x (W/m/K) THXD cond_y THYD cond_z THZD flow rate (kg/s, MPa) SKD Fixed rate or pressure depending on AIPED. energy (MJ/kg, degC) EFLOW >0 = enthalpy, <0 = temperature. impedance AIPED Determine generator type. rock density (kg/m^3) DENRD specific_heat (J/kg/K) CPRD porosity PSD Set negative to remove node from simulation. grad reference_coord (m) CORDG direction IDRG 1,2,3 = x,y,z variable IGRADF 1,2,3,9 = P,T,S,P_co2 / 4,5,6,10 = fixed boun P,T,S,P_co2 reference_value (unit) VAR0 gradient (unit/m) GRAD1 hflx heat_flow (MW) QFLUX multiplier QFLXM biot thermal_expansion (/K) ALPHA pressure_coupling PP_FAC elastic youngs_modulus (MPa) ELASIC_MOD poissons_ratio POISSON co2frac water_rich_sat FW co2_rich_sat FL Set non-zero at co2 injectors. co2_mass_frac YC init_salt_conc (ppm) CSALT override_flag INICO2FLG co2flow rate (kg/s, MPa) SKTMP energy (MJ/kg, degC) ESKTMP impedance AIPED Similar operation to flow. bc_flag IFLG_FLOWMAC co2diff diffusion DIFF tortuosity TORTCO2 co2pres pressure (MPa) PHICO2 temperature (degC) TCO2 phase ICES stressboun value (m, MPa, MPa/m) BOUNVAL Fixed displacement, force or stress gradient. direction KQ 1,2,3 = x,y,z displacement, -1,-2,-3 = x,y,z force. sdepth (m) SDEPTH Only used for subtype='lithograd'. gdepth (m) GDEPTH Only used for subtype='lithograd'. bodyforce fx (MN, m/s^2) FX Body force in x-direction (acceleration if subtype='acceleration') fy (MN, m/s^2) FY Body force in y-direction. fz (MN, m/s^2) FZ Body force in z-direction.
The model object, this is how the some of FEHM’s text inputs are defined.
Models are similar to macros in function but are more flexible in their definition of physical behaviour. For example, the definition of thermal conductivity through the COND macro is rather narrow; constant values are supplied. However, by invoking the VCON macro, the user can choose between multiple models for thermal conductivity behaviour. The user can specify a model index - say 2, for square root variation of thermal conductivity with liquid saturation - and then pass the necessary parameters for the model.
Additional models exist to define relative permeability in terms of saturation (RLP), porosity in terms of fluid pressure (PPOR), or permeability in terms of stress (PERMMODEL).
Model object, used in a variety of macro definitions.
(str) Name of the macro for this model. Macro names are identical to those invoked in FEHM.
(list) A list of zones to which the model is applied.
(dict[fl64]) A dictionary of values defining the operation of the macro. See table below for macro-specific dictionary keys.
(int) Index of the model to be invoked.
(**)
Currently, models are available for thermal conductivity, permeability, porosity and relative permeability. Information about the various models and their parameters is available through the fdata.help attribute.
dat.help.permmodel()
dat.help.pormodel(-1)
Boundary conditions are applied to zones, and involve fixing some variable according to supplied time-series data. In contrast to other macros, one boundary condition may be applied to multiple zones.
The fboun object is supplied a vector of times, corresponding to values of one or more variables. This defines the time evolution of the variable, with step-changes (fboun.type='ti') or linear interpolation (type='ti_linear') between elements in fboun.times.
The fboun.variable attribute comprises a list of variable vectors. Each variable vector first contains the FEHM boun variable keyword followed by the vector of values corresponding to fboun.times. For example, a fixed temperature sequence would be supplied variable= [['t',100,80,90],] (note the nesting of the lists).
Boundary condition object.
(str) Boundary condition type, ‘ti’ = step changes, ‘ti_linear’ = linear changes.
(lst[fzone]) List of zones to which the boundary condition is to be applied.
(lst[lst[str,fl64,...]]) List of lists of boundary data. Each list begins with a string denoting the boundary condition variable, and is followed by the time-series data, e.g., [‘sw’,0.2,0.5,0.8].
(lst[fl64]) Vector of times.
(int) Length of time-series.
History output object, makes request for history data to be output (see macro HIST).
This data type outputs specified variables (e.g., temperature, permeability) for particular nodes and zones at specified times (one file = one variable). The data can be output in several formats (all of which are readable by PyFEHM) and at specified times.
Output requests for specific nodes and zones is supplied through the NODE and FLXZ macros. PyFEHM writes takes care of these macros within the scope of the fhist object.
FEHM history output object.
(str) File format for contour output: ‘tecplot’, ‘csv’, ‘surfer’
(flt) Time interval to output data.
(int) Time step interval to output data.
(lst[str])List of variables to write contour data for, e.g., [‘temperature’,’pressure’]
(dict[fnode]) Dictionary of nodes, indexed by node number, for which history output requested.
(dict[fzone]) Dictionary of zones, indexed by number and name, for which history output is required.
(lst[fzone,int]) List of zone objects for which zone flux output required.
(list[fnode]) list of node objects for which history output requested.
(lst[fzone]) List of zone objects for which history output required.
Print out eligible variables for output.
Print out information about the attribute.
dat.hist.variables.append(['temperature','pressure','flow'])
dat.hist.timestep_interval=1
dat.hist.nodelist.append([10, 15, 20])
nd = dat.grid.node_nearest_point([200,300,400])
Contour output object, makes request for contour data to be output (see macro CONT).
This data type outputs specified variables (e.g., temperature, permeability) for x,y,z or node locations at fixed times (one file = one time). The data can be output in several formats (all of which are readable by PyFEHM) and at specified times.
(str) File format for contour output: ‘tec’, ‘surf’, ‘avs’, ‘avsx’
(flt) Time interval to output data.
(int) Time step interval to output data.
(lst[str])List of variables to write contour data for, e.g., [‘temperature’,’pressure’]
(bool) Set to True to include in output title.
(lst[fzone]) List of zone objects for which contour data is to be written - NOT FULLY SUPPORTED.
Print out eligible variables for output.
Print out information about the attribute.
dat.cont.timestep_interval=10
dat.cont.time_interval=100
dat.cont.variables.append(['temperature','permeability','displacement','co2'])
The fdata class is the central structure for collating and organising all information about a simulation. Grid information, zone definitions, boundary conditions and other macros are collected here. An fdata object is automatically created and populated when an existing input file is parsed using fdata.read(). Alternatively, an empty fdata object can be created and populated with an fgrid object, some fzone, fmacro and other objects to create a new simulation.
Just as each FEHM input file is associated with a grid file, each PyFEHM fdata object must be associated with an fgrid object. Failure to specify a grid file may lead to problems specifying other macros.
FEHM simulations can be initialised within the PyFEHM environment by writing out the fehmn.files control file and supplying a command line path to an FEHM executable. Information contained in the control file is accessed via the files attribute. The control file is automatically written out when invoking fdata.run().
PyFEHM also allows for simulation restarts from initial condition files dumped by FEHM, referred to here as incon files. An incon file is associated with the incon attribute and read in by fincon.read(). The user is permitted to read in incon files, make changes within PyFEHM, and write out a new incon file for a future simulation.
PyFEHM supports the use of FEHM’s stress and carbon dioxide modules via the strs and carb attributes, respectively.
Class for FEHM data file.
(str) File name for reading and writing FEHM input text file.
(str) File name of FEHM grid file.
(str) File name of FEHM restart file.
(fgrid) Grid object associated with the model.
(fcont) Contour output for the model.
(fhist) History output for the model.
(fincon) Initial conditions (restart file) associated with the model.
(files) Simulation execution object.
(fstrs) Stress module object.
(fcarb) CO2 module object.
(ftrac) Species transport module object.
(lst[fzone]) List of boundary condition objects in the model.
(dict[fzone]) Dictionary of zone objects, indexed by zone number or name.
(lst[fzone]) List of zone objects in the model.
(fhelp) Module for interactive assistance.
An FEHM simulation may contain multiple instances of the same macro, which allows assignment of differing material properties between regions, multiple regions of inflow and outflow via FLOW and BOUN, etc. Each set of macros is collected and made accessible via a list and a dictionary, denoted by fdata.macro_namelist and fdata.macro_name respectively. The list contains macros in which they were added to the fdata object or read from an input file. The dictionary is indexed by the zone number of name associated with each macro.
For example, to loop through all macros of the PERM type, one would use fdata.permlist
To access a specific ROCK macro assigned to zone 20, use the fdata.rock dictionary
To access FLOW generators assigned to the previously defined ‘injection’ zone, use the fdata.flow dictionary
For reference, the available macro lists and dictionaries are given below.
FEHM provides the user with control over a variety of time stepping and solver parameters. In PyFEHM, these parameters are accessible via four dictionaries, which are automatically generated and populated with defaults when a new fdata object is created. A table of parameter names and default values is given with each of the four dictionaries below.
(dict[fl64,int]) Time stepping parameters (see macro TIME).
PyFEHM parameter | FEHM equivalent | Default value |
---|---|---|
initial_timestep_DAY | DAY | 1 (days) |
max_time_TIMS | TIMS | 365 (days) |
max_timestep_NSTEP | NSTEP | 200 |
print_interval_IPRTOUT | IPRTOUT | 1 |
initial_year_YEAR | YEAR | None |
initial_month_MONTH | MONTH | None |
initial_day_INITTIME | INITTIME | None |
(dict[fl64,int]) Control parameters (see macro CTRL).
PyFEHM parameter | FEHM equivalent | Default value |
---|---|---|
max_newton_iterations_MAXIT | MAXIT | 10 |
newton_cycle_tolerance_EPM | EPM | 1e-5 |
number_orthogonalizations_NORTH | NORTH | 8 |
max_solver_iterations_MAXSOLVE | MAXSOLVE | 24 |
acceleration_method_ACCM | ACCM | ‘gmre’ |
JA | JA | 1 |
JB | JB | 0 |
JC | JC | 0 |
order_gauss_elim_NAR | NAR | 2 |
implicitness_factor_AAW | AAW | 1 |
gravity_direction_AGRAV | AGRAV | 3 |
upstream_weighting_UPWGT | UPWGT | 1.0 |
max_multiply_iterations_IAMM | IAMM | 7 |
timestep_multiplier_AIAA | AIAA | 1.5 |
min_timestep_DAYMIN | DAYMIN | 1e-5 (days) |
max_timestep_DAYMAX | DAYMAX | 30 (days) |
geometry_ICNL | ICNL | 0 |
stor_file_LDA | LDA | 0 |
(dict[fl64,int]) Iteration parameters (see macro ITER).
PyFEHM parameter | FEHM equivalent | Default value |
---|---|---|
linear_converge_NRmult_G1 | G1 | 1e-5 |
quadratic_converge_NRmult_G2 | G2 | 1e-5 |
stop_criteria_NRmult_G3 | G3 | 1e-3 |
machine_tolerance_TMCH | TMCH | -1e-5 |
overrelaxation_factor_OVERF | OVERF | 1.1 |
reduced_dof_IRDOF | IRDOF | 0 |
reordering_param_ISLORD | ISLORD | 0 |
IRDOF_param_IBACK | IBACK | 0 |
number_SOR_iterations_ICOUPL | ICOUPL | 0 |
max_machine_time_RNMAX | RNMAX | 3600 |
(dict[fl64,int]) Solution parameters (see macro SOL).
PyFEHM parameter | FEHM equivalent | Default value |
---|---|---|
coupling_NTT | NTT | 1 |
element_integration_INTG | INTG | -1 |
Assigning final simulation time, maximum number of time steps, etc., via the dictionaries in ctrl and time involves cumbersome lookup of parameter names and then assignment. Therefore, some shortcut attributes are made available to bypass this process
(fl64) Initial simulation time (shortcut), defaults to zero.
(fl64) Final simulation time (shortcut).
(fl64) Initial time step size (shortcut).
(fl64) Minimum time step size (shortcut).
(fl64) Maximum time step size (shortcut).
(int) Maximum number of time steps (shortcut).
(fl64) Time step multiplier, acceleration (shortcut).
(lst) List of times at which FEHM should produce output.
For example, writing
dat.tf=365.25*10.
dat.dti=1.
dat.dtn=500
dat.dtmax=365.25
will request the simulation to run for 10 years, with an initial time step of 1 day, a maximum time step of 1 year and to stop if it reaches 500 time steps.
The attribute output_times can be used to request output data at specific times during the simulation. Use of this attribute is incompatible with the change_timestepping method.
(str) Directory in which to store files and run simulation.
(bool) Boolean signalling if simulation output to be printed to screen.
(bool) If True zone definitions will be written to the input file immediately before they are used inside a macro.
(int) Boolean integer calling for no breaking of connections between boundary condition nodes.
(int) Boolean integer calling for generation of finite element coefficients (not recommended, see macro NFINV).
Read FEHM input file and construct fdata object.
Parameters: |
|
---|
Write fdata object to FEHM input file and fehmn.files file.
Parameters: |
|
---|
Run an fehm simulation. This command first writes out the input file, fehmn.files and this incon file if changes have been made. A command line call is then made to the FEHM executable at the specified path (defaults to fehm.exe in the working directory if not specified).
Parameters: |
|
---|
Exports the model object to VTK and loads in paraview.
Parameters: |
|
---|
Call before multi-processing simulations in Windows to ensure fdata is picklable.
Exports the model object to VTK.
Parameters: |
|
---|
Attach a zone, boundary condition or macro object to the data file.
Parameters: |
|
---|
Delete a zone, boundary condition or macro object from the data file.
Parameters: | obj (fzone, fmacro, fmodel, fboun, list) – Object to be deleted from the data file. Can be a list of objects. |
---|
Change timestepping during a simulation. Note, if time stepping arguments are omitted, FEHM will force output to be written at the change time. The default for all optional arguments is no change.
Parameters: |
|
---|
Create and assign a new zone. Material properties are optionally specified, new macros will be created if required.
Parameters: |
|
---|
Assign initial temperature distribution to model based on supplied temperature profile.
Parameters: |
|
---|
Display contents of CTRL macro.
Display contents of ITER macro.
Display contents of TIME macro.
Examples given here are limited to the usage of fdata methods. More in depth explanations of FEHM simulation within the PyFEHM framework is given in the tutorial section of this guide.
dat.run(input='myInput.dat', grid='myGrid.inp', exe='C:\\path\\to\\FEHM\\source', files = ['hist', 'check', 'outp'])
Information written to the fehmn.files control file is collated and modified within this object.
The control file can be written independently using files.write(), but in general should be written automatically when a PyFEHM simulation is run using fdata.run().
Some attributes of files will be written automatically when certain actions are taken within PyFEHM. For example, reading a new grid using fdata.grid.read('myGrid.inp') will cause fdata.files.grid='myGrid.inp'.
Class containing information necessary to write out fehmn.files.
(str) Name of input file. This is set automatically when reading an input file in PyFEHM or when running a simulation.
(str) Name of grid file. This is set automatically when reading an grid file in PyFEHM.
(str) Name of restart file to read in (initial condition). This is set automatically when reading an incon file in PyFEHM.
(str) Default file name string. If not already specified, this is set automatically when running a simulation.
(str) Name of restart file to write out.
(str) Name of output file.
(str) Name of check file.
(str) Name or path to co2 properties file
(str) Name of history file.
(str) Name of store file.
(str) Path to FEHM executable. Default is ‘fehm.exe’.
Initial conditions, or restart, files can be parsed, modified and rewritten in PyFEHM.
Reading of incon files occurs during model initialisation, e.g., fdata('myInput.dat','myGrid.inp', 'myIncon.ini'), or later by invoking fincon.read().
If changes are made to any of the restart variables, care should be taken to rewrite in the incon file using fincon.write() before running a simulation.
Tools are available for user modification of restart files. At present, these include the construction of critically-stressed lithostatic stress gradients using fincon.stressgrad() and fincon.critical_stress().
Initial conditions object. Also called a restart file.
Reading one of these files associates the temperature, pressure, saturation etc. data with grid nodes and sets up fehmn.files to use the file for restarting.
(str) Name of restart file (initial conditions)
(str) Name of input file that generated the restart.
(fl64) Time stamp of initial conditions file (end time of simulation that produced this file).
When an incon file is parsed in PyFEHM, that information is made available through variable list attributes. Changes can be made to these variables and a new incon file written out using the write() method. For obvious reasons, some variables are only available if the relevant modules are being used, e.g., fincon.disp_x returns an empty list unless the FEHM stress module is being used.
Note that, because python indexing begins at 0, the variable associated with a node is accessed at the list position one less than the node index, e.g., the pressure at node 100 is accessed via fincon.P[99].
(lst[fl64]) Initial node pressures, ordered by node index.
(lst[fl64]) Initial node temperatures, ordered by node index.
(lst[fl64]) Initial node water saturations, ordered by node index.
(lst[fl64]) Initial node co2 liquid/super-critical saturations, ordered by node index.
(lst[fl64]) Initial node co2 gas saturations, ordered by node index.
(lst[fl64]) Initial node dissolved co2 concentrations, ordered by node index.
(lst[fl64]) Initial node water equation of state indices, ordered by node index.
(lst[fl64]) Initial node co2 equation of state indices, ordered by node index.
(lst[fl64]) Initial node co2 equation of state indices, ordered by node index.
(lst[fl64]) Initial node x displacement, ordered by node index
(lst[fl64]) Initial node y displacement, ordered by node index
(lst[fl64]) Initial node z displacement, ordered by node index
(lst[fl64]) Initial node x stress, ordered by node index
(lst[fl64]) Initial node y stress, ordered by node index
(lst[fl64]) Initial node z stress, ordered by node index
(lst[fl64]) Initial node xy stress, ordered by node index
(lst[fl64]) Initial node xz stress, ordered by node index
(lst[fl64]) Initial node yz stress, ordered by node index
Parse a restart file for variable information.
Parameters: | inconfilename (str) – Name of restart file. |
---|
Write out a restart file.
Parameters: | inconfilename (str) – Name of restart file to write out. |
---|
Construct initial stress state with vertical stress gradients.
Parameters: |
|
---|
Construct initial stress state near Mohr-Coulomb failure. The vertical stress is calculated using the assigned density. Minimum or maximum horizontal stress calculated using the specified friction coefficient. Intermediate principal stress is assumed to be the average of the other two.
Parameters: |
|
---|
Relative permeability models in FEHM can be defined through either the RLP or RLPM macro. In PyFEHM, RLP macros are defined via the ordinary fmodel('rlp') object, whereas RLPM is defined within the specialised frlpm class detailed here.
For each phase present in the model, the user defines a relperm model. The user can additionally define capillary pressure models for phase pairs. The following phases can have relative permeability and capillary pressure models defined: water, air, co2_liquid, co2_gas, vapor.
Parameters for the available relative permeability models are given in the table below.
Relative permeability model Parameter name Default constant None N/A linear minimum_saturation 0 maximum_saturation 1 exponential minimum_saturation 0 maximum_saturation 1 exponent 1 maximum_relperm 1 corey minimum_saturation 0 maximum_saturation 1 brooks-corey minimum_saturation 0 maximum_saturation 1 exponent 1 vg maximum_saturation 0 maximum_saturation 1 air_entry_head 1 exponent 1
Parameters for the available capillary pressure models are given in the table below.
Capillary pressure model Parameter name Default linear_cap cap_at_zero_sat None sat_at_zero_cap None brooks-corey_cap minimum_saturation 0 maximum_saturation 1 exponent 1 capillary_entry_presure 0.01 low_saturation_fitting None cutoff_saturation None vg_cap minimum_saturation 0 maximum_saturation 1 air_entry_head 1 exponent 1 low_saturation_fitting None cutoff_saturation None
Relative permeability model.
Relative permeability models are applied to zones. Each model assigns the relative permeability characteristics for a particular phase (in attribute relperm) and capillary pressure relationships between phases (in attribute capillary). In contrast to other macros, one relative permeability model may be applied to multiple zones.
(int) Group assignment for the relative permeability model.
(fzone) Zone or list of zones to which the relative permeability model is assigned.
(dict) Dictionary of relative permeability models for each phase, indexed by phase name, e.g., ‘water’. Each relperm model has a model type, and set of parameters for that type.
(dict) Dictionary of capillary pressure models, indexed by a tuple phase name pair, e.g., (‘water/air’). Each capillary pressure model has a model type, and set of parameters for that type.
Add a new relative permeability model for a given phase.
Parameters: |
|
---|
Add a new capillary pressure relationship between two phases.
Parameters: |
|
---|
Delete a previously defined relative permeability or capillary pressure model.
In the following example, a relative permeability and capillary pressure model is added for a water/co2 mixture.
rlpm=frlpm(group=1,zone=dat.zone[0])
rlpm.add_relperm ('water','exponential',[0.2,1.,3.1,1.])
rlpm.add_relperm ('co2_liquid','exponential',[0.2,1.,3.1,0.8])
rlpm.add_capillary (('water','co2_liquid'),'vg_cap',[0,0.87,.0015,3.5,7,0.])
dat.add (rlpm)
FEHM contains an additional module that allows for coupled thermo-hydro-mechanical modelling. In PyFEHM, the stress module is invoked via the fstrs class.
For a well formed coupled flow-stress problem, the user will need to specify elastic material properties via fmacro('elastic') and some fixed displacement stress boundary conditions to prevent the model block from flying off into space (fmacro('stressboun')).
Additional complexity can be included, e.g.:
The stress module is off by default when a new data file is created. It is turned on via the fdata.strs.on() method.
Stress module object, sets properties for execution of FEHM stress module (see macro STRS).
(dict[flt]) Dictionary of stress parameters: ‘IHMS’ - coupling parameter, ‘ISTRS’ - type of stress solution.
(bool) Boolean calling for body force calculations (gravity). Default is True.
(bool) Boolean signalling if initial stress calculations should be performed. Default is True.
(bool) Boolean signalling use of finite element modules for calculating stress and displacement. Default is True.
(flt) Tolerance of stress calculations.
Dictionary of excess shear parameters:
Set parameters to turn stress calculations ON.
Set param to turn stress calculations OFF.
Switch on the stress module, turn off bodyforce calculations (important if doing a restart from a simulation that previously contained gravity).
Add some elastic material properties and a stress boundary condition.
Mixtures of water and gaseous, liquid and super-critical carbon dioxide are modelled in FEHM using the CARB macro. In PyFEHM this module is loaded using the fcarb class.
As with water, a CO2 simulation should contain CO2 sinks or sources (fmacro('co2flow')) and may include conditions for any CO2 initially present (fmacro('co2pres')) and fmacro('co2frac')).
When using the CO2 module, a relative permeability model for water/CO2 mixtures should be specified, either via fmodel('rlp') or frlpm.
The CO2 module is off by default when a new data file is created. It is turned on via fcarb.on().
CO2 module object, sets properties for execution of FEHM CO2 module (see macro CARB).
(int) Integer indicating type of simulation.
(bool) Boolean signalling calculation of brine in simulation.
Set parameters to turn CO2 calculations ON.
Parameters: | iprtype (int) – Integer denoting type of simulation (1 = water only, 2 = CO2 only, 3 = water+CO2, no solubility, 4 = water+CO2, with solubility, 5 = water+CO2+air, with solubility) |
---|
Set parameters to turn CO2 calculations OFF.
Return a summary of the CO2 module.
Switch on the CO2 module and specify that CO2 dissolution in water should be modelled.
Add a CO2 injection source and assign the injection block to initially have non-zero CO2 fraction. This is important, as relative permeability effects may not permit the source to flow.
Support of FEHM’s trac macro is currently at ‘stupid’ level. The user supplies a list of zones required by the macro and a file path to an auxiliary text file which contains the macro definition verbatim.
Chemistry module object, sets properties for execution of FEHM chemistry module (see macro TRAC).
(lst[fzone]) A list of zones to be written before the trac macro, for the situation that trac is used in ‘stupid’ model, i.e., the file attribute has been set to an auxiliary file.
(str) Path of auxiliary file containing trac information. PyFEHM will copy the contents of this file into the input file verbatim. Setting this variable will cause PyFEHM to use trac in ‘stupid’ mode.
FEHM prints output information to the screen and to an output ‘*.outp’ file. These output files can be parsed for information using foutput objects. Optional information such as FEHM input and grid file paths may be required.
(dict) Dictionary of node output, keyed first on component (‘water’,’gas’,’tracer1’), then on node number, then on variable.
(ndarray) Vector of output times.
(lst) List of variables available for the various components.
(lst) Component names for which nodal information available
(str) Name of output file