Make flow_blackoil_tpfa.cpp an OPM Flow variant in the build system.

This commit is contained in:
Atgeirr Flø Rasmussen 2022-08-09 14:53:58 +02:00
parent 90e8a9af69
commit 923b1c555c
4 changed files with 110 additions and 48 deletions

View File

@ -423,7 +423,7 @@ set(FLOW_MODELS blackoil brine energy extbo foam gasoil gaswater
oilwater oilwater_brine gaswater_brine oilwater_polymer
oilwater_polymer_injectivity micp polymer solvent
gasoil_energy brine_saltprecipitation gaswater_saltprec_vapwat brine_precsalt_vapwat)
set(FLOW_VARIANT_MODELS brine_energy onephase onephase_energy)
set(FLOW_VARIANT_MODELS brine_energy onephase onephase_energy blackoil_tpfa)
set(FLOW_TGTS)
foreach(OBJ ${COMMON_MODELS} ${FLOW_MODELS} ${FLOW_VARIANT_MODELS})
@ -478,18 +478,6 @@ opm_add_test(flow_poly
$<TARGET_OBJECTS:moduleVersion>)
target_compile_definitions(flow_poly PRIVATE USE_POLYHEDRALGRID)
opm_add_test(flow_blackoil_tpfa
ONLY_COMPILE
ALWAYS_ENABLE
DEFAULT_ENABLE_IF ${FLOW_POLY_ONLY_DEFAULT_ENABLE_IF}
DEPENDS opmsimulators
LIBRARIES opmsimulators
SOURCES
flow/flow_blackoil_tpfa.cpp
# $<TARGET_OBJECTS:flow_libblackoil_tpfa>
$<TARGET_OBJECTS:moduleVersion>)
#target_compile_definitions(flow_blackoil_tpfa PRIVATE USE_POLYHEDRALGRID)
opm_add_test(flow_distribute_z
ONLY_COMPILE
ALWAYS_ENABLE

View File

@ -17,42 +17,9 @@
#include "config.h"
#include <opm/material/common/ResetLocale.hpp>
#include <opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp>
#include <opm/simulators/flow/Main.hpp>
// modifications from standard
#include <opm/models/blackoil/blackoillocalresidualtpfa.hh>
#include <opm/models/discretization/common/tpfalinearizer.hh>
namespace Opm {
namespace Properties {
namespace TTag {
struct EclFlowProblemTPFA {
using InheritsFrom = std::tuple<EclFlowProblem>;
};
}
}
}
namespace Opm {
namespace Properties {
template<class TypeTag>
struct Linearizer<TypeTag, TTag::EclFlowProblemTPFA> { using type = TpfaLinearizer<TypeTag>; };
template<class TypeTag>
struct LocalResidual<TypeTag, TTag::EclFlowProblemTPFA> { using type = BlackOilLocalResidualTPFA<TypeTag>; };
template<class TypeTag>
struct EnableDiffusion<TypeTag, TTag::EclFlowProblemTPFA> { static constexpr bool value = false; };
}
}
#include <flow/flow_ebos_blackoil_tpfa.hpp>
int main(int argc, char** argv)
{
using TypeTag = Opm::Properties::TTag::EclFlowProblemTPFA;
auto mainObject = Opm::Main(argc, argv);
return mainObject.runStatic<TypeTag>();
return Opm::flowEbosBlackoilTpfaMainStandalone(argc, argv);
}

View File

@ -0,0 +1,77 @@
/*
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_blackoil_tpfa.hpp>
#include <opm/material/common/ResetLocale.hpp>
#include <opm/grid/CpGrid.hpp>
#include <opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp>
#include <opm/simulators/flow/Main.hpp>
#include <opm/models/blackoil/blackoillocalresidualtpfa.hh>
#include <opm/models/discretization/common/tpfalinearizer.hh>
namespace Opm {
namespace Properties {
namespace TTag {
struct EclFlowProblemTPFA {
using InheritsFrom = std::tuple<EclFlowProblem>;
};
}
}
}
namespace Opm {
namespace Properties {
template<class TypeTag>
struct Linearizer<TypeTag, TTag::EclFlowProblemTPFA> { using type = TpfaLinearizer<TypeTag>; };
template<class TypeTag>
struct LocalResidual<TypeTag, TTag::EclFlowProblemTPFA> { using type = BlackOilLocalResidualTPFA<TypeTag>; };
template<class TypeTag>
struct EnableDiffusion<TypeTag, TTag::EclFlowProblemTPFA> { static constexpr bool value = false; };
}
}
namespace Opm
{
// ----------------- Main program -----------------
int flowEbosBlackoilTpfaMain(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::EclFlowProblemTPFA>
mainfunc {argc, argv, outputCout, outputFiles};
return mainfunc.execute();
}
int flowEbosBlackoilTpfaMainStandalone(int argc, char** argv)
{
using TypeTag = Properties::TTag::EclFlowProblemTPFA;
auto mainObject = Opm::Main(argc, argv);
return mainObject.runStatic<TypeTag>();
}
} // namespace Opm

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_BLACKOIL_TPFA_HPP
#define FLOW_EBOS_BLACKOIL_TPFA_HPP
namespace Opm {
//! \brief Main function used in flow binary.
int flowEbosBlackoilTpfaMain(int argc, char** argv, bool outputCout, bool outputFiles);
//! \brief Main function used in flow_brine binary.
int flowEbosBlackoilTpfaMainStandalone(int argc, char** argv);
}
#endif // FLOW_EBOS_BLACKOIL_TPFA_HPP