mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
relaxationFactorFractionsForProducer: no need to pass values any longer
This commit is contained in:
parent
bc3680f822
commit
b5f5a24af6
@ -39,6 +39,7 @@
|
|||||||
#include <opm/simulators/wells/WellState.hpp>
|
#include <opm/simulators/wells/WellState.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -250,8 +251,7 @@ updateNewton(const BVectorWell& dwells,
|
|||||||
// for injectors, very typical one of the fractions will be one, and it is easy to get zero value
|
// for injectors, very typical one of the fractions will be one, and it is easy to get zero value
|
||||||
// fractions. not sure what is the best way to handle it yet, so we just use 1.0 here
|
// fractions. not sure what is the best way to handle it yet, so we just use 1.0 here
|
||||||
[[maybe_unused]] const double relaxation_factor_fractions =
|
[[maybe_unused]] const double relaxation_factor_fractions =
|
||||||
well_.isProducer() ? relaxationFactorFractionsProducer(value_, dwells)
|
well_.isProducer() ? this->relaxationFactorFractionsProducer(dwells) : 1.0;
|
||||||
: 1.0;
|
|
||||||
|
|
||||||
// update the second and third well variable (The flux fractions)
|
// update the second and third well variable (The flux fractions)
|
||||||
|
|
||||||
@ -630,8 +630,7 @@ processFractions()
|
|||||||
|
|
||||||
template<class FluidSystem, class Indices, class Scalar>
|
template<class FluidSystem, class Indices, class Scalar>
|
||||||
double StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
double StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
|
||||||
relaxationFactorFractionsProducer(const std::vector<double>& primary_variables,
|
relaxationFactorFractionsProducer(const BVectorWell& dwells) const
|
||||||
const BVectorWell& dwells) const
|
|
||||||
{
|
{
|
||||||
// TODO: not considering solvent yet
|
// TODO: not considering solvent yet
|
||||||
// 0.95 is a experimental value, which remains to be optimized
|
// 0.95 is a experimental value, which remains to be optimized
|
||||||
@ -639,13 +638,13 @@ relaxationFactorFractionsProducer(const std::vector<double>& primary_variables,
|
|||||||
|
|
||||||
if (FluidSystem::numActivePhases() > 1) {
|
if (FluidSystem::numActivePhases() > 1) {
|
||||||
if constexpr (has_wfrac_variable) {
|
if constexpr (has_wfrac_variable) {
|
||||||
const double relaxation_factor_w = relaxationFactorFraction(primary_variables[WFrac],
|
const double relaxation_factor_w = relaxationFactorFraction(value_[WFrac],
|
||||||
dwells[0][WFrac]);
|
dwells[0][WFrac]);
|
||||||
relaxation_factor = std::min(relaxation_factor, relaxation_factor_w);
|
relaxation_factor = std::min(relaxation_factor, relaxation_factor_w);
|
||||||
}
|
}
|
||||||
|
|
||||||
if constexpr (has_gfrac_variable) {
|
if constexpr (has_gfrac_variable) {
|
||||||
const double relaxation_factor_g = relaxationFactorFraction(primary_variables[GFrac],
|
const double relaxation_factor_g = relaxationFactorFraction(value_[GFrac],
|
||||||
dwells[0][GFrac]);
|
dwells[0][GFrac]);
|
||||||
relaxation_factor = std::min(relaxation_factor, relaxation_factor_g);
|
relaxation_factor = std::min(relaxation_factor, relaxation_factor_g);
|
||||||
}
|
}
|
||||||
@ -654,7 +653,7 @@ relaxationFactorFractionsProducer(const std::vector<double>& primary_variables,
|
|||||||
if constexpr (has_wfrac_variable && has_gfrac_variable) {
|
if constexpr (has_wfrac_variable && has_gfrac_variable) {
|
||||||
// We need to make sure the even with the relaxation_factor, the sum of F_w and F_g is below one, so there will
|
// We need to make sure the even with the relaxation_factor, the sum of F_w and F_g is below one, so there will
|
||||||
// not be negative oil fraction later
|
// not be negative oil fraction later
|
||||||
const double original_sum = primary_variables[WFrac] + primary_variables[GFrac];
|
const double original_sum = value_[WFrac] + value_[GFrac];
|
||||||
const double relaxed_update = (dwells[0][WFrac] + dwells[0][GFrac]) * relaxation_factor;
|
const double relaxed_update = (dwells[0][WFrac] + dwells[0][GFrac]) * relaxation_factor;
|
||||||
const double possible_updated_sum = original_sum - relaxed_update;
|
const double possible_updated_sum = original_sum - relaxed_update;
|
||||||
// We only relax if fraction is above 1.
|
// We only relax if fraction is above 1.
|
||||||
|
@ -137,8 +137,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
//! \brief Calculate a relaxation factor for producers.
|
//! \brief Calculate a relaxation factor for producers.
|
||||||
//! \details To avoid overshoot of the fractions which might result in negative rates.
|
//! \details To avoid overshoot of the fractions which might result in negative rates.
|
||||||
double relaxationFactorFractionsProducer(const std::vector<double>& primary_variables,
|
double relaxationFactorFractionsProducer(const BVectorWell& dwells) const;
|
||||||
const BVectorWell& dwells) const;
|
|
||||||
|
|
||||||
//! \brief Returns volume fraction for a component.
|
//! \brief Returns volume fraction for a component.
|
||||||
EvalWell volumeFraction(const unsigned compIdx) const;
|
EvalWell volumeFraction(const unsigned compIdx) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user