Solvers

This section provide information on own to install solver interfaced with HydrOpTop and how to use the specific input/output shield. These shield allow HydrOpTop to communicate parametrized cell properties to the solvers, and get back the solved variables to compute the cost function and constraints, the sensitivities to solve the adjoint problem and get the objective function derivative, and sometimes some quantity related to the mesh.

PFLOTRAN

PFLOTRAN is a subsurface reactive transport code.

For instance only steady state processes in Richards mode are supported.

class HydrOpTop.Solvers.PFLOTRAN(pft_in, mesh_info=None)
Description:

IO shield to PFLOTRAN solver

Parameters:

pflotranin (str): path to the PFLOTRAN input file

mesh_info (str): path to a PFLOTRAN output file containing simulation independant PFLOTRAN output variable such as the mesh informations (face area or cell volume for example). Providing mesh information can help reduce the size of PFLOTRAN output file at every iteration, therefore saving time and increase the life of your SSD!

Differentiated design variables:

PERMEABILITY

Differentiated output variables:

PRESSURE

create_cell_indexed_dataset(X_dataset, dataset_name, h5_file_name='', X_ids=None, resize_to=True)
Description:

Create a PFLOTRAN cell indexed dataset.

Parameters:

X_dataset (numpy array): The dataset to write

dataset_name (str): he dataset name (need to be the same as in PFLOTRAN input deck)

h5_file_name (str): the name of the h5 output file (same as in PFLOTRAN input deck)

X_ids (numpy array): the cell ids matching the dataset value in X (i.e. if X_ids = [5, 3] and X_dataset = [1e7, 1e8], therefore, cell id 5 will have a X of 1e7 and 3 with 1e8). By default, assumed in natural order

resize_to (bool): boolean for resizing the given dataset to number of cell (default = True)

disable_run()

Do not run PFLOTRAN (for debug purpose)

get_connections_ids_integral_flux(integral_flux_name)
Description:

Read the INTEGRAL_FLUX card and return the faces considered

Parameters:

integral_flux_name (str): The name of the integral flux

Return:

A numpy array of size (n,2) of the n faces defined by the two cell ids sharing each face.

get_grid_size()

Return the number of element in the mesh.

get_internal_connections(out=None)

Return the internal connection of the mesh

get_mesh()

TODO

get_output_variable(var, out=None, i_timestep=-1)
Description:

Return output variable after simulation.

Parameters:

var (str): the variable name as in PFLOTRAN input file under VARIABLES block

out (numpy array): the numpy output array. If no array if provided, a new one is created

timestep (int): the i-th timestep to extract (not working yet)

get_region_ids(reg_name)
Description:

Interact with the REGION card defined in the PFLOTRAN input file

Parameters:

reg_name (str): Name of the region in PFLOTRAN input file

Return:

A numpy 1D array containing the cell ID belonging to the region reg_name as in the PFLOTRAN input file.

set_parallel_calling_command(processes, command)
Description:

Set the number of process \(n\) to run and the command to call (default is mpiexec.mpich)

Parameters:

processes (int): the number of core to run PFLOTRAN (the -n argument for mpirun) command (str): the MPI command (example: mpiexec.mpich)

Two-Dimensional Linear Elasticity

The Two-Dimensional Linear Elasticity is a linear mechanical solver which solve the displacement and the Von-Misses stress giving a 2D triangular unstructured grid on which each triangle can have a different Young modulus but a constant poisson ratio over the grid. The solver is available at X, which is a modified version of those from X to enable writing sensitivities and handle heterogeneous Young modulus.

Installation

Located in source. Must be compiled before use. Call by the command MinimalFEM. Input need a 2D mesh (.mesh file), material property file (.matprops) and a boundary condition (.bcs).

Interact with the solver

Command common to all solvers

TODO