PFLOTRAN specific functions
- class HydrOpTop.Functions.Head_Gradient(ids_to_consider='everywhere', power=1.0, gravity=9.8068, density=997.16, ref_pressure=101325, restrict_domain=False)
Calculate the mean head gradient in the prescribed domain:
\[f = \frac{1}{V_D} \sum_{i \in D} V_i ||\nabla {h_i} ||^n\]Head is defined as:
\[h_i = \frac{P_i-P_{ref}}{\rho g}\]and gradient is estimated using the Green-Gauss cell-centered scheme:
\[\nabla h_i = \frac{1}{V_i} \sum_{j \in \partial i} A_{ij} \boldsymbol{n_{ij}} \left[d_i h_i + (1-d_i) h_j \right]\]Required PFLOTRAN output,
LIQUID_PRESSURE,CONNECTION_IDS,FACE_AREA,FACE_UPWIND_FRACTION,VOLUME,Z_COORDINATE,FACE_NORMAL_X,FACE_NORMAL_YandFACE_NORMAL_Z.- Parameters:
ids_to_consider (iterable) – the cell ids on which to compute the mean gradient
power (float) – the penalizing power
nabovegravity (float) – norm of the gravity vector
gdensity (float) – fluid density \(\rho\).
ref_pressure (float) – reference pressure in PFLOTRAN simulation
restrict_domain (bool) – an option to calculate the gradient considering only the considered cells instead considering the whole simulation. Might change the gradient calculated at the boundary of the considered cells.
- class HydrOpTop.Functions.Mean_Liquid_Piezometric_Head(ids_to_sum='everywhere', penalizing_power=1, gravity=9.8068, density=997.16, reference_pressure=101325.0)
The Mean_Liquid_Piezometric_Head function compute the mean of the piezometric head in the given cell ids:
Required PFLOTRAN outputs
LIQUID_PRESSUREandVOLUME.- Parameters:
ids_to_sum (iterable) – Cell ids to compute the mean piezometric head
power (float) – the penalizing power n above
gravity (float) – norm of the gravity vector g
density (float) – fluid density rho
ref_pressure (float) – reference pressure in PFLOTRAN simulation
- class HydrOpTop.Functions.p_Weighted_Head_Gradient(ids_to_consider='everywhere', power=1.0, correction_iteration=2, gravity=9.8068, density=997.16, ref_pressure=101325, invert_weighting=False, restrict_domain=False)
- Description:
Calculate the mean head gradient in the prescribed domain weighted by the density parameter p. In practice, can be used to just consider the mean head gradient in the material defined by
p=1:\[f = \frac{1}{V_D} \sum_{i \in D} p_i V_i ||\nabla {h_i} ||^n\]For more detail, see description of the objective function
Head_Gradient.- Parameters:
ids_to_consider(iterable): the cell ids on which to compute the mean gradientpower(float): the penalizing power n abovecorrection_iteration(int): number of iteration for the deferred correction to better estimate the gradient (not yet implemented)gravity(float): norm of the gravity vector gdensity(float): fluid density rhoref_pressure(float): reference pressure in PFLOTRAN simulationrestrict_domain(bool): an option to calculate the gradient considering only the considered cells instead considering the whole simulation. Might change the gradient calculated at the boundary of the optimization domain.invert_weighting(bool): can be set toTrueto rather consider the mean head gradient in the material designed byp=0.- Required PFLOTRAN outputs:
LIQUID_PRESSURE,CONNECTION_IDS,FACE_AREA,FACE_UPWIND_FRACTION,VOLUME,Z_COORDINATE,FACE_NORMAL_X,FACE_NORMAL_YandFACE_NORMAL_Z
- class HydrOpTop.Functions.Sum_Flux(connections=None, option='signed')
Compute the flux through a given surface defined by a list of faces as:
(1)\[ f = \sum_{(i,j) \in S} \left[A_{ij} \frac{k_{ij}}{\mu} \frac{P_i - P_j + \rho g (z_i - z_j)} {d_{ij}}\right]^n\]Faces are specified by a the two cell ids sharing the face. Fluid is considered incompressible and with a constant viscosity (i.e. \(\rho\) and \(\mu\) are constant). Not tested for variably saturated flow.
Require PFLOTRAN outputs
LIQUID_PRESSURE,FACE_AREA,PERMEABILITY,FACE_UPWIND_FRACTION,FACE_DISTANCE_BETWEEN_CENTER,Z_COORDINATEandCONNECTION_IDS.- Params connections:
a two dimension array of size (N,2) storing the cell ids shared the faces on which to sum the flux.
- Params option:
either one of
"absolute"(each face flux are summed in absolute value),"signed"(each face flux are summed from cell i to cell j), or"signed_reverse"(each face flux are summed from cell j to cell i).
- class HydrOpTop.Functions.p_Weighted_Sum_Flux(cell_ids_to_consider=None, invert_weighting=False)
NEED TO BE UPDATE AS SUM FLUX
- Description:
p_Weighted_Sum_Flux return a number characterizing the total flowrate in material designed by p=1 in the considered cells. In practice, it could be used to minimize the mean flux in material designed by p=1.
\[f = \sum_{i \in D} p_i \sum_{j \in \partial i} A_{ij} \frac{k_{ij}}{\mu} \frac{\left[P_i - P_j + \rho g (z_i - z_j)\right]} {d_{ij}}\]- Parameters:
cell_ids_to_consider(list): cell ids to sum the flowrate oninvert_weighting(bool): set toTrue, to invert the weighting and rather consider the flux in the material given by p=0 (i.e. \(p'=1-p\)).- Require PFLOTRAN outputs:
LIQUID_PRESSURE,FACE_AREA,PERMEABILITY,FACE_UPWIND_FRACTION,FACE_DISTANCE_BETWEEN_CENTER,Z_COORDINATEandCONNECTION_IDS.
- class HydrOpTop.Functions.Reference_Liquid_Head(head, cell_ids=None, observation_name=None, norm=1)
Compute the difference between the head at the given cells and the head in the simulation.
Required
LIQUID_HEADoutput.- Parameters:
head (iterable) – Reference head to compute the difference with
cell_ids (iterable) – The corresponding cell ids of the head. If None, consider head[0] for cell id 1, head[1] for cell id 2, …
observation_name (list of str) – If observation points have name in the simulator, provide it here
norm (int) – Norm to compute the difference (i.e. 1 for sum of head error, 2 for MSE, inf for max difference