28 #ifndef SIMPLE_FI_BLACK_OIL_MODEL_HPP 29 #define SIMPLE_FI_BLACK_OIL_MODEL_HPP 33 #include <opm/models/blackoil/blackoilmoduleparams.hh> 37 #include <opm/common/ErrorMacros.hpp> 39 #include <opm/grid/CpGrid.hpp> 40 #include <opm/grid/utility/ElementChunks.hpp> 42 #include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp> 44 #include <opm/material/fluidmatrixinteractions/EclMultiplexerMaterialParams.hpp> 49 #include <type_traits> 67 template <
typename TypeTag,
template <
class>
class Storage = Opm::VectorWithDefaultAllocator>
72 using TypeTagPublic = TypeTag;
78 const Storage<Scalar>& volumes)
79 : cachedIntensiveQuantities0_(cachedIntensiveQuantities0)
80 , cachedIntensiveQuantities1_(cachedIntensiveQuantities1)
89 template <
typename OtherIQContainer>
91 const OtherIQContainer& cachedIntensiveQuantities1,
92 const Storage<Scalar>& volumes)
93 : cachedIntensiveQuantities0_(cachedIntensiveQuantities0.begin(),
94 cachedIntensiveQuantities0.end())
95 , cachedIntensiveQuantities1_(cachedIntensiveQuantities1.begin(),
96 cachedIntensiveQuantities1.end())
103 OPM_HOST_DEVICE Scalar dofTotalVolume(
unsigned int globalIdx)
const 105 return volumes_[globalIdx];
108 OPM_HOST_DEVICE
const auto& intensiveQuantities(
unsigned int globalIdx,
109 unsigned int timeIdx)
const 115 return cachedIntensiveQuantities0_[globalIdx];
117 return cachedIntensiveQuantities1_[globalIdx];
124 Storage<BlackOilIntensiveQuantities<TypeTag>> cachedIntensiveQuantities0_;
125 Storage<BlackOilIntensiveQuantities<TypeTag>> cachedIntensiveQuantities1_;
126 Storage<Scalar> volumes_;
129 #if HAVE_CUDA && OPM_IS_COMPILING_WITH_GPU_COMPILER 134 template <
class TypeTag,
typename GpuFlu
idSystem>
137 using Scalar =
typename SimpleFIBlackOilModel<TypeTag>::Scalar;
145 using CorrectTypeTagView =
146 typename ::Opm::Properties::TTag::to_gpu_type_t<TypeTag, GpuView>;
150 assert(cpuModel.cachedIntensiveQuantities0_.size() == cpuModel.cachedIntensiveQuantities1_.size());
151 const std::size_t nCells = cpuModel.cachedIntensiveQuantities0_.size();
158 std::vector<CorrectBOIQ> cpuIntQuantsWithGpuPtr0;
159 std::vector<CorrectBOIQ> cpuIntQuantsWithGpuPtr1;
160 CorrectBOIQ proto0 = cpuModel.cachedIntensiveQuantities0_[0]
161 .template withOtherFluidSystem<CorrectTypeTagView>(fsys);
162 CorrectBOIQ proto1 = cpuModel.cachedIntensiveQuantities1_[0]
163 .template withOtherFluidSystem<CorrectTypeTagView>(fsys);
164 cpuIntQuantsWithGpuPtr0.resize(nCells, proto0);
165 cpuIntQuantsWithGpuPtr1.resize(nCells, proto1);
168 #pragma omp parallel for schedule(static) 170 for (std::size_t i = 1; i < nCells; ++i) {
171 cpuIntQuantsWithGpuPtr0[i]
172 = cpuModel.cachedIntensiveQuantities0_[i]
173 .template withOtherFluidSystem<CorrectTypeTagView>(fsys);
174 cpuIntQuantsWithGpuPtr1[i]
175 = cpuModel.cachedIntensiveQuantities1_[i]
176 .template withOtherFluidSystem<CorrectTypeTagView>(fsys);
179 GpuBuffer<CorrectBOIQ> gpuBuf0(cpuIntQuantsWithGpuPtr0);
180 GpuBuffer<CorrectBOIQ> gpuBuf1(cpuIntQuantsWithGpuPtr1);
181 GpuBuffer<Scalar> gpuVolumes(cpuModel.volumes_);
184 auto result = SimplifiedGpuBufferModel(
185 std::move(gpuBuf0), std::move(gpuBuf1), std::move(gpuVolumes));
190 template <
typename LocalTypeTag>
191 auto make_view(SimpleFIBlackOilModel<LocalTypeTag, GpuBuffer>& gpuSimpleFIBlackOilModel)
193 return SimpleFIBlackOilModel<LocalTypeTag, gpuistl::GpuView>(
194 make_view(gpuSimpleFIBlackOilModel.cachedIntensiveQuantities0_),
195 make_view(gpuSimpleFIBlackOilModel.cachedIntensiveQuantities1_),
196 make_view(gpuSimpleFIBlackOilModel.volumes_));
203 #endif // SIMPLE_FI_BLACK_OIL_MODEL_HPP 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
Classes required for dynamic convective mixing.
Contains the quantities which are are constant within a finite volume in the black-oil model...
Definition: blackoilintensivequantities.hh:67
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
A fully-implicit black-oil flow model.
The Opm property system, traits with inheritance.
Simplifies multi-threaded capabilities.
Definition: SimpleFIBlackOilModel.hpp:68