|
| 1 | +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
| 2 | +// vi: set et ts=4 sw=4 sts=4: |
| 3 | +/* |
| 4 | + Copyright 2025, NORCE AS |
| 5 | +
|
| 6 | + This file is part of the Open Porous Media project (OPM). |
| 7 | +
|
| 8 | + OPM is free software: you can redistribute it and/or modify |
| 9 | + it under the terms of the GNU General Public License as published by |
| 10 | + the Free Software Foundation, either version 3 of the License, or |
| 11 | + (at your option) any later version. |
| 12 | +
|
| 13 | + OPM is distributed in the hope that it will be useful, |
| 14 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + GNU General Public License for more details. |
| 17 | +
|
| 18 | + You should have received a copy of the GNU General Public License |
| 19 | + along with OPM. If not, see <http://www.gnu.org/licenses/>. |
| 20 | +*/ |
| 21 | +#include "config.h" |
| 22 | + |
| 23 | +#include <flow/flow_energy_tpsa.hpp> |
| 24 | + |
| 25 | +#include <opm/models/blackoil/blackoilconvectivemixingmodule.hh> |
| 26 | +#include <opm/models/blackoil/blackoildiffusionmodule.hh> |
| 27 | +#include <opm/models/blackoil/blackoilenergymodules.hh> |
| 28 | +#include <opm/models/blackoil/blackoillocalresidualtpfa.hh> |
| 29 | +#include <opm/models/discretization/common/tpfalinearizer.hh> |
| 30 | + |
| 31 | +#include <opm/simulators/flow/BlackoilModelProperties.hpp> |
| 32 | +#include <opm/simulators/flow/Main.hpp> |
| 33 | +#include <opm/simulators/flow/TTagFlowProblemTPSA.hpp> |
| 34 | + |
| 35 | +#include <tuple> |
| 36 | + |
| 37 | + |
| 38 | +namespace Opm::Properties { |
| 39 | + |
| 40 | +namespace TTag { |
| 41 | + |
| 42 | +struct FlowEnergyProblemTPSA |
| 43 | +{ |
| 44 | + using InheritsFrom = std::tuple<FlowProblem, FlowProblemTpsa>; |
| 45 | +}; |
| 46 | + |
| 47 | +} // namespace Opm::Properties::TTag |
| 48 | + |
| 49 | +// /// |
| 50 | +// Flow related properties |
| 51 | +// /// |
| 52 | +template<class TypeTag> |
| 53 | +struct Linearizer<TypeTag, TTag::FlowEnergyProblemTPSA> |
| 54 | +{ using type = TpfaLinearizer<TypeTag>; }; |
| 55 | + |
| 56 | +template<class TypeTag> |
| 57 | +struct LocalResidual<TypeTag, TTag::FlowEnergyProblemTPSA> |
| 58 | +{ using type = BlackOilLocalResidualTPFA<TypeTag>; }; |
| 59 | + |
| 60 | +template<class TypeTag> |
| 61 | +struct EnergyModuleType<TypeTag, TTag::FlowEnergyProblemTPSA> |
| 62 | +{ static constexpr EnergyModules value = EnergyModules::FullyImplicitThermal; }; |
| 63 | + |
| 64 | +// /// |
| 65 | +// TPSA related properties |
| 66 | +// /// |
| 67 | +template <class TypeTag> |
| 68 | +struct EnableMech<TypeTag, TTag::FlowEnergyProblemTPSA> |
| 69 | +{ static constexpr bool value = true; }; |
| 70 | + |
| 71 | +template <class TypeTag> |
| 72 | +struct Problem<TypeTag, TTag::FlowEnergyProblemTPSA> |
| 73 | +{ using type = FlowProblemTPSA<TypeTag>; }; |
| 74 | + |
| 75 | +template <class TypeTag> |
| 76 | +struct NonlinearSystem<TypeTag, TTag::FlowEnergyProblemTPSA> |
| 77 | +{ using type = NonlinearSystemBlackOilReservoirTPSA<TypeTag>; }; |
| 78 | + |
| 79 | +} // namespace Opm::Properties |
| 80 | + |
| 81 | +namespace Opm { |
| 82 | + |
| 83 | +// ----------------- Main program ----------------- |
| 84 | +int flowEnergyTpsaMain(int argc, char** argv, bool outputCout, bool outputFiles) |
| 85 | +{ |
| 86 | + // we always want to use the default locale, and thus spare us the trouble |
| 87 | + // with incorrect locale settings. |
| 88 | + resetLocale(); |
| 89 | + |
| 90 | + FlowMain<Properties::TTag::FlowEnergyProblemTPSA> |
| 91 | + mainfunc {argc, argv, outputCout, outputFiles}; |
| 92 | + return mainfunc.execute(); |
| 93 | +} |
| 94 | + |
| 95 | +int flowEnergyTpsaMainStandalone(int argc, char** argv) |
| 96 | +{ |
| 97 | + using TypeTag = Properties::TTag::FlowEnergyProblemTPSA; |
| 98 | + auto mainObject = std::make_unique<Opm::Main>(argc, argv); |
| 99 | + auto ret = mainObject->runStatic<TypeTag>(); |
| 100 | + // Destruct mainObject as the destructor calls MPI_Finalize! |
| 101 | + mainObject.reset(); |
| 102 | + return ret; |
| 103 | +} |
| 104 | + |
| 105 | +} // namespace Opm |
0 commit comments