Make blackoil_nohyst available in flow, not just standalone.

This commit is contained in:
Atgeirr Flø Rasmussen committed 2025-10-02 16:02:07 +02:00
1 parent a6555a623d
commit 08d8fa91b6
5 files changed
+116 -24

No files matched your search

+2 -11
View File
@@ -577,7 +577,8 @@ set(FLOW_MODELS blackoil brine energy extbo foam gasoil gaswater
gasoil_energy brine_saltprecipitation
gaswater_saltprec_vapwat gaswater_saltprec_energy brine_precsalt_vapwat
blackoil_legacyassembly gasoildiffuse gaswater_dissolution
gaswater_dissolution_diffuse gaswater_energy gaswater_solvent biofilm)
gaswater_dissolution_diffuse gaswater_energy gaswater_solvent biofilm
blackoil_nohyst)
set(FLOW_VARIANT_MODELS brine_energy onephase onephase_energy)
set(FLOW_TGTS)
@@ -641,16 +642,6 @@ opm_add_test(flow_blackoil_polyhedralgrid
flow/flow_blackoil_polyhedralgrid.cpp
$<TARGET_OBJECTS:moduleVersion>)
opm_add_test(flow_blackoil_nohyst
ONLY_COMPILE
ALWAYS_ENABLE
DEFAULT_ENABLE_IF ${FLOW_POLY_ONLY_DEFAULT_ENABLE_IF}
DEPENDS opmsimulators
LIBRARIES opmsimulators
SOURCES
flow/flow_blackoil_nohyst.cpp
$<TARGET_OBJECTS:moduleVersion>)
opm_add_test(flow_distribute_z
ONLY_COMPILE
ALWAYS_ENABLE
+36 -11
View File
@@ -1,4 +1,6 @@
/*
Copyright 2025 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
@@ -30,38 +32,61 @@
namespace Opm {
namespace Properties {
namespace TTag {
struct FlowProblemNoHystNoEps {
struct FlowProblemNohyst {
using InheritsFrom = std::tuple<FlowProblem>;
};
}
template<class TypeTag>
struct Linearizer<TypeTag, TTag::FlowProblemNoHystNoEps> { using type = TpfaLinearizer<TypeTag>; };
struct Linearizer<TypeTag, TTag::FlowProblemNohyst> { using type = TpfaLinearizer<TypeTag>; };
template<class TypeTag>
struct LocalResidual<TypeTag, TTag::FlowProblemNoHystNoEps> { using type = BlackOilLocalResidualTPFA<TypeTag>; };
struct LocalResidual<TypeTag, TTag::FlowProblemNohyst> { using type = BlackOilLocalResidualTPFA<TypeTag>; };
template<class TypeTag>
struct EnableDiffusion<TypeTag, TTag::FlowProblemNoHystNoEps> { static constexpr bool value = false; };
struct EnableDiffusion<TypeTag, TTag::FlowProblemNohyst> { static constexpr bool value = false; };
template<class TypeTag>
struct EnableHysteresis<TypeTag, TTag::FlowProblemNoHystNoEps> { static constexpr bool value = false; };
struct EnableHysteresis<TypeTag, TTag::FlowProblemNohyst> { static constexpr bool value = false; };
template<class TypeTag>
struct EnableEndpointScaling<TypeTag, TTag::FlowProblemNoHystNoEps> { static constexpr bool value = true; };
struct EnableEndpointScaling<TypeTag, TTag::FlowProblemNohyst> { static constexpr bool value = true; };
template<class TypeTag>
struct AvoidElementContext<TypeTag, TTag::FlowProblemNoHystNoEps> { static constexpr bool value = true; };
struct AvoidElementContext<TypeTag, TTag::FlowProblemNohyst> { static constexpr bool value = true; };
}
} // namespace Opm
int main(int argc, char** argv)
std::unique_ptr<FlowMain<Properties::TTag::FlowProblemNohyst>>
flowBlackoilTpfaNohystMainInit(int argc, char** argv, bool outputCout, bool outputFiles)
{
using TypeTag = Opm::Properties::TTag::FlowProblemNoHystNoEps;
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
resetLocale();
return std::make_unique<FlowMain<Properties::TTag::FlowProblemNohyst>>(
argc, argv, outputCout, outputFiles);
}
// ----------------- Main program -----------------
int flowBlackoilTpfaNohystMain(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();
FlowMain<Properties::TTag::FlowProblemNohyst>
mainfunc {argc, argv, outputCout, outputFiles};
return mainfunc.execute();
}
int flowBlackoilTpfaNohystMainStandalone(int argc, char** argv)
{
using TypeTag = Opm::Properties::TTag::FlowProblemNohyst;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
auto ret = mainObject->runStatic<TypeTag>();
// Destruct mainObject as the destructor calls MPI_Finalize!
mainObject.reset();
return ret;
}
} // namespace Opm
+44
View File
@@ -0,0 +1,44 @@
/*
Copyright 2025 Equinor ASA.
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_BLACKOIL_NOHYST_HPP
#define FLOW_BLACKOIL_NOHYST_HPP
#include <opm/simulators/flow/TTagFlowProblemTPFA.hpp>
#include <memory>
namespace Opm {
namespace Properties { namespace TTag { struct FlowProblemNohyst; } }
//! \brief Main function used in flow binary.
int flowBlackoilTpfaNohystMain(int argc, char** argv, bool outputCout, bool outputFiles);
template<class TypeTag> class FlowMain;
//! \brief Initialization function used in flow binary and python simulator.
std::unique_ptr<FlowMain<Properties::TTag::FlowProblemNohyst>>
flowBlackoilTpfaNohystMainInit(int argc, char** argv, bool outputCout, bool outputFiles);
//! \brief Main function used in flow_brine binary.
int flowBlackoilTpfaNohystMainStandalone(int argc, char** argv);
}
#endif // FLOW_BLACKOIL_NOHYST_HPP
+27
View File
@@ -0,0 +1,27 @@
/*
Copyright 2025 Equinor ASA.
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_blackoil_nohyst.hpp>
int main(int argc, char** argv)
{
return Opm::flowBlackoilTpfaNohystMainStandalone(argc, argv);
}
+7 -2
View File
@@ -27,6 +27,7 @@
#include <flow/flow_biofilm.hpp>
#include <flow/flow_blackoil.hpp>
#include <flow/flow_blackoil_legacyassembly.hpp>
#include <flow/flow_blackoil_nohyst.hpp>
#include <flow/flow_brine.hpp>
#include <flow/flow_brine_precsalt_vapwat.hpp>
#include <flow/flow_brine_saltprecipitation.hpp>
@@ -423,6 +424,10 @@ int Opm::Main::runBlackOil()
// support the diffusion module yet.
return flowBlackoilMain(argc_, argv_, outputCout_, outputFiles_);
}
return flowBlackoilTpfaMain(argc_, argv_, outputCout_, outputFiles_);
if (this->eclipseState_->runspec().hysterPar().active()) {
return flowBlackoilTpfaMain(argc_, argv_, outputCout_, outputFiles_);
} else {
// Use variant without hysteresis support to save memory.
return flowBlackoilTpfaNohystMain(argc_, argv_, outputCout_, outputFiles_);
}
}