solvent + foam simulator

This commit is contained in:
Tor Harald Sandve 2023-05-02 15:41:07 +02:00
parent cf169167d0
commit 1592ef8bd2
23 changed files with 178 additions and 18 deletions

View File

@ -428,7 +428,7 @@ add_dependencies(moduleVersion opmsimulators)
set(FLOW_MODELS blackoil brine energy extbo foam gasoil gaswater
oilwater oilwater_brine gaswater_brine oilwater_polymer
oilwater_polymer_injectivity micp polymer solvent
oilwater_polymer_injectivity micp polymer solvent solvent_foam
gasoil_energy brine_saltprecipitation
gaswater_saltprec_vapwat gaswater_saltprec_energy brine_precsalt_vapwat
blackoil_legacyassembly gasoildiffuse gaswater_dissolution

View File

@ -0,0 +1,65 @@
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <flow/flow_ebos_solvent_foam.hpp>
#include <opm/material/common/ResetLocale.hpp>
#include <opm/grid/CpGrid.hpp>
#include <opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp>
#include <opm/simulators/flow/Main.hpp>
namespace Opm {
namespace Properties {
namespace TTag {
struct EclFlowSolventFoamProblem {
using InheritsFrom = std::tuple<EclFlowProblem>;
};
}
template<class TypeTag>
struct EnableSolvent<TypeTag, TTag::EclFlowSolventFoamProblem> {
static constexpr bool value = true;
};
template<class TypeTag>
struct EnableFoam<TypeTag, TTag::EclFlowSolventFoamProblem> {
static constexpr bool value = true;
};
}}
namespace Opm {
// ----------------- Main program -----------------
int flowEbosSolventFoamMain(int argc, char** argv, bool outputCout, bool outputFiles)
{
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
resetLocale();
FlowMainEbos<Properties::TTag::EclFlowSolventFoamProblem>
mainfunc {argc, argv, outputCout, outputFiles};
return mainfunc.execute();
}
int flowEbosSolventFoamMainStandalone(int argc, char** argv)
{
using TypeTag = Properties::TTag::EclFlowSolventFoamProblem;
auto mainObject = Opm::Main(argc, argv);
return mainObject.runStatic<TypeTag>();
}
}

View File

@ -0,0 +1,30 @@
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FLOW_EBOS_SOLVENT_FOAM_HPP
#define FLOW_EBOS_SOLVENT_FOAM_HPP
namespace Opm {
//! \brief Main function used in flow binary.
int flowEbosSolventFoamMain(int argc, char** argv, bool outoutCout, bool outputFiles);
//! \brief Main function used in flow_solvent_foam binary.
int flowEbosSolventFoamMainStandalone(int argc, char** argv);
}
#endif // FLOW_EBOS_SOLVENT_FOAM_HPP

View File

@ -0,0 +1,24 @@
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <flow/flow_ebos_solvent_foam.hpp>
int main(int argc, char** argv)
{
return Opm::flowEbosSolventFoamMainStandalone(argc, argv);
}

View File

@ -31,6 +31,7 @@
#include <flow/flow_ebos_oilwater.hpp>
#include <flow/flow_ebos_gaswater.hpp>
#include <flow/flow_ebos_solvent.hpp>
#include <flow/flow_ebos_solvent_foam.hpp>
#include <flow/flow_ebos_polymer.hpp>
#include <flow/flow_ebos_extbo.hpp>
#include <flow/flow_ebos_foam.hpp>
@ -222,20 +223,20 @@ private:
}
// Foam case
else if (phases.active(Phase::FOAM)) {
else if (phases.active(Phase::FOAM) && !phases.active(Phase::SOLVENT)) {
return this->runFoam();
}
// Solvent case
else if (phases.active(Phase::SOLVENT)) {
return this->runSolvent(phases);
}
// Brine case
else if (phases.active(Phase::BRINE) && !thermal) {
return this->runBrine(phases);
}
// Solvent case
else if (phases.active(Phase::SOLVENT)) {
return this->runSolvent();
}
// Extended BO case
else if (phases.active(Phase::ZFRACTION)) {
return this->runExtendedBlackOil();
@ -586,8 +587,11 @@ private:
return EXIT_FAILURE;
}
int runSolvent()
int runSolvent(const Phases& phases)
{
if (phases.active(Phase::FOAM)) {
return flowEbosSolventFoamMain(argc_, argv_, outputCout_, outputFiles_);
}
return flowEbosSolventMain(argc_, argv_, outputCout_, outputFiles_);
}

View File

@ -76,7 +76,6 @@ partiallySupported()
{
"FOAMOPTS",
{
{1,{true, allow_values<std::string> {"GAS"}, "FOAMOPTS(FOAMOPT1): only the default option of GAS is supported"}}, // TRANSPORT_PHASE
{2,{true, allow_values<std::string> {"TAB"}, "FOAMOPTS(FOAMOPT2): only the default option of TAB is supported"}}, // MODEL
},
},

View File

@ -368,5 +368,5 @@ INSTANCE(BlackOilIndices<0u,1u,0u,0u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,1u,0u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
}

View File

@ -520,4 +520,5 @@ INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,1u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
} // namespace Opm

View File

@ -646,4 +646,6 @@ INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,1u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,true,2u,0u>)
INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
}

View File

@ -786,4 +786,6 @@ INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,1u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
} // namespace Opm

View File

@ -283,5 +283,6 @@ INSTANCE(9u, BlackOilIndices<0u,0u,0u,1u,false,false,0u,0u>)
INSTANCE(10u, BlackOilIndices<1u,0u,0u,0u,false,false,0u,0u>)
INSTANCE(10u, BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
INSTANCE(10u, BlackOilIndices<0u,0u,0u,1u,false,false,1u,0u>)
INSTANCE(11u, BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
}

View File

@ -569,4 +569,6 @@ INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,1u,0u>)
INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
}

View File

@ -232,4 +232,6 @@ INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,1u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
}

View File

@ -743,4 +743,6 @@ INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,1u,0u>)
INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
}

View File

@ -763,8 +763,26 @@ namespace Opm
if constexpr (has_foam) {
// TODO: the application of well efficiency factor has not been tested with an example yet
const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
EvalWell cq_s_foam = cq_s[gasCompIdx] * this->well_efficiency_factor_;
auto getFoamTransportIdx = [&deferred_logger] {
switch (FoamModule::transportPhase()) {
case Phase::WATER: {
return Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
}
case Phase::GAS: {
return Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
}
case Phase::SOLVENT: {
if constexpr (has_solvent)
return (unsigned)Indices::contiSolventEqIdx;
else
OPM_DEFLOG_THROW(std::runtime_error, "Foam transport phase is SOLVENT but SOLVENT is not activated.", deferred_logger);
}
default: {
OPM_DEFLOG_THROW(std::runtime_error, "Foam transport phase must be GAS/WATER/SOLVENT.", deferred_logger);
}
}
};
EvalWell cq_s_foam = cq_s[getFoamTransportIdx()] * this->well_efficiency_factor_;
if (this->isInjector()) {
cq_s_foam *= this->wfoam();
} else {

View File

@ -269,6 +269,7 @@ INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,6,0>)
INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,7,0>)
INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,8,0>)
INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,9,0>)
INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,10,0>)
INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,-1,4>)
INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,-1,5>)
INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,-1,6>)
@ -276,7 +277,7 @@ INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,-1,7>)
INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,-1,8>)
INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,-1,9>)
INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,-1,10>)
INSTANCE_TARGET_CALCULATOR(DenseAd::Evaluation<double,-1,11>)
} // namespace WellGroupHelpers

View File

@ -648,6 +648,7 @@ INSTANCE(DenseAd::Evaluation<double, -1, 7u>)
INSTANCE(DenseAd::Evaluation<double, -1, 8u>)
INSTANCE(DenseAd::Evaluation<double, -1, 9u>)
INSTANCE(DenseAd::Evaluation<double, -1, 10u>)
INSTANCE(DenseAd::Evaluation<double, -1, 11u>)
INSTANCE(DenseAd::Evaluation<double, 3, 0u>)
INSTANCE(DenseAd::Evaluation<double, 4, 0u>)
INSTANCE(DenseAd::Evaluation<double, 5, 0u>)
@ -655,7 +656,7 @@ INSTANCE(DenseAd::Evaluation<double, 6, 0u>)
INSTANCE(DenseAd::Evaluation<double, 7, 0u>)
INSTANCE(DenseAd::Evaluation<double, 8, 0u>)
INSTANCE(DenseAd::Evaluation<double, 9, 0u>)
INSTANCE(DenseAd::Evaluation<double, 10, 0u>)
} // namespace detail
} // namespace Opm

View File

@ -130,6 +130,7 @@ INSTANCE(DenseAd::Evaluation<double, -1, 7u>)
INSTANCE(DenseAd::Evaluation<double, -1, 8u>)
INSTANCE(DenseAd::Evaluation<double, -1, 9u>)
INSTANCE(DenseAd::Evaluation<double, -1, 10u>)
INSTANCE(DenseAd::Evaluation<double, -1, 11u>)
INSTANCE(DenseAd::Evaluation<double, 3, 0u>)
INSTANCE(DenseAd::Evaluation<double, 4, 0u>)
INSTANCE(DenseAd::Evaluation<double, 5, 0u>)
@ -137,5 +138,5 @@ INSTANCE(DenseAd::Evaluation<double, 6, 0u>)
INSTANCE(DenseAd::Evaluation<double, 7, 0u>)
INSTANCE(DenseAd::Evaluation<double, 8, 0u>)
INSTANCE(DenseAd::Evaluation<double, 9, 0u>)
INSTANCE(DenseAd::Evaluation<double, 10, 0u>)
} //Namespace Opm

View File

@ -194,6 +194,7 @@ INSTANCE(DenseAd::Evaluation<double, -1, 7u>)
INSTANCE(DenseAd::Evaluation<double, -1, 8u>)
INSTANCE(DenseAd::Evaluation<double, -1, 9u>)
INSTANCE(DenseAd::Evaluation<double, -1, 10u>)
INSTANCE(DenseAd::Evaluation<double, -1, 11u>)
INSTANCE(DenseAd::Evaluation<double, 3, 0u>)
INSTANCE(DenseAd::Evaluation<double, 4, 0u>)
INSTANCE(DenseAd::Evaluation<double, 5, 0u>)
@ -201,5 +202,6 @@ INSTANCE(DenseAd::Evaluation<double, 6, 0u>)
INSTANCE(DenseAd::Evaluation<double, 7, 0u>)
INSTANCE(DenseAd::Evaluation<double, 8, 0u>)
INSTANCE(DenseAd::Evaluation<double, 9, 0u>)
INSTANCE(DenseAd::Evaluation<double, 10, 0u>)
}

View File

@ -317,5 +317,5 @@ INSTANCE_METHODS(FluidSys, DenseAd::Evaluation<double,-1,7u>)
INSTANCE_METHODS(FluidSys, DenseAd::Evaluation<double,-1,8u>)
INSTANCE_METHODS(FluidSys, DenseAd::Evaluation<double,-1,9u>)
INSTANCE_METHODS(FluidSys, DenseAd::Evaluation<double,-1,10u>)
INSTANCE_METHODS(FluidSys, DenseAd::Evaluation<double,-1,11u>)
} // namespace Opm

View File

@ -783,6 +783,7 @@ INSTANCE(DenseAd::Evaluation<double,6,0u>)
INSTANCE(DenseAd::Evaluation<double,7,0u>)
INSTANCE(DenseAd::Evaluation<double,8,0u>)
INSTANCE(DenseAd::Evaluation<double,9,0u>)
INSTANCE(DenseAd::Evaluation<double,10,0u>)
INSTANCE(DenseAd::Evaluation<double,-1,4u>)
INSTANCE(DenseAd::Evaluation<double,-1,5u>)
INSTANCE(DenseAd::Evaluation<double,-1,6u>)
@ -790,5 +791,5 @@ INSTANCE(DenseAd::Evaluation<double,-1,7u>)
INSTANCE(DenseAd::Evaluation<double,-1,8u>)
INSTANCE(DenseAd::Evaluation<double,-1,9u>)
INSTANCE(DenseAd::Evaluation<double,-1,10u>)
INSTANCE(DenseAd::Evaluation<double,-1,11u>)
} // namespace Opm

View File

@ -534,6 +534,7 @@ INSTANCE(DenseAd::Evaluation<double,6,0u>)
INSTANCE(DenseAd::Evaluation<double,7,0u>)
INSTANCE(DenseAd::Evaluation<double,8,0u>)
INSTANCE(DenseAd::Evaluation<double,9,0u>)
INSTANCE(DenseAd::Evaluation<double,10,0u>)
INSTANCE(DenseAd::Evaluation<double,-1,4u>)
INSTANCE(DenseAd::Evaluation<double,-1,5u>)
INSTANCE(DenseAd::Evaluation<double,-1,6u>)
@ -541,5 +542,5 @@ INSTANCE(DenseAd::Evaluation<double,-1,7u>)
INSTANCE(DenseAd::Evaluation<double,-1,8u>)
INSTANCE(DenseAd::Evaluation<double,-1,9u>)
INSTANCE(DenseAd::Evaluation<double,-1,10u>)
INSTANCE(DenseAd::Evaluation<double,-1,11u>)
} // namespace Opm

View File

@ -145,5 +145,6 @@ INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,1u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,1u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
} // namespace Opm