From 96d028f3af92c9c956335dec737a1d1532559cd3 Mon Sep 17 00:00:00 2001 From: Tobias Meyer Andersen Date: Wed, 6 May 2026 13:29:32 +0200 Subject: [PATCH] update cmake --- CMakeLists_files.cmake | 1 + flow/flow_gaswater_energy.cpp | 64 +-------- .../flow/FlowGasWaterEnergyTypeTag.hpp | 132 ++++++++++++++++++ 3 files changed, 134 insertions(+), 63 deletions(-) create mode 100644 opm/simulators/flow/FlowGasWaterEnergyTypeTag.hpp diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 6075ba58577..ad147010f22 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -969,6 +969,7 @@ list (APPEND PUBLIC_HEADER_FILES opm/simulators/flow/FIPContainer.hpp opm/simulators/flow/FlowBaseProblemProperties.hpp opm/simulators/flow/FlowBaseVanguard.hpp + opm/simulators/flow/FlowGasWaterEnergyTypeTag.hpp opm/simulators/flow/FlowGenericProblem.hpp opm/simulators/flow/FlowGenericProblem_impl.hpp opm/simulators/flow/FlowGenericVanguard.hpp diff --git a/flow/flow_gaswater_energy.cpp b/flow/flow_gaswater_energy.cpp index f41a022e6ba..12d11c1ff2b 100644 --- a/flow/flow_gaswater_energy.cpp +++ b/flow/flow_gaswater_energy.cpp @@ -22,74 +22,12 @@ #include #include -#include #include #include #include -#include -#include -#include - -namespace Opm { -namespace Properties { -namespace TTag { -struct FlowGasWaterEnergyProblem { - using InheritsFrom = std::tuple; -}; -} - -template -struct Linearizer { using type = TpfaLinearizer; }; - -template -struct LocalResidual { using type = BlackOilLocalResidualTPFA; }; - -template -struct EnableDiffusion { static constexpr bool value = true; }; - -template -struct EnableDispersion { static constexpr bool value = true; }; - -template -struct EnergyModuleType -{ static constexpr EnergyModules value = EnergyModules::FullyImplicitThermal; }; - -template -struct EnableDisgasInWater { - static constexpr bool value = true; -}; - -template -struct EnableVapwat { - static constexpr bool value = true; -}; - -//! The indices required by the model -template -struct Indices -{ -private: - // it is unfortunately not possible to simply use 'TypeTag' here because this leads - // to cyclic definitions of some properties. if this happens the compiler error - // messages unfortunately are *really* confusing and not really helpful. - using BaseTypeTag = TTag::FlowProblem; - using FluidSystem = GetPropType; - static constexpr EnergyModules energyModuleType = getPropValue(); - static constexpr int numEnergyVars = energyModuleType == EnergyModules::FullyImplicitThermal; -public: - using type = BlackOilTwoPhaseIndices(), - getPropValue(), - getPropValue(), - numEnergyVars, - getPropValue(), - getPropValue(), - /*PVOffset=*/0, - /*disabledCompIdx=*/FluidSystem::oilCompIdx, - getPropValue()>; -}; -}} +#include namespace Opm { diff --git a/opm/simulators/flow/FlowGasWaterEnergyTypeTag.hpp b/opm/simulators/flow/FlowGasWaterEnergyTypeTag.hpp new file mode 100644 index 00000000000..c383c3f64c5 --- /dev/null +++ b/opm/simulators/flow/FlowGasWaterEnergyTypeTag.hpp @@ -0,0 +1,132 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/* + Copyright 2026 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 . +*/ +/*! + * \file + * + * Shared TypeTag declaration for the gas+water+energy (CO2STORE-style) + * blackoil flow problem. Originally inlined into + * \c flow/flow_gaswater_energy.cpp; extracted into a header so that other + * translation units (e.g. the GPU intensive-quantities dispatcher) can + * obtain matching property bindings via \c GetPropType. + */ +#ifndef OPM_FLOW_GASWATER_ENERGY_TYPETAG_HPP +#define OPM_FLOW_GASWATER_ENERGY_TYPETAG_HPP + +#include + +#include +#include +#include + +#include + +namespace Opm::Properties { +namespace TTag { +struct FlowGasWaterEnergyProblem { + using InheritsFrom = std::tuple; +}; + +/// GPU-simulation variant: all physics properties are inherited from +/// \c FlowGasWaterEnergyProblem; the GPU-specific property overrides +/// (RunAssemblyOnGpu, GpuFIBlackOilModel, …) are added in \c flow_gpu.cu. +struct FlowGasWaterEnergyProblemGPU { + using InheritsFrom = std::tuple; +}; + +} // namespace TTag + +// ----------------------------------------------------------------------- +// FlowGasWaterEnergyProblemGPU property overrides that affect the layout +// of \c BlackOilIntensiveQuantities (and therefore must be visible to +// every translation unit that instantiates that class with this TypeTag, +// otherwise we get an ODR violation: e.g. the dispatcher TU and +// \c flow_gpu.cu would compile differently sized / ordered IQ structs). +// +// Dispersion is not yet supported on the GPU assembly path; disable it +// even though the CPU parent TypeTag enables it. +// ----------------------------------------------------------------------- +template +struct EnableDispersion { + static constexpr bool value = false; +}; + +template +struct EnableDiffusion { + static constexpr bool value = false; +}; + +template +struct EnableEnergy { + static constexpr bool value = true; +}; + +template +struct Linearizer { using type = TpfaLinearizer; }; + +template +struct LocalResidual { using type = BlackOilLocalResidualTPFA; }; + +template +struct EnableDiffusion { static constexpr bool value = true; }; + +template +struct EnableDispersion { static constexpr bool value = true; }; + +template +struct EnergyModuleType +{ static constexpr EnergyModules value = EnergyModules::FullyImplicitThermal; }; + +template +struct EnableDisgasInWater { + static constexpr bool value = true; +}; + +template +struct EnableVapwat { + static constexpr bool value = true; +}; + +//! The indices required by the model +template +struct Indices +{ +private: + // it is unfortunately not possible to simply use 'TypeTag' here because + // this leads to cyclic definitions of some properties. + using BaseTypeTag = TTag::FlowProblem; + using FluidSystem = GetPropType; + static constexpr EnergyModules energyModuleType = getPropValue(); + static constexpr int numEnergyVars = energyModuleType == EnergyModules::FullyImplicitThermal; +public: + using type = BlackOilTwoPhaseIndices(), + getPropValue(), + getPropValue(), + numEnergyVars, + getPropValue(), + getPropValue(), + /*PVOffset=*/0, + /*disabledCompIdx=*/FluidSystem::oilCompIdx, + getPropValue()>; +}; + +} // namespace Opm::Properties + +#endif // OPM_FLOW_GASWATER_ENERGY_TYPETAG_HPP