GpuBlackoilIntensiveQuantitiesDispatcher.hpp
Go to the documentation of this file.
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 Equinor ASA
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 OPM_GPU_BLACKOIL_INTENSIVE_QUANTITIES_DISPATCHER_HPP
22#define OPM_GPU_BLACKOIL_INTENSIVE_QUANTITIES_DISPATCHER_HPP
23
24#if HAVE_CUDA
25
27
28#include <cstddef>
29#include <memory>
30
31namespace Opm::Parameters {
32
33// Experimental: route the per-element BlackOilIntensiveQuantities update through the
34// GPU dispatcher instead of computing it on the CPU. This currently supports
35// only the gas-water energy configuration.
36struct ExperimentalComputePropertiesOnGpu { static constexpr bool value = false; };
37
38} // namespace Opm::Parameters
39
40namespace Opm::Properties::TTag {
41 struct FlowGasWaterEnergyProblem;
42 struct FlowGasWaterEnergyProblemGPU;
43}
44
45namespace Opm::gpuistl {
46
52template <class CpuTypeTag>
53struct GpuBlackoilIntensiveQuantitiesDispatcherSupport {
54 static constexpr bool value = false;
55};
56
57template <>
58struct GpuBlackoilIntensiveQuantitiesDispatcherSupport<
59 Opm::Properties::TTag::FlowGasWaterEnergyProblem> {
60 static constexpr bool value = true;
61};
62
67template <>
68struct GpuBlackoilIntensiveQuantitiesDispatcherSupport<
69 Opm::Properties::TTag::FlowGasWaterEnergyProblemGPU> {
70 static constexpr bool value = true;
71};
72
86template <class CpuTypeTag>
87class GpuBlackoilIntensiveQuantitiesDispatcher
88{
89public:
93
94 GpuBlackoilIntensiveQuantitiesDispatcher();
95 ~GpuBlackoilIntensiveQuantitiesDispatcher();
96
97 GpuBlackoilIntensiveQuantitiesDispatcher(const GpuBlackoilIntensiveQuantitiesDispatcher&) = delete;
98 GpuBlackoilIntensiveQuantitiesDispatcher&
99 operator=(const GpuBlackoilIntensiveQuantitiesDispatcher&) = delete;
100
108 void update(const Problem& cpuProblem,
109 const PrimaryVariables* const* cpuPriVars,
110 IntensiveQuantities* const* outIQ,
111 std::size_t numDof);
112
113private:
114 struct Impl;
115 std::unique_ptr<Impl> impl_;
116};
117
118} // namespace Opm::gpuistl
119
120#endif // HAVE_CUDA
121
122#endif // OPM_GPU_BLACKOIL_INTENSIVE_QUANTITIES_DISPATCHER_HPP
Definition: blackoilnewtonmethodparams.hpp:31
The generic type tag for problems using the immiscible multi-phase model.
Definition: blackoilmodel.hh:76
A small, fixed‑dimension MiniVector class backed by std::array that can be used in both host and CUDA...
Definition: GpuFlowProblem.hpp:48
Definition: blackoilbioeffectsmodules.hh:45
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:233
The Opm property system, traits with inheritance.