build flow_brine_energy as an object library

improves parallel builds
This commit is contained in:
Arne Morten Kvarving 2021-10-18 12:34:09 +02:00
parent 4a16e2cf3a
commit 8c7f635dc2
4 changed files with 79 additions and 36 deletions

View File

@ -360,14 +360,13 @@ foreach(OBJ ${COMMON_MODELS} ${FLOW_MODELS})
endforeach()
set_property(TARGET flow_libblackoil PROPERTY POSITION_INDEPENDENT_CODE ON)
add_library(flow_libonephase_energy OBJECT flow/flow_ebos_onephase_energy.cpp)
add_library(flow_libonephase OBJECT flow/flow_ebos_onephase.cpp)
if(TARGET fmt::fmt)
target_link_libraries(flow_libonephase_energy fmt::fmt)
target_link_libraries(flow_libonephase fmt::fmt)
endif()
set_property(TARGET flow_libonephase PROPERTY EXCLUDE_FROM_ALL ${FLOW_VARIANTS_DEFAULT_ENABLE_IF})
set_property(TARGET flow_libonephase_energy PROPERTY EXCLUDE_FROM_ALL ${FLOW_VARIANTS_DEFAULT_ENABLE_IF})
foreach(OBJ brine_energy onephase onephase_energy)
add_library(flow_lib${OBJ} OBJECT flow/flow_ebos_${OBJ}.cpp)
if(TARGET fmt::fmt)
target_link_libraries(flow_lib${OBJ} fmt::fmt)
endif()
set_property(TARGET flow_lib${OBJ} PROPERTY EXCLUDE_FROM_ALL ${FLOW_VARIANTS_DEFAULT_ENABLE_IF})
endforeach()
add_library(flow_libblackoil_poly OBJECT flow/flow_ebos_blackoil_poly.cpp)
if(TARGET fmt::fmt)
@ -451,6 +450,7 @@ opm_add_test(flow_brine_energy
SOURCES
flow/flow_brine_energy.cpp
$<TARGET_OBJECTS:moduleVersion>
$<TARGET_OBJECTS:flow_libbrine_energy>
EXE_NAME flow_brine_energy
DEPENDS opmsimulators
LIBRARIES opmsimulators)

View File

@ -15,36 +15,10 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <flow/flow_ebos_brine_energy.hpp>
#include <opm/material/common/ResetLocale.hpp>
#include <opm/simulators/flow/Main.hpp>
#if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh>
#else
#include <dune/common/parallel/mpihelper.hh>
#endif
namespace Opm {
namespace Properties {
namespace TTag {
struct EclFlowBrineProblem {
using InheritsFrom = std::tuple<EclFlowProblem>;
};
}
template<class TypeTag>
struct EnableBrine<TypeTag, TTag::EclFlowBrineProblem> {
static constexpr bool value = true;
};
template<class TypeTag>
struct EnableEnergy<TypeTag, TTag::EclFlowBrineProblem> {
static constexpr bool value = true;
};
}}
int main(int argc, char** argv)
{
using TypeTag = Opm::Properties::TTag::EclFlowBrineProblem;
auto mainObject = Opm::Main(argc, argv);
return mainObject.runStatic<TypeTag>();
return Opm::flowEbosBrineEnergyMain(argc, argv);
}

View File

@ -0,0 +1,44 @@
/*
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 <opm/simulators/flow/Main.hpp>
namespace Opm {
namespace Properties {
namespace TTag {
struct EclFlowBrineProblem {
using InheritsFrom = std::tuple<EclFlowProblem>;
};
}
template<class TypeTag>
struct EnableBrine<TypeTag, TTag::EclFlowBrineProblem> {
static constexpr bool value = true;
};
template<class TypeTag>
struct EnableEnergy<TypeTag, TTag::EclFlowBrineProblem> {
static constexpr bool value = true;
};
}
int flowEbosBrineEnergyMain(int argc, char** argv)
{
using TypeTag = Opm::Properties::TTag::EclFlowBrineProblem;
auto mainObject = Opm::Main(argc, argv);
return mainObject.runStatic<TypeTag>();
}
}

View File

@ -0,0 +1,25 @@
/*
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_BRINE_ENERGY_HPP
#define FLOW_EBOS_BRINE_ENERGY_HPP
namespace Opm {
int flowEbosBrineEnergyMain(int argc, char** argv);
}
#endif