mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #5989 from akva2/simplify_doAllocBuffers
Simplify GenericOutputBlackoilModule::doAllocBuffers
This commit is contained in:
commit
8a69818ba5
@ -27,9 +27,9 @@
|
|||||||
|
|
||||||
#include <opm/grid/common/CommunicationUtils.hpp>
|
#include <opm/grid/common/CommunicationUtils.hpp>
|
||||||
|
|
||||||
|
#include <opm/material/fluidmatrixinteractions/EclHysteresisConfig.hpp>
|
||||||
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
||||||
#include <opm/material/fluidsystems/BlackOilDefaultIndexTraits.hpp>
|
#include <opm/material/fluidsystems/BlackOilDefaultIndexTraits.hpp>
|
||||||
|
|
||||||
#include <opm/material/fluidsystems/GenericOilGasWaterFluidSystem.hpp>
|
#include <opm/material/fluidsystems/GenericOilGasWaterFluidSystem.hpp>
|
||||||
|
|
||||||
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
||||||
@ -55,7 +55,6 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <stdexcept>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
@ -752,10 +751,7 @@ doAllocBuffers(const unsigned bufferSize,
|
|||||||
const bool substep,
|
const bool substep,
|
||||||
const bool log,
|
const bool log,
|
||||||
const bool isRestart,
|
const bool isRestart,
|
||||||
const bool vapparsActive,
|
const EclHysteresisConfig* hysteresisConfig,
|
||||||
const bool enablePCHysteresis,
|
|
||||||
const bool enableNonWettingHysteresis,
|
|
||||||
const bool enableWettingHysteresis,
|
|
||||||
const unsigned numOutputNnc,
|
const unsigned numOutputNnc,
|
||||||
std::map<std::string, int> rstKeywords)
|
std::map<std::string, int> rstKeywords)
|
||||||
{
|
{
|
||||||
@ -953,11 +949,13 @@ doAllocBuffers(const unsigned bufferSize,
|
|||||||
this->micpC_.allocate(bufferSize);
|
this->micpC_.allocate(bufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool vapparsActive = schedule_[std::max(reportStepNum, 0u)].oilvap().getType() ==
|
||||||
|
OilVaporizationProperties::OilVaporization::VAPPARS;
|
||||||
if (vapparsActive) {
|
if (vapparsActive) {
|
||||||
soMax_.resize(bufferSize, 0.0);
|
soMax_.resize(bufferSize, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableNonWettingHysteresis) {
|
if (hysteresisConfig && hysteresisConfig->enableNonWettingHysteresis()) {
|
||||||
if (FluidSystem::phaseIsActive(oilPhaseIdx)){
|
if (FluidSystem::phaseIsActive(oilPhaseIdx)){
|
||||||
if (FluidSystem::phaseIsActive(waterPhaseIdx)){
|
if (FluidSystem::phaseIsActive(waterPhaseIdx)){
|
||||||
soMax_.resize(bufferSize, 0.0);
|
soMax_.resize(bufferSize, 0.0);
|
||||||
@ -969,7 +967,7 @@ doAllocBuffers(const unsigned bufferSize,
|
|||||||
//TODO add support for gas-water
|
//TODO add support for gas-water
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (enableWettingHysteresis) {
|
if (hysteresisConfig && hysteresisConfig->enableWettingHysteresis()) {
|
||||||
if (FluidSystem::phaseIsActive(oilPhaseIdx)){
|
if (FluidSystem::phaseIsActive(oilPhaseIdx)){
|
||||||
if (FluidSystem::phaseIsActive(waterPhaseIdx)){
|
if (FluidSystem::phaseIsActive(waterPhaseIdx)){
|
||||||
swMax_.resize(bufferSize, 0.0);
|
swMax_.resize(bufferSize, 0.0);
|
||||||
@ -981,7 +979,7 @@ doAllocBuffers(const unsigned bufferSize,
|
|||||||
//TODO add support for gas-water
|
//TODO add support for gas-water
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (enablePCHysteresis) {
|
if (hysteresisConfig && hysteresisConfig->enablePCHysteresis()) {
|
||||||
if (FluidSystem::phaseIsActive(oilPhaseIdx)){
|
if (FluidSystem::phaseIsActive(oilPhaseIdx)){
|
||||||
if (FluidSystem::phaseIsActive(waterPhaseIdx)){
|
if (FluidSystem::phaseIsActive(waterPhaseIdx)){
|
||||||
swmin_.resize(bufferSize, 0.0);
|
swmin_.resize(bufferSize, 0.0);
|
||||||
|
@ -63,6 +63,7 @@ struct ForceDisableResvFluidInPlaceOutput { static constexpr bool value = false;
|
|||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
namespace data { class Solution; }
|
namespace data { class Solution; }
|
||||||
|
class EclHysteresisConfig;
|
||||||
class EclipseState;
|
class EclipseState;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class SummaryConfig;
|
class SummaryConfig;
|
||||||
@ -327,10 +328,7 @@ protected:
|
|||||||
const bool substep,
|
const bool substep,
|
||||||
const bool log,
|
const bool log,
|
||||||
const bool isRestart,
|
const bool isRestart,
|
||||||
const bool vapparsActive = false,
|
const EclHysteresisConfig* hysteresisConfig,
|
||||||
const bool enablePCHysteresis = false,
|
|
||||||
const bool enableNonWettingHysteresis = false,
|
|
||||||
const bool enableWettingHysteresis = false,
|
|
||||||
unsigned numOutputNnc = 0,
|
unsigned numOutputNnc = 0,
|
||||||
std::map<std::string, int> rstKeywords = {});
|
std::map<std::string, int> rstKeywords = {});
|
||||||
|
|
||||||
|
@ -184,10 +184,7 @@ public:
|
|||||||
substep,
|
substep,
|
||||||
log,
|
log,
|
||||||
isRestart,
|
isRestart,
|
||||||
problem.vapparsActive(std::max(simulator_.episodeIndex(), 0)),
|
&problem.materialLawManager()->hysteresisConfig(),
|
||||||
problem.materialLawManager()->enablePCHysteresis(),
|
|
||||||
problem.materialLawManager()->enableNonWettingHysteresis(),
|
|
||||||
problem.materialLawManager()->enableWettingHysteresis(),
|
|
||||||
problem.eclWriter()->getOutputNnc().size());
|
problem.eclWriter()->getOutputNnc().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,7 +512,7 @@ public:
|
|||||||
|
|
||||||
const auto& matLawManager = problem.materialLawManager();
|
const auto& matLawManager = problem.materialLawManager();
|
||||||
if (matLawManager->enableHysteresis()) {
|
if (matLawManager->enableHysteresis()) {
|
||||||
if (FluidSystem::phaseIsActive(oilPhaseIdx)
|
if (FluidSystem::phaseIsActive(oilPhaseIdx)
|
||||||
&& FluidSystem::phaseIsActive(waterPhaseIdx)) {
|
&& FluidSystem::phaseIsActive(waterPhaseIdx)) {
|
||||||
Scalar somax;
|
Scalar somax;
|
||||||
Scalar swmax;
|
Scalar swmax;
|
||||||
@ -523,7 +520,7 @@ public:
|
|||||||
|
|
||||||
matLawManager->oilWaterHysteresisParams(
|
matLawManager->oilWaterHysteresisParams(
|
||||||
somax, swmax, swmin, globalDofIdx);
|
somax, swmax, swmin, globalDofIdx);
|
||||||
|
|
||||||
if (matLawManager->enableNonWettingHysteresis()) {
|
if (matLawManager->enableNonWettingHysteresis()) {
|
||||||
if (!this->soMax_.empty()) {
|
if (!this->soMax_.empty()) {
|
||||||
this->soMax_[globalDofIdx] = somax;
|
this->soMax_[globalDofIdx] = somax;
|
||||||
@ -541,14 +538,14 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FluidSystem::phaseIsActive(oilPhaseIdx)
|
if (FluidSystem::phaseIsActive(oilPhaseIdx)
|
||||||
&& FluidSystem::phaseIsActive(gasPhaseIdx)) {
|
&& FluidSystem::phaseIsActive(gasPhaseIdx)) {
|
||||||
Scalar sgmax;
|
Scalar sgmax;
|
||||||
Scalar shmax;
|
Scalar shmax;
|
||||||
Scalar somin;
|
Scalar somin;
|
||||||
matLawManager->gasOilHysteresisParams(
|
matLawManager->gasOilHysteresisParams(
|
||||||
sgmax, shmax, somin, globalDofIdx);
|
sgmax, shmax, somin, globalDofIdx);
|
||||||
|
|
||||||
if (matLawManager->enableNonWettingHysteresis()) {
|
if (matLawManager->enableNonWettingHysteresis()) {
|
||||||
if (!this->sgmax_.empty()) {
|
if (!this->sgmax_.empty()) {
|
||||||
this->sgmax_[globalDofIdx] = sgmax;
|
this->sgmax_[globalDofIdx] = sgmax;
|
||||||
@ -566,7 +563,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!this->soMax_.empty())
|
if (!this->soMax_.empty())
|
||||||
this->soMax_[globalDofIdx]
|
this->soMax_[globalDofIdx]
|
||||||
= std::max(getValue(fs.saturation(oilPhaseIdx)), problem.maxOilSaturation(globalDofIdx));
|
= std::max(getValue(fs.saturation(oilPhaseIdx)), problem.maxOilSaturation(globalDofIdx));
|
||||||
@ -1163,7 +1160,7 @@ public:
|
|||||||
if (simulator.problem().materialLawManager()->enableHysteresis()) {
|
if (simulator.problem().materialLawManager()->enableHysteresis()) {
|
||||||
auto matLawManager = simulator.problem().materialLawManager();
|
auto matLawManager = simulator.problem().materialLawManager();
|
||||||
|
|
||||||
if (FluidSystem::phaseIsActive(oilPhaseIdx)
|
if (FluidSystem::phaseIsActive(oilPhaseIdx)
|
||||||
&& FluidSystem::phaseIsActive(waterPhaseIdx)) {
|
&& FluidSystem::phaseIsActive(waterPhaseIdx)) {
|
||||||
Scalar somax = 2.0;
|
Scalar somax = 2.0;
|
||||||
Scalar swmax = -2.0;
|
Scalar swmax = -2.0;
|
||||||
@ -1187,7 +1184,7 @@ public:
|
|||||||
matLawManager->setOilWaterHysteresisParams(
|
matLawManager->setOilWaterHysteresisParams(
|
||||||
somax, swmax, swmin, elemIdx);
|
somax, swmax, swmin, elemIdx);
|
||||||
}
|
}
|
||||||
if (FluidSystem::phaseIsActive(oilPhaseIdx)
|
if (FluidSystem::phaseIsActive(oilPhaseIdx)
|
||||||
&& FluidSystem::phaseIsActive(gasPhaseIdx)) {
|
&& FluidSystem::phaseIsActive(gasPhaseIdx)) {
|
||||||
Scalar sgmax = 2.0;
|
Scalar sgmax = 2.0;
|
||||||
Scalar shmax = -2.0;
|
Scalar shmax = -2.0;
|
||||||
@ -1525,7 +1522,7 @@ private:
|
|||||||
{
|
{
|
||||||
this->updateCO2InGas(globalDofIdx, pv, intQuants);
|
this->updateCO2InGas(globalDofIdx, pv, intQuants);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->fipC_.hasCo2InWater() &&
|
if (this->fipC_.hasCo2InWater() &&
|
||||||
(FluidSystem::phaseIsActive(waterPhaseIdx) ||
|
(FluidSystem::phaseIsActive(waterPhaseIdx) ||
|
||||||
FluidSystem::phaseIsActive(oilPhaseIdx)))
|
FluidSystem::phaseIsActive(oilPhaseIdx)))
|
||||||
|
@ -162,10 +162,7 @@ public:
|
|||||||
this->compC_.allocate(bufferSize, rstKeywords);
|
this->compC_.allocate(bufferSize, rstKeywords);
|
||||||
|
|
||||||
this->doAllocBuffers(bufferSize, reportStepNum, substep, log, isRestart,
|
this->doAllocBuffers(bufferSize, reportStepNum, substep, log, isRestart,
|
||||||
/* vapparsActive =*/ false,
|
/* hysteresisConfig = */ nullptr,
|
||||||
/* enablePCHysteresis = */ false,
|
|
||||||
/* enableNonWettingHysteresis =*/ false,
|
|
||||||
/* enableWettingHysteresis =*/ false,
|
|
||||||
/* numOutputNnc =*/ 0,
|
/* numOutputNnc =*/ 0,
|
||||||
std::move(rstKeywords));
|
std::move(rstKeywords));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user