mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
blackoilnewtonmethod.hh: rename to blackoilnewtonmethod.hpp
This commit is contained in:
parent
3a5d527417
commit
ae1a1ce57e
@ -553,8 +553,8 @@ list (APPEND PUBLIC_HEADER_FILES
|
|||||||
opm/models/blackoil/blackoilmicpmodules.hh
|
opm/models/blackoil/blackoilmicpmodules.hh
|
||||||
opm/models/blackoil/blackoilmicpparams.hpp
|
opm/models/blackoil/blackoilmicpparams.hpp
|
||||||
opm/models/blackoil/blackoilmodel.hh
|
opm/models/blackoil/blackoilmodel.hh
|
||||||
opm/models/blackoil/blackoilnewtonmethod.hh
|
opm/models/blackoil/blackoilnewtonmethod.hpp
|
||||||
opm/models/blackoil/blackoilnewtonmethodparameters.hh
|
opm/models/blackoil/blackoilnewtonmethodparameters.hpp
|
||||||
opm/models/blackoil/blackoilonephaseindices.hh
|
opm/models/blackoil/blackoilonephaseindices.hh
|
||||||
opm/models/blackoil/blackoilpolymermodules.hh
|
opm/models/blackoil/blackoilpolymermodules.hh
|
||||||
opm/models/blackoil/blackoilpolymerparams.hpp
|
opm/models/blackoil/blackoilpolymerparams.hpp
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include <opm/common/Exceptions.hpp>
|
#include <opm/common/Exceptions.hpp>
|
||||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||||
|
|
||||||
#include <opm/models/blackoil/blackoilnewtonmethod.hh>
|
#include <opm/models/blackoil/blackoilnewtonmethod.hpp>
|
||||||
#include <opm/models/utils/signum.hh>
|
#include <opm/models/utils/signum.hh>
|
||||||
|
|
||||||
namespace Opm::Parameters {
|
namespace Opm::Parameters {
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
*
|
*
|
||||||
* \copydoc Opm::BlackOilModel
|
* \copydoc Opm::BlackOilModel
|
||||||
*/
|
*/
|
||||||
#ifndef EWOMS_BLACK_OIL_MODEL_HH
|
#ifndef OPM_BLACK_OIL_MODEL_HPP
|
||||||
#define EWOMS_BLACK_OIL_MODEL_HH
|
#define OPM_BLACK_OIL_MODEL_HPP
|
||||||
|
|
||||||
#include <opm/material/densead/Math.hpp>
|
#include <opm/material/densead/Math.hpp>
|
||||||
|
|
||||||
@ -44,7 +44,7 @@
|
|||||||
#include <opm/models/blackoil/blackoilintensivequantities.hh>
|
#include <opm/models/blackoil/blackoilintensivequantities.hh>
|
||||||
#include <opm/models/blackoil/blackoillocalresidual.hh>
|
#include <opm/models/blackoil/blackoillocalresidual.hh>
|
||||||
#include <opm/models/blackoil/blackoilmicpmodules.hh>
|
#include <opm/models/blackoil/blackoilmicpmodules.hh>
|
||||||
#include <opm/models/blackoil/blackoilnewtonmethod.hh>
|
#include <opm/models/blackoil/blackoilnewtonmethod.hpp>
|
||||||
#include <opm/models/blackoil/blackoilpolymermodules.hh>
|
#include <opm/models/blackoil/blackoilpolymermodules.hh>
|
||||||
#include <opm/models/blackoil/blackoilprimaryvariables.hh>
|
#include <opm/models/blackoil/blackoilprimaryvariables.hh>
|
||||||
#include <opm/models/blackoil/blackoilproblem.hh>
|
#include <opm/models/blackoil/blackoilproblem.hh>
|
||||||
@ -606,7 +606,6 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector<Scalar> eqWeights_;
|
std::vector<Scalar> eqWeights_;
|
||||||
Implementation& asImp_()
|
Implementation& asImp_()
|
||||||
{ return *static_cast<Implementation*>(this); }
|
{ return *static_cast<Implementation*>(this); }
|
||||||
@ -623,6 +622,7 @@ private:
|
|||||||
priVars.setPvtRegionIndex(regionIdx);
|
priVars.setPvtRegionIndex(regionIdx);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|
||||||
#endif
|
#endif // OPM_BLACK_OIL_MODEL_HPP
|
||||||
|
@ -25,17 +25,18 @@
|
|||||||
*
|
*
|
||||||
* \copydoc Opm::BlackOilNewtonMethod
|
* \copydoc Opm::BlackOilNewtonMethod
|
||||||
*/
|
*/
|
||||||
#ifndef EWOMS_BLACK_OIL_NEWTON_METHOD_HH
|
#ifndef OPM_BLACK_OIL_NEWTON_METHOD_HPP
|
||||||
#define EWOMS_BLACK_OIL_NEWTON_METHOD_HH
|
#define OPM_BLACK_OIL_NEWTON_METHOD_HPP
|
||||||
|
|
||||||
#include <opm/models/blackoil/blackoilnewtonmethodparameters.hh>
|
|
||||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
|
||||||
|
|
||||||
#include <opm/common/Exceptions.hpp>
|
#include <opm/common/Exceptions.hpp>
|
||||||
|
|
||||||
#include <opm/models/utils/signum.hh>
|
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||||
|
#include <opm/models/blackoil/blackoilmicpmodules.hh>
|
||||||
|
#include <opm/models/blackoil/blackoilnewtonmethodparameters.hpp>
|
||||||
|
|
||||||
#include <opm/models/nonlinear/newtonmethod.hh>
|
#include <opm/models/nonlinear/newtonmethod.hh>
|
||||||
#include "blackoilmicpmodules.hh"
|
|
||||||
|
#include <opm/models/utils/signum.hh>
|
||||||
|
|
||||||
namespace Opm::Properties {
|
namespace Opm::Properties {
|
||||||
|
|
||||||
@ -92,12 +93,11 @@ public:
|
|||||||
{
|
{
|
||||||
ParentType::finishInit();
|
ParentType::finishInit();
|
||||||
|
|
||||||
wasSwitched_.resize(this->model().numTotalDof());
|
wasSwitched_.resize(this->model().numTotalDof(), false);
|
||||||
std::fill(wasSwitched_.begin(), wasSwitched_.end(), false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Register all run-time parameters for the immiscible model.
|
* \brief Register all run-time parameters for the blackoil newton method.
|
||||||
*/
|
*/
|
||||||
static void registerParameters()
|
static void registerParameters()
|
||||||
{
|
{
|
||||||
@ -193,8 +193,9 @@ public:
|
|||||||
}
|
}
|
||||||
succeeded = comm.min(succeeded);
|
succeeded = comm.min(succeeded);
|
||||||
|
|
||||||
if (!succeeded)
|
if (!succeeded) {
|
||||||
throw NumericalProblem("A process did not succeed in adapting the primary variables");
|
throw NumericalProblem("A process did not succeed in adapting the primary variables");
|
||||||
|
}
|
||||||
|
|
||||||
numPriVarsSwitched_ = comm.sum(numPriVarsSwitched_);
|
numPriVarsSwitched_ = comm.sum(numPriVarsSwitched_);
|
||||||
}
|
}
|
||||||
@ -285,17 +286,20 @@ protected:
|
|||||||
|
|
||||||
// limit pressure delta
|
// limit pressure delta
|
||||||
if (pvIdx == Indices::pressureSwitchIdx) {
|
if (pvIdx == Indices::pressureSwitchIdx) {
|
||||||
if (std::abs(delta) > dpMaxRel_*currentValue[pvIdx])
|
if (std::abs(delta) > params_.dpMaxRel_ * currentValue[pvIdx]) {
|
||||||
delta = signum(delta)*dpMaxRel_*currentValue[pvIdx];
|
delta = signum(delta) * params_.dpMaxRel_ * currentValue[pvIdx];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// water saturation delta
|
// water saturation delta
|
||||||
else if (pvIdx == Indices::waterSwitchIdx)
|
else if (pvIdx == Indices::waterSwitchIdx)
|
||||||
if (currentValue.primaryVarsMeaningWater() == PrimaryVariables::WaterMeaning::Sw)
|
if (currentValue.primaryVarsMeaningWater() == PrimaryVariables::WaterMeaning::Sw) {
|
||||||
delta *= satAlpha;
|
delta *= satAlpha;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
//Ensure Rvw and Rsw factor does not become negative
|
//Ensure Rvw and Rsw factor does not become negative
|
||||||
if (delta > currentValue[ Indices::waterSwitchIdx])
|
if (delta > currentValue[ Indices::waterSwitchIdx]) {
|
||||||
delta = currentValue[ Indices::waterSwitchIdx];
|
delta = currentValue[ Indices::waterSwitchIdx];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (pvIdx == Indices::compositionSwitchIdx) {
|
else if (pvIdx == Indices::compositionSwitchIdx) {
|
||||||
// the switching primary variable for composition is tricky because the
|
// the switching primary variable for composition is tricky because the
|
||||||
@ -303,8 +307,9 @@ protected:
|
|||||||
// interpretation since it can represent Sg, Rs or Rv. For now, we only
|
// interpretation since it can represent Sg, Rs or Rv. For now, we only
|
||||||
// limit saturation deltas and ensure that the R factors do not become
|
// limit saturation deltas and ensure that the R factors do not become
|
||||||
// negative.
|
// negative.
|
||||||
if (currentValue.primaryVarsMeaningGas() == PrimaryVariables::GasMeaning::Sg)
|
if (currentValue.primaryVarsMeaningGas() == PrimaryVariables::GasMeaning::Sg) {
|
||||||
delta *= satAlpha;
|
delta *= satAlpha;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
//Ensure Rv and Rs factor does not become negative
|
//Ensure Rv and Rs factor does not become negative
|
||||||
if (delta > currentValue[Indices::compositionSwitchIdx])
|
if (delta > currentValue[Indices::compositionSwitchIdx])
|
||||||
@ -351,36 +356,43 @@ protected:
|
|||||||
|
|
||||||
// keep the solvent saturation between 0 and 1
|
// keep the solvent saturation between 0 and 1
|
||||||
if (enableSolvent && pvIdx == Indices::solventSaturationIdx) {
|
if (enableSolvent && pvIdx == Indices::solventSaturationIdx) {
|
||||||
if (currentValue.primaryVarsMeaningSolvent() == PrimaryVariables::SolventMeaning::Ss )
|
if (currentValue.primaryVarsMeaningSolvent() == PrimaryVariables::SolventMeaning::Ss) {
|
||||||
nextValue[pvIdx] = std::min(std::max(nextValue[pvIdx], Scalar{0.0}), Scalar{1.0});
|
nextValue[pvIdx] = std::min(std::max(nextValue[pvIdx], Scalar{0.0}), Scalar{1.0});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep the z fraction between 0 and 1
|
// keep the z fraction between 0 and 1
|
||||||
if (enableExtbo && pvIdx == Indices::zFractionIdx)
|
if (enableExtbo && pvIdx == Indices::zFractionIdx) {
|
||||||
nextValue[pvIdx] = std::min(std::max(nextValue[pvIdx], Scalar{0.0}), Scalar{1.0});
|
nextValue[pvIdx] = std::min(std::max(nextValue[pvIdx], Scalar{0.0}), Scalar{1.0});
|
||||||
|
}
|
||||||
|
|
||||||
// keep the polymer concentration above 0
|
// keep the polymer concentration above 0
|
||||||
if (enablePolymer && pvIdx == Indices::polymerConcentrationIdx)
|
if (enablePolymer && pvIdx == Indices::polymerConcentrationIdx) {
|
||||||
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
||||||
|
}
|
||||||
|
|
||||||
if (enablePolymerWeight && pvIdx == Indices::polymerMoleWeightIdx) {
|
if (enablePolymerWeight && pvIdx == Indices::polymerMoleWeightIdx) {
|
||||||
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
||||||
const double polymerConcentration = nextValue[Indices::polymerConcentrationIdx];
|
const double polymerConcentration = nextValue[Indices::polymerConcentrationIdx];
|
||||||
if (polymerConcentration < 1.e-10)
|
if (polymerConcentration < 1.e-10) {
|
||||||
nextValue[pvIdx] = 0.0;
|
nextValue[pvIdx] = 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep the foam concentration above 0
|
// keep the foam concentration above 0
|
||||||
if (enableFoam && pvIdx == Indices::foamConcentrationIdx)
|
if (enableFoam && pvIdx == Indices::foamConcentrationIdx) {
|
||||||
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
||||||
|
}
|
||||||
|
|
||||||
if (enableBrine && pvIdx == Indices::saltConcentrationIdx) {
|
if (enableBrine && pvIdx == Indices::saltConcentrationIdx) {
|
||||||
// keep the salt concentration above 0
|
// keep the salt concentration above 0
|
||||||
if (!enableSaltPrecipitation || (enableSaltPrecipitation && currentValue.primaryVarsMeaningBrine() == PrimaryVariables::BrineMeaning::Cs))
|
if (!enableSaltPrecipitation || (enableSaltPrecipitation && currentValue.primaryVarsMeaningBrine() == PrimaryVariables::BrineMeaning::Cs)) {
|
||||||
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
||||||
|
}
|
||||||
// keep the salt saturation below upperlimit
|
// keep the salt saturation below upperlimit
|
||||||
if ((enableSaltPrecipitation && currentValue.primaryVarsMeaningBrine() == PrimaryVariables::BrineMeaning::Sp))
|
if ((enableSaltPrecipitation && currentValue.primaryVarsMeaningBrine() == PrimaryVariables::BrineMeaning::Sp)) {
|
||||||
nextValue[pvIdx] = std::min(nextValue[pvIdx], Scalar{1.0-1.e-8});
|
nextValue[pvIdx] = std::min(nextValue[pvIdx], Scalar{1.0-1.e-8});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep the temperature within given values
|
// keep the temperature within given values
|
||||||
@ -397,16 +409,21 @@ protected:
|
|||||||
// For the oxygen and urea we set this value to the maximum injected
|
// For the oxygen and urea we set this value to the maximum injected
|
||||||
// concentration (the urea concentration has been scaled by 10). For
|
// concentration (the urea concentration has been scaled by 10). For
|
||||||
// the biofilm and calcite, we set this value equal to the porosity minus the clogging tolerance.
|
// the biofilm and calcite, we set this value equal to the porosity minus the clogging tolerance.
|
||||||
if (enableMICP && pvIdx == Indices::microbialConcentrationIdx)
|
if (enableMICP && pvIdx == Indices::microbialConcentrationIdx) {
|
||||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::densityBiofilm());
|
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::densityBiofilm());
|
||||||
if (enableMICP && pvIdx == Indices::oxygenConcentrationIdx)
|
}
|
||||||
|
if (enableMICP && pvIdx == Indices::oxygenConcentrationIdx) {
|
||||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::maximumOxygenConcentration());
|
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::maximumOxygenConcentration());
|
||||||
if (enableMICP && pvIdx == Indices::ureaConcentrationIdx)
|
}
|
||||||
|
if (enableMICP && pvIdx == Indices::ureaConcentrationIdx) {
|
||||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::maximumUreaConcentration());
|
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::maximumUreaConcentration());
|
||||||
if (enableMICP && pvIdx == Indices::biofilmConcentrationIdx)
|
}
|
||||||
|
if (enableMICP && pvIdx == Indices::biofilmConcentrationIdx) {
|
||||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::phi()[globalDofIdx] - MICPModule::toleranceBeforeClogging());
|
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::phi()[globalDofIdx] - MICPModule::toleranceBeforeClogging());
|
||||||
if (enableMICP && pvIdx == Indices::calciteConcentrationIdx)
|
}
|
||||||
|
if (enableMICP && pvIdx == Indices::calciteConcentrationIdx) {
|
||||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::phi()[globalDofIdx] - MICPModule::toleranceBeforeClogging());
|
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::phi()[globalDofIdx] - MICPModule::toleranceBeforeClogging());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch the new primary variables to something which is physically meaningful.
|
// switch the new primary variables to something which is physically meaningful.
|
||||||
@ -449,4 +466,4 @@ private:
|
|||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|
||||||
#endif
|
#endif // OPM_BLACK_OIL_NEWTHON_METHOD_HPP
|
Loading…
Reference in New Issue
Block a user