move updatePrimaryVariablesPolyMW to StandardWellPrimaryVariables

This commit is contained in:
Arne Morten Kvarving
2022-11-08 07:09:51 +01:00
parent 15d49e745e
commit f964169914
5 changed files with 30 additions and 23 deletions

View File

@@ -348,26 +348,6 @@ updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_log
primary_variables_.value_[Bhp] = ws.bhp;
}
template<class FluidSystem, class Indices, class Scalar>
void
StandardWellEval<FluidSystem,Indices,Scalar>::
updatePrimaryVariablesPolyMW(const BVectorWell& dwells) const
{
if (baseif_.isInjector()) {
for (int perf = 0; perf < baseif_.numPerfs(); ++perf) {
const int wat_vel_index = Bhp + 1 + perf;
const int pskin_index = Bhp + 1 + baseif_.numPerfs() + perf;
const double relaxation_factor = 0.9;
const double dx_wat_vel = dwells[0][wat_vel_index];
primary_variables_.value_[wat_vel_index] -= relaxation_factor * dx_wat_vel;
const double dx_pskin = dwells[0][pskin_index];
primary_variables_.value_[pskin_index] -= relaxation_factor * dx_pskin;
}
}
}
template<class FluidSystem, class Indices, class Scalar>
void
StandardWellEval<FluidSystem,Indices,Scalar>::

View File

@@ -127,8 +127,6 @@ protected:
void updatePrimaryVariables(const WellState& well_state,
DeferredLogger& deferred_logger) const;
void updatePrimaryVariablesPolyMW(const BVectorWell& dwells) const;
void updateWellStateFromPrimaryVariables(WellState& well_state,
DeferredLogger& deferred_logger) const;

View File

@@ -22,6 +22,9 @@
#include <config.h>
#include <opm/simulators/wells/StandardWellPrimaryVariables.hpp>
#include <dune/common/dynvector.hh>
#include <dune/istl/bvector.hh>
#include <opm/material/densead/Evaluation.hpp>
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
@@ -55,6 +58,26 @@ resize(const int numWellEq)
numWellEq_ = numWellEq;
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
updatePolyMW(const BVectorWell& dwells)
{
if (well_.isInjector()) {
for (int perf = 0; perf < well_.numPerfs(); ++perf) {
const int wat_vel_index = Bhp + 1 + perf;
const int pskin_index = Bhp + 1 + well_.numPerfs() + perf;
const double relaxation_factor = 0.9;
const double dx_wat_vel = dwells[0][wat_vel_index];
value_[wat_vel_index] -= relaxation_factor * dx_wat_vel;
const double dx_pskin = dwells[0][pskin_index];
value_[pskin_index] -= relaxation_factor * dx_pskin;
}
}
}
#define INSTANCE(...) \
template class StandardWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;

View File

@@ -25,6 +25,8 @@
#include <opm/material/densead/DynamicEvaluation.hpp>
#include <opm/simulators/wells/StandardWellEquations.hpp>
#include <vector>
namespace Opm
@@ -80,6 +82,7 @@ public:
//! \brief Evaluation for the well equations.
using EvalWell = DenseAd::DynamicEvaluation<Scalar, numStaticWellEq + Indices::numEq + 1>;
using BVectorWell = typename StandardWellEquations<Scalar,Indices::numEq>::BVectorWell;
//! \brief Constructor initializes reference to well interface.
StandardWellPrimaryVariables(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well)
@@ -103,6 +106,9 @@ public:
//! \brief Returns number of well equations.
int numWellEq() const { return numWellEq_; }
//! \brief Update polymer molecular weight values from solution vector.
void updatePolyMW(const BVectorWell& dwells);
private:
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well interface

View File

@@ -978,7 +978,7 @@ namespace Opm
{
// for the water velocity and skin pressure
if constexpr (Base::has_polymermw) {
this->updatePrimaryVariablesPolyMW(dwells);
this->primary_variables_.updatePolyMW(dwells);
}
}