Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/models/blackoil/blackoillocalresidualtpfa.hh
opm/models/blackoil/blackoilmeanings.hh
opm/models/blackoil/blackoilmodel.hh
opm/models/blackoil/blackoilmoduleparams.hh
opm/models/blackoil/blackoilnewtonmethod.hpp
opm/models/blackoil/blackoilnewtonmethodparams.hpp
opm/models/blackoil/blackoilonephaseindices.hh
Expand Down
16 changes: 16 additions & 0 deletions flowexperimental/BlackOilIntensiveQuantitiesGlobalIndex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,22 @@ class BlackOilIntensiveQuantitiesGlobalIndex
throw std::logic_error("permFactor() is not yet implemented for compositional modeling");
}

/*!
* \brief Returns the fluid system used by this intensive quantities.
*/
OPM_HOST_DEVICE auto& getFluidSystem() const
{
return fluidState_.fluidSystem();
}

/*!
* \brief Returns a pointer to the fluid system used by this intensive quantities.
*/
OPM_HOST_DEVICE auto getFluidSystemPtr() const
{
return fluidState_.fluidSystemPtr();
}

private:
friend BlackOilSolventIntensiveQuantities<TypeTag, enableSolvent>;
friend BlackOilExtboIntensiveQuantities<TypeTag, enableExtbo>;
Expand Down
145 changes: 90 additions & 55 deletions opm/models/blackoil/blackoilconvectivemixingmodule.hh

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions opm/models/blackoil/blackoilintensivequantities.hh
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,22 @@ public:
}
}

/*!
* \brief Returns the fluid system used by this intensive quantities.
*/
OPM_HOST_DEVICE auto& getFluidSystem() const
{
return fluidState_.fluidSystem();
}

/*!
* \brief Returns a pointer to the fluid system used by this intensive quantities.
*/
OPM_HOST_DEVICE auto getFluidSystemPtr() const
{
return fluidState_.fluidSystemPtr();
}

private:
friend BlackOilSolventIntensiveQuantities<TypeTag, enableSolvent>;
friend BlackOilExtboIntensiveQuantities<TypeTag, enableExtbo>;
Expand Down
8 changes: 2 additions & 6 deletions opm/models/blackoil/blackoillocalresidualtpfa.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <opm/models/blackoil/blackoilenergymodules.hh>
#include <opm/models/blackoil/blackoilextbomodules.hh>
#include <opm/models/blackoil/blackoilfoammodules.hh>
#include <opm/models/blackoil/blackoilmoduleparams.hh>
#include <opm/models/blackoil/blackoilpolymermodules.hh>
#include <opm/models/blackoil/blackoilproperties.hh>
#include <opm/models/blackoil/blackoilsolventmodules.hh>
Expand Down Expand Up @@ -117,7 +118,7 @@ class BlackOilLocalResidualTPFA : public GetPropType<TypeTag, Properties::DiscLo
using BrineModule = BlackOilBrineModule<TypeTag>;
using DiffusionModule = BlackOilDiffusionModule<TypeTag, enableDiffusion>;
using ConvectiveMixingModule = BlackOilConvectiveMixingModule<TypeTag, enableConvectiveMixing>;
using ConvectiveMixingModuleParam = typename ConvectiveMixingModule::ConvectiveMixingModuleParam;
using ModuleParams = BlackoilModuleParams<ConvectiveMixingModuleParam<Scalar>>;

using DispersionModule = BlackOilDispersionModule<TypeTag, enableDispersion>;
using BioeffectsModule = BlackOilBioeffectsModule<TypeTag>;
Expand All @@ -140,11 +141,6 @@ public:
ConditionalStorage<enableDispersion, double> dispersivity;
};

struct ModuleParams
{
ConvectiveMixingModuleParam convectiveMixingModuleParam;
};

/*!
* \copydoc FvBaseLocalResidual::computeStorage
*/
Expand Down
27 changes: 27 additions & 0 deletions opm/models/blackoil/blackoilmoduleparams.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright 2025 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 <http://www.gnu.org/licenses/>.
*/

#ifndef OPM_MODELS_BLACKOIL_MODULEPARAM_HH
#define OPM_MODELS_BLACKOIL_MODULEPARAM_HH

namespace Opm {
template<class ConvectiveMixingModuleParamT>
struct BlackoilModuleParams
{
ConvectiveMixingModuleParamT convectiveMixingModuleParam;
};
} // namespace Opm

#endif // OPM_MODELS_BLACKOIL_MODULEPARAM_HH
5 changes: 3 additions & 2 deletions opm/simulators/flow/FlowProblemBlackoil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -149,7 +150,7 @@ class FlowProblemBlackoil : public FlowProblem<TypeTag>
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;
Expand Down
39 changes: 21 additions & 18 deletions opm/simulators/flow/NewTranFluxModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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");
}
Expand All @@ -148,7 +151,7 @@ class NewTranExtensiveQuantities
*
* \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");
}
Expand All @@ -159,7 +162,7 @@ class NewTranExtensiveQuantities
*
* \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]; }

/*!
Expand All @@ -168,7 +171,7 @@ class NewTranExtensiveQuantities
*
* \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");
}
Expand All @@ -182,7 +185,7 @@ class NewTranExtensiveQuantities
*
* \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:
Expand All @@ -193,7 +196,7 @@ class NewTranExtensiveQuantities
* 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);

Expand All @@ -207,22 +210,22 @@ class NewTranExtensiveQuantities
* 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],
Expand Down Expand Up @@ -307,7 +310,7 @@ class NewTranExtensiveQuantities
}

template<class EvalType>
static void calculatePhasePressureDiff_(short& upIdx,
OPM_HOST_DEVICE static void calculatePhasePressureDiff_(short& upIdx,
short& dnIdx,
EvalType& pressureDifference,
const IntensiveQuantities& intQuantsIn,
Expand Down Expand Up @@ -414,7 +417,7 @@ class NewTranExtensiveQuantities
/*!
* \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);

Expand All @@ -425,7 +428,7 @@ class NewTranExtensiveQuantities
* \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)
Expand Down Expand Up @@ -469,7 +472,7 @@ class NewTranExtensiveQuantities
* \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,
Expand Down Expand Up @@ -568,10 +571,10 @@ class NewTranExtensiveQuantities
/*!
* \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:
Expand Down