#include <BlackoilModel.hpp>
|
| BlackoilModel (const typename Base::ModelParameters ¶m, const Grid &grid, const BlackoilPropsAdInterface &fluid, const DerivedGeology &geo, const RockCompressibility *rock_comp_props, const Wells *wells_arg, const NewtonIterationBlackoilInterface &linsolver, Opm::EclipseStateConstPtr eclState, const bool has_disgas, const bool has_vapoil, const bool terminal_output) |
|
void | setThresholdPressures (const std::vector< double > &threshold_pressures_by_face) |
| Set threshold pressures that prevent or reduce flow. This prevents flow across faces if the potential difference is less than the threshold. If the potential difference is greater, the threshold value is subtracted before calculating flow. This is treated symmetrically, so flow is prevented or reduced in both directions equally. More...
|
|
void | prepareStep (const double dt, ReservoirState &reservoir_state, WellState &well_state) |
|
void | afterStep (const double dt, ReservoirState &reservoir_state, WellState &well_state) |
|
void | assemble (const ReservoirState &reservoir_state, WellState &well_state, const bool initial_assembly) |
|
std::vector< double > | computeResidualNorms () const |
| Compute the residual norms of the mass balance for each phase, the well flux, and the well equation. More...
|
|
int | sizeNonLinear () const |
| The size (number of unknowns) of the nonlinear system of equations. More...
|
|
int | linearIterationsLastSolve () const |
| Number of linear iterations used in last call to solveJacobianSystem(). More...
|
|
V | solveJacobianSystem () const |
|
void | updateState (const V &dx, ReservoirState &reservoir_state, WellState &well_state) |
|
bool | terminalOutputEnabled () const |
| Return true if output to cout is wanted. More...
|
|
bool | getConvergence (const double dt, const int iteration) |
|
int | numPhases () const |
| The number of active fluid phases in the model. More...
|
|
int | numMaterials () const |
|
const std::string & | materialName (int material_index) const |
|
void | updateEquationsScaling () |
| Update the scaling factors for mass balance equations. More...
|
|
|
typedef Eigen::Array< double,
Eigen::Dynamic, Eigen::Dynamic,
Eigen::RowMajor > | DataBlock |
|
|
BlackoilModel< Grid > & | asImpl () |
|
const BlackoilModel< Grid > & | asImpl () const |
|
bool | wellsActive () const |
|
bool | localWellsActive () const |
|
const Wells & | wells () const |
|
void | makeConstantState (SolutionState &state) const |
|
SolutionState | variableState (const ReservoirState &x, const WellState &xw) const |
|
std::vector< V > | variableStateInitials (const ReservoirState &x, const WellState &xw) const |
|
void | variableReservoirStateInitials (const ReservoirState &x, std::vector< V > &vars0) const |
|
void | variableWellStateInitials (const WellState &xw, std::vector< V > &vars0) const |
|
std::vector< int > | variableStateIndices () const |
|
std::vector< int > | variableWellStateIndices () const |
|
SolutionState | variableStateExtractVars (const ReservoirState &x, const std::vector< int > &indices, std::vector< ADB > &vars) const |
|
void | variableStateExtractWellsVars (const std::vector< int > &indices, std::vector< ADB > &vars, SolutionState &state) const |
|
void | computeAccum (const SolutionState &state, const int aix) |
|
void | computeWellConnectionPressures (const SolutionState &state, const WellState &xw) |
|
void | assembleMassBalanceEq (const SolutionState &state) |
|
void | solveWellEq (const std::vector< ADB > &mob_perfcells, const std::vector< ADB > &b_perfcells, SolutionState &state, WellState &well_state) |
|
void | computeWellFlux (const SolutionState &state, const std::vector< ADB > &mob_perfcells, const std::vector< ADB > &b_perfcells, V &aliveWells, std::vector< ADB > &cq_s) |
|
void | updatePerfPhaseRatesAndPressures (const std::vector< ADB > &cq_s, const SolutionState &state, WellState &xw) |
|
void | addWellFluxEq (const std::vector< ADB > &cq_s, const SolutionState &state) |
|
void | addWellContributionToMassBalanceEq (const std::vector< ADB > &cq_s, const SolutionState &state, const WellState &xw) |
|
void | addWellControlEq (const SolutionState &state, const WellState &xw, const V &aliveWells) |
|
void | updateWellControls (WellState &xw) const |
|
void | updateWellState (const V &dwells, WellState &well_state) |
|
bool | getWellConvergence (const int iteration) |
|
bool | isVFPActive () const |
|
std::vector< ADB > | computePressures (const ADB &po, const ADB &sw, const ADB &so, const ADB &sg) const |
|
V | computeGasPressure (const V &po, const V &sw, const V &so, const V &sg) const |
|
std::vector< ADB > | computeRelPerm (const SolutionState &state) const |
|
void | computeMassFlux (const int actph, const V &transi, const ADB &kr, const ADB &p, const SolutionState &state) |
|
void | applyThresholdPressures (ADB &dp) |
|
ADB | fluidViscosity (const int phase, const ADB &p, const ADB &temp, const ADB &rs, const ADB &rv, const std::vector< PhasePresence > &cond) const |
|
ADB | fluidReciprocFVF (const int phase, const ADB &p, const ADB &temp, const ADB &rs, const ADB &rv, const std::vector< PhasePresence > &cond) const |
|
ADB | fluidDensity (const int phase, const ADB &b, const ADB &rs, const ADB &rv) const |
|
V | fluidRsSat (const V &p, const V &so, const std::vector< int > &cells) const |
|
ADB | fluidRsSat (const ADB &p, const ADB &so, const std::vector< int > &cells) const |
|
V | fluidRvSat (const V &p, const V &so, const std::vector< int > &cells) const |
|
ADB | fluidRvSat (const ADB &p, const ADB &so, const std::vector< int > &cells) const |
|
ADB | poroMult (const ADB &p) const |
|
ADB | transMult (const ADB &p) const |
|
const std::vector< PhasePresence > | phaseCondition () const |
|
void | classifyCondition (const ReservoirState &state) |
|
void | updatePrimalVariableFromState (const ReservoirState &state) |
|
void | updatePhaseCondFromPrimalVariable () |
| Update the phaseCondition_ member based on the primalVariable_ member. More...
|
|
double | convergenceReduction (const Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic > &B, const Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic > &tempV, const Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic > &R, std::vector< double > &R_sum, std::vector< double > &maxCoeff, std::vector< double > &B_avg, std::vector< double > &maxNormWell, int nc, int nw) const |
| Compute the reduction within the convergence check. More...
|
|
double | dpMaxRel () const |
|
double | dsMax () const |
|
double | drMaxRel () const |
|
double | maxResidualAllowed () const |
|
template<class Grid>
class Opm::BlackoilModel< Grid >
A model implementation for three-phase black oil.
The simulator is capable of handling three-phase problems where gas can be dissolved in oil and vice versa. It uses an industry-standard TPFA discretization with per-phase upwind weighting of mobilities.
It uses automatic differentiation via the class AutoDiffBlock to simplify assembly of the jacobian matrix.
template<class Grid >
Opm::BlackoilModel< Grid >::BlackoilModel |
( |
const typename Base::ModelParameters & |
param, |
|
|
const Grid & |
grid, |
|
|
const BlackoilPropsAdInterface & |
fluid, |
|
|
const DerivedGeology & |
geo, |
|
|
const RockCompressibility * |
rock_comp_props, |
|
|
const Wells * |
wells_arg, |
|
|
const NewtonIterationBlackoilInterface & |
linsolver, |
|
|
Opm::EclipseStateConstPtr |
eclState, |
|
|
const bool |
has_disgas, |
|
|
const bool |
has_vapoil, |
|
|
const bool |
terminal_output |
|
) |
| |
|
inline |
Construct the model. It will retain references to the arguments of this functions, and they are expected to remain in scope for the lifetime of the solver. - Parameters
-
[in] | param | parameters |
[in] | grid | grid data structure |
[in] | fluid | fluid properties |
[in] | geo | rock properties |
[in] | rock_comp_props | if non-null, rock compressibility properties |
[in] | wells_arg | well structure |
[in] | linsolver | linear solver |
[in] | eclState | eclipse state |
[in] | has_disgas | turn on dissolved gas |
[in] | has_vapoil | turn on vaporized oil feature |
[in] | terminal_output | request output to cout/cerr |
Called once after each time step. In this class, this function does nothing. - Parameters
-
[in] | dt | time step size |
[in,out] | reservoir_state | reservoir state variables |
[in,out] | well_state | well state variables |
Access the most-derived class used for static polymorphism (CRTP).
Access the most-derived class used for static polymorphism (CRTP).
Assemble the residual and Jacobian of the nonlinear system. - Parameters
-
[in] | reservoir_state | reservoir state variables |
[in,out] | well_state | well state variables |
[in] | initial_assembly | pass true if this is the first call to assemble() in this timestep |
Compute the residual norms of the mass balance for each phase, the well flux, and the well equation.
- Returns
- a vector that contains for each phase the norm of the mass balance and afterwards the norm of the residual of the well flux and the well equation.
double Opm::BlackoilModelBase< Grid, BlackoilModel< Grid > >::convergenceReduction |
( |
const Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic > & |
B, |
|
|
const Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic > & |
tempV, |
|
|
const Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic > & |
R, |
|
|
std::vector< double > & |
R_sum, |
|
|
std::vector< double > & |
maxCoeff, |
|
|
std::vector< double > & |
B_avg, |
|
|
std::vector< double > & |
maxNormWell, |
|
|
int |
nc, |
|
|
int |
nw |
|
) |
| const |
|
protectedinherited |
Compute the reduction within the convergence check.
- Parameters
-
[in] | B | A matrix with MaxNumPhases columns and the same number rows as the number of cells of the grid. B.col(i) contains the values for phase i. |
[in] | tempV | A matrix with MaxNumPhases columns and the same number rows as the number of cells of the grid. tempV.col(i) contains the values for phase i. |
[in] | R | A matrix with MaxNumPhases columns and the same number rows as the number of cells of the grid. B.col(i) contains the values for phase i. |
[out] | R_sum | An array of size MaxNumPhases where entry i contains the sum of R for the phase i. |
[out] | maxCoeff | An array of size MaxNumPhases where entry i contains the maximum of tempV for the phase i. |
[out] | B_avg | An array of size MaxNumPhases where entry i contains the average of B for the phase i. |
[out] | maxNormWell | The maximum of the well equations for each phase. |
[in] | nc | The number of cells of the local grid. |
[in] | nw | The number of wells on the local grid. |
- Returns
- The total pore volume over all cells.
Compute convergence based on total mass balance (tol_mb) and maximum residual mass balance (tol_cnv). - Parameters
-
[in] | dt | timestep length |
[in] | iteration | current iteration number |
The name of an active material in the model. It is required that material_index < numMaterials().
The number of active materials in the model. This should be equal to the number of material balance equations.
The number of active fluid phases in the model.
Called once before each time step. - Parameters
-
[in] | dt | time step size |
[in,out] | reservoir_state | reservoir state variables |
[in,out] | well_state | well state variables |
Set threshold pressures that prevent or reduce flow. This prevents flow across faces if the potential difference is less than the threshold. If the potential difference is greater, the threshold value is subtracted before calculating flow. This is treated symmetrically, so flow is prevented or reduced in both directions equally.
- Parameters
-
[in] | threshold_pressures_by_face | array of size equal to the number of faces of the grid passed in the constructor. |
The size (number of unknowns) of the nonlinear system of equations.
Solve the Jacobian system Jx = r where J is the Jacobian and r is the residual.
Return true if output to cout is wanted.
Update the scaling factors for mass balance equations.
Update the phaseCondition_ member based on the primalVariable_ member.
Update the phaseCondition_ member based on the primalVariable_ member. Also updates isRs_, isRv_ and isSg_;
update the primal variable for Sg, Rv or Rs. The Gas phase must be active to call this method.
Apply an update to the primary variables, chopped if appropriate. - Parameters
-
[in] | dx | updates to apply to primary variables |
[in,out] | reservoir_state | reservoir state variables |
[in,out] | well_state | well state variables |
Whether we print something to std::cout.
The documentation for this class was generated from the following file:
|