Merge pull request #4017 from atgeirr/make-fast-assembly-default

Make the TPFA linearizer default for 1/2/3 phase blackoil.
This commit is contained in:
Atgeirr Flø Rasmussen
2022-10-03 12:01:22 +02:00
committed by GitHub
10 changed files with 231 additions and 12 deletions
+35 -9
View File
@@ -23,8 +23,10 @@
#define OPM_MAIN_HEADER_INCLUDED
#include <flow/flow_ebos_blackoil.hpp>
#include <flow/flow_ebos_blackoil_tpfa.hpp>
#include <flow/flow_ebos_gasoil.hpp>
#include <flow/flow_ebos_gasoildiffuse.hpp>
#include <flow/flow_ebos_gasoil_energy.hpp>
#include <flow/flow_ebos_oilwater.hpp>
#include <flow/flow_ebos_gaswater.hpp>
@@ -117,9 +119,6 @@ int flowEbosMain(int argc, char** argv, bool outputCout, bool outputFiles)
// usage scenarios, we refactored the original run() in flow.cpp into this class.
class Main
{
private:
using FlowMainEbosType = FlowMainEbos<Properties::TTag::EclFlowProblem>;
public:
Main(int argc, char** argv) : argc_(argc), argv_(argv) { initMPI(); }
@@ -236,6 +235,7 @@ public:
return exitCode;
}
using FlowMainEbosType = FlowMainEbos<Properties::TTag::EclFlowProblem>;
// To be called from the Python interface code. Only do the
// initialization and then return a pointer to the FlowEbosMain
// object that can later be accessed directly from the Python interface
@@ -282,6 +282,7 @@ private:
//
// TODO: make sure that no illegal combinations like thermal and
// twophase are requested.
const bool thermal = eclipseState_->getSimulationConfig().isThermal();
// Single-phase case
if (rspec.micp()) {
@@ -289,17 +290,17 @@ private:
}
// water-only case
else if(phases.size() == 1 && phases.active(Phase::WATER) && !eclipseState_->getSimulationConfig().isThermal()) {
else if(phases.size() == 1 && phases.active(Phase::WATER) && !thermal) {
return this->runWaterOnly(phases);
}
// water-only case with energy
else if(phases.size() == 2 && phases.active(Phase::WATER) && eclipseState_->getSimulationConfig().isThermal()) {
else if(phases.size() == 2 && phases.active(Phase::WATER) && thermal) {
return this->runWaterOnlyEnergy(phases);
}
// Twophase cases
else if (phases.size() == 2 && !eclipseState_->getSimulationConfig().isThermal()) {
else if (phases.size() == 2 && !thermal) {
return this->runTwoPhase(phases);
}
@@ -329,7 +330,7 @@ private:
}
// Energy case
else if (eclipseState_->getSimulationConfig().isThermal()) {
else if (thermal) {
return this->runThermal(phases);
}
@@ -593,18 +594,36 @@ private:
int runTwoPhase(const Phases& phases)
{
const bool diffusive = eclipseState_->getSimulationConfig().isDiffusive();
// oil-gas
if (phases.active( Phase::OIL ) && phases.active( Phase::GAS )) {
return flowEbosGasOilMain(argc_, argv_, outputCout_, outputFiles_);
if (diffusive) {
return flowEbosGasOilDiffuseMain(argc_, argv_, outputCout_, outputFiles_);
} else {
return flowEbosGasOilMain(argc_, argv_, outputCout_, outputFiles_);
}
}
// oil-water
else if ( phases.active( Phase::OIL ) && phases.active( Phase::WATER ) ) {
if (diffusive) {
if (outputCout_) {
std::cerr << "The DIFFUSE option is not available for the two-phase water/oil model." << std::endl;
}
return EXIT_FAILURE;
}
return flowEbosOilWaterMain(argc_, argv_, outputCout_, outputFiles_);
}
// gas-water
else if ( phases.active( Phase::GAS ) && phases.active( Phase::WATER ) ) {
if (diffusive) {
if (outputCout_) {
std::cerr << "The DIFFUSE option is not available for the two-phase gas/water model." << std::endl;
}
return EXIT_FAILURE;
}
return flowEbosGasWaterMain(argc_, argv_, outputCout_, outputFiles_);
}
else {
@@ -737,7 +756,14 @@ private:
int runBlackOil()
{
return flowEbosBlackoilMain(argc_, argv_, outputCout_, outputFiles_);
const bool diffusive = eclipseState_->getSimulationConfig().isDiffusive();
if (diffusive) {
// Use the traditional linearizer, as the TpfaLinearizer does not
// support the diffusion module yet.
return flowEbosBlackoilMain(argc_, argv_, outputCout_, outputFiles_);
} else {
return flowEbosBlackoilTpfaMain(argc_, argv_, outputCout_, outputFiles_);
}
}
int argc_{0};