Generic objective functions
- class HydrOpTop.Functions.p_Gradient(direction='Z', power=1)
- Description:
p_Gradient function return a index characterizing whether the material p=1 is placed above material p=0:
\[f = \frac{1}{V_D} \sum_{i \in D} V_i \max\left(0,\nabla p_i\right)^n - \epsilon\]Designed to be used as a constructibility constrain if material 1 could not be build above material 0 for example. The \(\max()\) function is represented through a smooth Heaviside function. The gradient \(\nabla p\) is evaluated using the Gauss gradient scheme for cell-centered finite volume solver:
\[\begin{split}\nabla p_i = \frac{1}{V_i} \sum_{j \in \partial i} A_{ij} \boldsymbol{n_{ij}} \left\{ \begin{array}{ll} p_j \mbox{ if } z_i > z_j \\ p_i \mbox{ else} \end{array} \\ \right.\end{split}\]Note this method leads rigorously to a second order accurate gradient if and only if the mesh is non skewed (i.e. the cell center vector intercept the face exactly at its center), which could not be the case for general unstructured mesh.
For finite element solver, … (not implemented).
- Parameters:
direction(X,YorZ): control the direction on which calculate the indexpower(float) the penalizing power n- Require PFLOTRAN outputs:
FACE_AREA,VOLUME,FACE_CELL_CENTER_VECTOR_{direction}andPRINT_CONNECTION_IDS.
- class HydrOpTop.Functions.Sum_Variable(variable, solved=True, ids_to_consider=None)
Sum a output variable (solved or not) argument: - variable: the name of the variable to sum - solved: is this variable solved by the solver ? - ids_to_consider: the ids to sum
- class HydrOpTop.Functions.Volume_Percentage(ids_to_sum_volume='parametrized_cell', volume_of_p0=False)
Integrate the volume ponderated value of the primary optimization variable p over the domain \(D\) (i.e., compute the ratio of volume of material designed by p=1):
\[f = \frac{1}{V_D} \sum_{i \in D} p_i V_i\]Require PFLOTRAN output
VOLUME.- Parameters:
ids_to_sum_volume (iterable) – a list of cell ids on which to compute the volume percentage
volume_of_p0 – if set to
True, switch the material and rather calculate the volume fraction of the material designed by p=0. In this case, \(p_i\) is remplaced by \(p'_i = 1-p_i\).