mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
MultisegmentWellEval: use symbols from primary variables
This commit is contained in:
parent
654c252bb8
commit
bc0610171d
@ -68,11 +68,7 @@ namespace Opm
|
|||||||
using typename MSWEval::Equations;
|
using typename MSWEval::Equations;
|
||||||
using typename MSWEval::EvalWell;
|
using typename MSWEval::EvalWell;
|
||||||
using typename MSWEval::BVectorWell;
|
using typename MSWEval::BVectorWell;
|
||||||
using MSWEval::GFrac;
|
|
||||||
using MSWEval::WFrac;
|
|
||||||
using MSWEval::WQTotal;
|
|
||||||
using MSWEval::SPres;
|
using MSWEval::SPres;
|
||||||
using MSWEval::numWellEq;
|
|
||||||
using typename Base::PressureMatrix;
|
using typename Base::PressureMatrix;
|
||||||
|
|
||||||
MultisegmentWell(const Well& well,
|
MultisegmentWell(const Well& well,
|
||||||
|
@ -94,7 +94,8 @@ getWellConvergence(const WellState& well_state,
|
|||||||
assert(int(B_avg.size()) == baseif_.numComponents());
|
assert(int(B_avg.size()) == baseif_.numComponents());
|
||||||
|
|
||||||
// checking if any residual is NaN or too large. The two large one is only handled for the well flux
|
// checking if any residual is NaN or too large. The two large one is only handled for the well flux
|
||||||
std::vector<std::vector<double>> abs_residual(this->numberOfSegments(), std::vector<double>(numWellEq, 0.0));
|
std::vector<std::vector<double>> abs_residual(this->numberOfSegments(),
|
||||||
|
std::vector<double>(numWellEq, 0.0));
|
||||||
for (int seg = 0; seg < this->numberOfSegments(); ++seg) {
|
for (int seg = 0; seg < this->numberOfSegments(); ++seg) {
|
||||||
for (int eq_idx = 0; eq_idx < numWellEq; ++eq_idx) {
|
for (int eq_idx = 0; eq_idx < numWellEq; ++eq_idx) {
|
||||||
abs_residual[seg][eq_idx] = std::abs(linSys_.residual()[seg][eq_idx]);
|
abs_residual[seg][eq_idx] = std::abs(linSys_.residual()[seg][eq_idx]);
|
||||||
|
@ -53,36 +53,10 @@ template<typename FluidSystem, typename Indices, typename Scalar>
|
|||||||
class MultisegmentWellEval : public MultisegmentWellGeneric<Scalar>
|
class MultisegmentWellEval : public MultisegmentWellGeneric<Scalar>
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
// TODO: for now, not considering the polymer, solvent and so on to simplify the development process.
|
using PrimaryVariables = MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>;
|
||||||
|
static constexpr int numWellEq = PrimaryVariables::numWellEq;
|
||||||
// TODO: we need to have order for the primary variables and also the order for the well equations.
|
static constexpr int SPres = PrimaryVariables::SPres;
|
||||||
// sometimes, they are similar, while sometimes, they can have very different forms.
|
static constexpr int WQTotal = PrimaryVariables::WQTotal;
|
||||||
|
|
||||||
// Table showing the primary variable indices, depending on what phases are present:
|
|
||||||
//
|
|
||||||
// WOG OG WG WO W/O/G (single phase)
|
|
||||||
// WQTotal 0 0 0 0 0
|
|
||||||
// WFrac 1 -1000 1 1 -1000
|
|
||||||
// GFrac 2 1 -1000 -1000 -1000
|
|
||||||
// Spres 3 2 2 2 1
|
|
||||||
|
|
||||||
static constexpr bool has_water = (Indices::waterSwitchIdx >= 0);
|
|
||||||
static constexpr bool has_gas = (Indices::compositionSwitchIdx >= 0);
|
|
||||||
static constexpr bool has_oil = (Indices::numPhases - has_gas - has_water) > 0;
|
|
||||||
|
|
||||||
// In the implementation, one should use has_wfrac_variable
|
|
||||||
// rather than has_water to check if you should do something
|
|
||||||
// with the variable at the WFrac location, similar for GFrac.
|
|
||||||
static constexpr bool has_wfrac_variable = has_water && Indices::numPhases > 1;
|
|
||||||
static constexpr bool has_gfrac_variable = has_gas && has_oil;
|
|
||||||
|
|
||||||
static constexpr int WQTotal = 0;
|
|
||||||
static constexpr int WFrac = has_wfrac_variable ? 1 : -1000;
|
|
||||||
static constexpr int GFrac = has_gfrac_variable ? has_wfrac_variable + 1 : -1000;
|
|
||||||
static constexpr int SPres = has_wfrac_variable + has_gfrac_variable + 1;
|
|
||||||
|
|
||||||
// the number of well equations TODO: it should have a more general strategy for it
|
|
||||||
static constexpr int numWellEq = Indices::numPhases + 1;
|
|
||||||
|
|
||||||
using Equations = MultisegmentWellEquations<Scalar,numWellEq,Indices::numEq>;
|
using Equations = MultisegmentWellEquations<Scalar,numWellEq,Indices::numEq>;
|
||||||
|
|
||||||
@ -92,7 +66,7 @@ protected:
|
|||||||
// TODO: for more efficient implementation, we should have EvalReservoir, EvalWell, and EvalRerservoirAndWell
|
// TODO: for more efficient implementation, we should have EvalReservoir, EvalWell, and EvalRerservoirAndWell
|
||||||
// EvalR (Eval), EvalW, EvalRW
|
// EvalR (Eval), EvalW, EvalRW
|
||||||
// TODO: for now, we only use one type to save some implementation efforts, while improve later.
|
// TODO: for now, we only use one type to save some implementation efforts, while improve later.
|
||||||
using EvalWell = DenseAd::Evaluation<double, /*size=*/Indices::numEq + numWellEq>;
|
using EvalWell = typename PrimaryVariables::EvalWell;
|
||||||
using Eval = DenseAd::Evaluation<Scalar, /*size=*/Indices::numEq>;
|
using Eval = DenseAd::Evaluation<Scalar, /*size=*/Indices::numEq>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -178,7 +152,7 @@ protected:
|
|||||||
|
|
||||||
Equations linSys_; //!< The equation system
|
Equations linSys_; //!< The equation system
|
||||||
|
|
||||||
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar> primary_variables_;
|
PrimaryVariables primary_variables_; //!< The primary variables
|
||||||
|
|
||||||
// the upwinding segment for each segment based on the flow direction
|
// the upwinding segment for each segment based on the flow direction
|
||||||
std::vector<int> upwinding_segments_;
|
std::vector<int> upwinding_segments_;
|
||||||
|
Loading…
Reference in New Issue
Block a user