Skip to content

Commit 740eefb

Browse files
committed
Thermoelastic effects in TPSA.
- Additional TPSA source term with diff. temp. - Mechanical effects on thermal simulations via new compressibility term (i.e. pore volume change) - Temperature effects included in relevant outputs - Note: only for fully implicit thermal simulators - Binaries for blackoil, gas-water and one-phase (water only) + energy + TPSA simulators - New simulators added to flow binary - TPSA_THERMAL regression test - Unit tests for conversions
1 parent 22cff7c commit 740eefb

21 files changed

Lines changed: 1144 additions & 8 deletions

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ macro(opm-simulators_targets_hook)
706706
brine_precsalt_vapwat
707707
brine_saltprecipitation
708708
energy
709+
energy_tpsa
709710
extbo
710711
foam
711712
gasoil
@@ -717,6 +718,7 @@ macro(opm-simulators_targets_hook)
717718
gaswater_dissolution_diffuse
718719
gaswater_dissolution_tpsa
719720
gaswater_energy
721+
gaswater_energy_tpsa
720722
gaswater_saltprec_energy
721723
gaswater_saltprec_vapwat
722724
gaswater_solvent
@@ -727,6 +729,7 @@ macro(opm-simulators_targets_hook)
727729
oilwater_polymer_injectivity
728730
onephase
729731
onephase_energy
732+
onephase_energy_tpsa
730733
onephase_tpsa
731734
polymer
732735
solvent

CMakeLists_files.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ list (APPEND TEST_SOURCE_FILES
519519
tests/test_stoppedwells.cpp
520520
tests/test_ThreePointHorizontalSatfuncConsistencyChecks.cpp
521521
tests/test_timer.cpp
522+
tests/test_tpsa_conversions.cpp
522523
tests/test_tpsa_face_properties.cpp
523524
tests/test_tpsa_localresidual.cpp
524525
tests/test_tpsa_matrix.cpp

flow/flow_energy_tpsa.cpp

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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

flow/flow_energy_tpsa.hpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
This file is part of the Open Porous Media project (OPM).
3+
4+
OPM is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
OPM is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with OPM. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
#ifndef FLOW_ENERGY_TPSA_HPP
18+
#define FLOW_ENERGY_TPSA_HPP
19+
20+
namespace Opm {
21+
22+
//! \brief Main function used in flow binary.
23+
int flowEnergyTpsaMain(int argc, char** argv, bool outputCout, bool outputFiles);
24+
25+
//! \brief Main function used in flow_energy_tpsa binary.
26+
int flowEnergyTpsaMainStandalone(int argc, char** argv);
27+
28+
}
29+
30+
#endif // FLOW_ENERGY_TPSA_HPP

flow/flow_energy_tpsa_main.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
This file is part of the Open Porous Media project (OPM).
3+
4+
OPM is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
OPM is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with OPM. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
#include "config.h"
18+
#include <flow/flow_energy_tpsa.hpp>
19+
20+
21+
int main(int argc, char** argv)
22+
{
23+
return Opm::flowEnergyTpsaMainStandalone(argc, argv);
24+
}

flow/flow_gaswater_energy_tpsa.cpp

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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 2026, 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_gaswater_energy_tpsa.hpp>
24+
25+
#include <opm/models/blackoil/blackoilconvectivemixingmodule.hh>
26+
#include <opm/models/blackoil/blackoildiffusionmodule.hh>
27+
#include <opm/models/blackoil/blackoildispersionmodule.hh>
28+
#include <opm/models/blackoil/blackoilenergymodules.hh>
29+
30+
#include <opm/simulators/flow/BlackoilModelProperties.hpp>
31+
#include <opm/simulators/flow/FlowGasWaterEnergyTypeTag.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 FlowGasWaterEnergyProblemTPSA
43+
{ using InheritsFrom = std::tuple<FlowGasWaterEnergyProblem, FlowProblemTpsa>; };
44+
45+
} // namespace Opm::Properties::TTag
46+
47+
// ///
48+
// TPSA related properties
49+
// ///
50+
template <class TypeTag>
51+
struct EnableMech<TypeTag, TTag::FlowGasWaterEnergyProblemTPSA>
52+
{ static constexpr bool value = true; };
53+
54+
template <class TypeTag>
55+
struct Problem<TypeTag, TTag::FlowGasWaterEnergyProblemTPSA>
56+
{ using type = FlowProblemTPSA<TypeTag>; };
57+
58+
template <class TypeTag>
59+
struct NonlinearSystem<TypeTag, TTag::FlowGasWaterEnergyProblemTPSA>
60+
{ using type = NonlinearSystemBlackOilReservoirTPSA<TypeTag>; };
61+
62+
} // namespace Opm::Properties
63+
64+
namespace Opm {
65+
66+
// ----------------- Main program -----------------
67+
int flowGasWaterEnergyTpsaMain(int argc, char** argv, bool outputCout, bool outputFiles)
68+
{
69+
// we always want to use the default locale, and thus spare us the trouble
70+
// with incorrect locale settings.
71+
resetLocale();
72+
73+
FlowMain<Properties::TTag::FlowGasWaterEnergyProblemTPSA>
74+
mainfunc {argc, argv, outputCout, outputFiles};
75+
return mainfunc.execute();
76+
}
77+
78+
int flowGasWaterEnergyTpsaMainStandalone(int argc, char** argv)
79+
{
80+
using TypeTag = Properties::TTag::FlowGasWaterEnergyProblemTPSA;
81+
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
82+
auto ret = mainObject->runStatic<TypeTag>();
83+
// Destruct mainObject as the destructor calls MPI_Finalize!
84+
mainObject.reset();
85+
return ret;
86+
}
87+
88+
} // namespace Opm

flow/flow_gaswater_energy_tpsa.hpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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 2026, 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+
#ifndef FLOW_GASWATER_ENERGY_TPSA_HPP
22+
#define FLOW_GASWATER_ENERGY_TPSA_HPP
23+
24+
namespace Opm {
25+
26+
//! \brief Main function used in flow binary.
27+
int flowGasWaterEnergyTpsaMain(int argc, char** argv, bool outputCout, bool outputFiles);
28+
29+
//! \brief Main function used in flow_gaswater_energy_tpsa binary.
30+
int flowGasWaterEnergyTpsaMainStandalone(int argc, char** argv);
31+
32+
} // namespace Opm
33+
34+
#endif
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 2026, 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+
#include <flow/flow_gaswater_energy_tpsa.hpp>
23+
24+
25+
int main(int argc, char** argv)
26+
{
27+
return Opm::flowGasWaterEnergyTpsaMainStandalone(argc, argv);
28+
}

0 commit comments

Comments
 (0)