Merge pull request #6676 from multitalentloes/make_newtranfluxmodule_gpu_friendly

make more files gpu-compatible
This commit is contained in:
Atgeirr Flø Rasmussen authored and GitHub committed 2026-02-18 08:47:36 +01:00
commit 7d6feee0d9
9 files changed
+180 -94

No files matched your search

+3 -2
View File
@@ -39,7 +39,8 @@
#include <opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityOilPvt.hpp>
#include <opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityWaterPvt.hpp>
#include <opm/models/blackoil/blackoillocalresidualtpfa.hh>
#include <opm/models/blackoil/blackoilconvectivemixingmodule.hh>
#include <opm/models/blackoil/blackoilmoduleparams.hh>
#include <opm/output/eclipse/EclipseIO.hpp>
@@ -148,7 +149,7 @@ private:
using DispersionModule = BlackOilDispersionModule<TypeTag, enableDispersion>;
using DiffusionModule = BlackOilDiffusionModule<TypeTag, enableDiffusion>;
using ConvectiveMixingModule = BlackOilConvectiveMixingModule<TypeTag, enableConvectiveMixing>;
using ModuleParams = typename BlackOilLocalResidualTPFA<TypeTag>::ModuleParams;
using ModuleParams = BlackoilModuleParams<ConvectiveMixingModuleParam<Scalar>>;
using HybridNewton = BlackOilHybridNewton<TypeTag>;
using InitialFluidState = typename EquilInitializer<TypeTag>::ScalarFluidState;
+21 -18
View File
@@ -44,7 +44,10 @@
#include <opm/models/discretization/common/fvbaseproperties.hh>
#include <opm/models/blackoil/blackoilproperties.hh>
#include <opm/models/utils/signum.hh>
#include <opm/models/blackoil/blackoillocalresidualtpfa.hh>
#include <opm/models/blackoil/blackoilmoduleparams.hh>
#include <opm/models/blackoil/blackoilconvectivemixingmodule.hh>
#include <opm/common/utility/gpuDecorators.hpp>
#include <array>
@@ -132,12 +135,12 @@ class NewTranExtensiveQuantities
using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
using ConvectiveMixingModule = BlackOilConvectiveMixingModule<TypeTag, enableConvectiveMixing>;
using ModuleParams = typename BlackOilLocalResidualTPFA<TypeTag>::ModuleParams;
using ModuleParams = BlackoilModuleParams<ConvectiveMixingModuleParam<Scalar>>;
public:
/*!
* \brief Return the intrinsic permeability tensor at a face [m^2]
*/
const DimMatrix& intrinsicPermeability() const
OPM_HOST_DEVICE const DimMatrix& intrinsicPermeability() const
{
throw std::invalid_argument("The ECL transmissibility module does not provide an explicit intrinsic permeability");
}
@@ -148,7 +151,7 @@ public:
*
* \param phaseIdx The index of the fluid phase
*/
const EvalDimVector& potentialGrad(unsigned) const
OPM_HOST_DEVICE const EvalDimVector& potentialGrad(unsigned) const
{
throw std::invalid_argument("The ECL transmissibility module does not provide explicit potential gradients");
}
@@ -159,7 +162,7 @@ public:
*
* \param phaseIdx The index of the fluid phase
*/
const Evaluation& pressureDifference(unsigned phaseIdx) const
OPM_HOST_DEVICE const Evaluation& pressureDifference(unsigned phaseIdx) const
{ return pressureDifference_[phaseIdx]; }
/*!
@@ -168,7 +171,7 @@ public:
*
* \param phaseIdx The index of the fluid phase
*/
const EvalDimVector& filterVelocity(unsigned) const
OPM_HOST_DEVICE const EvalDimVector& filterVelocity(unsigned) const
{
throw std::invalid_argument("The ECL transmissibility module does not provide explicit filter velocities");
}
@@ -182,7 +185,7 @@ public:
*
* \param phaseIdx The index of the fluid phase
*/
const Evaluation& volumeFlux(unsigned phaseIdx) const
OPM_HOST_DEVICE const Evaluation& volumeFlux(unsigned phaseIdx) const
{ return volumeFlux_[phaseIdx]; }
protected:
@@ -193,7 +196,7 @@ protected:
* i.e., the DOF which exhibits a higher effective pressure for
* the given phase.
*/
unsigned upstreamIndex_(unsigned phaseIdx) const
OPM_HOST_DEVICE unsigned upstreamIndex_(unsigned phaseIdx) const
{
assert(phaseIdx < numPhases);
@@ -207,22 +210,22 @@ protected:
* i.e., the DOF which exhibits a lower effective pressure for the
* given phase.
*/
unsigned downstreamIndex_(unsigned phaseIdx) const
OPM_HOST_DEVICE unsigned downstreamIndex_(unsigned phaseIdx) const
{
assert(phaseIdx < numPhases);
return dnIdx_[phaseIdx];
}
void updateSolvent(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
OPM_HOST_DEVICE void updateSolvent(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
{ asImp_().updateVolumeFluxTrans(elemCtx, scvfIdx, timeIdx); }
void updatePolymer(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
OPM_HOST_DEVICE void updatePolymer(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
{ asImp_().updateShearMultipliers(elemCtx, scvfIdx, timeIdx); }
public:
static void volumeAndPhasePressureDifferences(std::array<short, numPhases>& upIdx,
OPM_HOST_DEVICE static void volumeAndPhasePressureDifferences(std::array<short, numPhases>& upIdx,
std::array<short, numPhases>& dnIdx,
Evaluation (&volumeFlux)[numPhases],
Evaluation (&pressureDifferences)[numPhases],
@@ -307,7 +310,7 @@ public:
}
template<class EvalType>
static void calculatePhasePressureDiff_(short& upIdx,
OPM_HOST_DEVICE static void calculatePhasePressureDiff_(short& upIdx,
short& dnIdx,
EvalType& pressureDifference,
const IntensiveQuantities& intQuantsIn,
@@ -414,7 +417,7 @@ protected:
/*!
* \brief Update the required gradients for interior faces
*/
void calculateGradients_(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
OPM_HOST_DEVICE void calculateGradients_(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
{
Valgrind::SetUndefined(*this);
@@ -425,7 +428,7 @@ protected:
* \brief Update the required gradients for boundary faces
*/
template <class FluidState>
void calculateBoundaryGradients_(const ElementContext& elemCtx,
OPM_HOST_DEVICE void calculateBoundaryGradients_(const ElementContext& elemCtx,
unsigned scvfIdx,
unsigned timeIdx,
const FluidState& exFluidState)
@@ -469,7 +472,7 @@ public:
* \brief Update the required gradients for boundary faces
*/
template <class Problem, class FluidState, class EvaluationContainer>
static void calculateBoundaryGradients_(const Problem& problem,
OPM_HOST_DEVICE static void calculateBoundaryGradients_(const Problem& problem,
const unsigned globalSpaceIdx,
const IntensiveQuantities& intQuantsIn,
const unsigned bfIdx,
@@ -568,10 +571,10 @@ protected:
/*!
* \brief Update the volumetric fluxes for all fluid phases on the interior faces of the context
*/
void calculateFluxes_(const ElementContext&, unsigned, unsigned)
OPM_HOST_DEVICE void calculateFluxes_(const ElementContext&, unsigned, unsigned)
{ }
void calculateBoundaryFluxes_(const ElementContext&, unsigned, unsigned)
OPM_HOST_DEVICE void calculateBoundaryFluxes_(const ElementContext&, unsigned, unsigned)
{}
private:
@@ -121,6 +121,13 @@ public:
return m_dataPtr;
}
/**
* @return true if the view has no elements, false otherwise
*/
__host__ __device__ bool empty() const {
return m_numberOfElements == 0;
}
/**
* @return fetch the first element in a GpuView
*/