Skip to content
Snippets Groups Projects
Commit db6ae101 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[mpfa][pmfluxvarcache] build up cache in a modular fashion

parent 6dcf673b
No related branches found
No related tags found
2 merge requests!617[WIP] Next,!308Feature/mpfacleanup
...@@ -155,49 +155,36 @@ private: ...@@ -155,49 +155,36 @@ private:
Scalar tij_; Scalar tij_;
}; };
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//! Classes building up the porous medium flux variables cache for mpfa methods
//! The cache is dependent on the active physical processes (advection, diffusion, heat conduction)
//! For each type of process there is a base cache storing the data required to compute the respective fluxes
//! Specializations of the overall cache are provided for combinations of processes
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// forward declaration of the base class of the mpfa flux variables cache // forward declaration of the base class of the mpfa flux variables cache
template<class TypeTag, bool EnableAdvection, bool EnableMolecularDiffusion, bool EnableEnergyBalance> template<class TypeTag, bool EnableAdvection, bool EnableMolecularDiffusion, bool EnableEnergyBalance>
class MpfaPorousMediumFluxVariablesCache class MpfaPorousMediumFluxVariablesCache {};
{};
// specialization for cell centered mpfa methods //! Base class for the advective cache in mpfa methods
template<class TypeTag> template<class TypeTag>
class PorousMediumFluxVariablesCacheImplementation<TypeTag, DiscretizationMethods::CCMpfa> class MpfaAdvectionCache
: public MpfaPorousMediumFluxVariablesCache<TypeTag,
GET_PROP_VALUE(TypeTag, EnableAdvection),
GET_PROP_VALUE(TypeTag, EnableMolecularDiffusion),
GET_PROP_VALUE(TypeTag, EnableEnergyBalance)>
{};
// specialization for the case of pure advection
template<class TypeTag>
class MpfaPorousMediumFluxVariablesCache<TypeTag, true, false, false>
{ {
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables);
using BoundaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, BoundaryInteractionVolume);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using Element = typename GridView::template Codim<0>::Entity; using BoundaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, BoundaryInteractionVolume);
using IndexType = typename GridView::IndexSet::IndexType;
static const int numPhases = GET_PROP_VALUE(TypeTag, NumPhases); static const int numPhases = GET_PROP_VALUE(TypeTag, NumPhases);
// We always use the dynamic types here to be compatible on the boundary // We always use the dynamic types here to be compatible on the boundary
using IndexType = typename GridView::IndexSet::IndexType;
using Stencil = typename BoundaryInteractionVolume::GlobalIndexSet; using Stencil = typename BoundaryInteractionVolume::GlobalIndexSet;
using TransmissibilityVector = typename BoundaryInteractionVolume::Vector; using TransmissibilityVector = typename BoundaryInteractionVolume::Vector;
using PositionVector = typename BoundaryInteractionVolume::PositionVector; using PositionVector = typename BoundaryInteractionVolume::PositionVector;
public: public:
//! the constructor MpfaAdvectionCache() { phaseNeumannFluxes_.fill(0.0); }
MpfaPorousMediumFluxVariablesCache() : isUpdated_(false)
{
// We have to initialize the neumann fluxes to zero (for inner interaction volumes)
phaseNeumannFluxes_.fill(0.0);
}
//! update cached objects //! update cached objects
template<typename InteractionVolume> template<typename InteractionVolume>
...@@ -241,64 +228,33 @@ public: ...@@ -241,64 +228,33 @@ public:
Scalar advectionNeumannFlux(const unsigned int phaseIdx) const Scalar advectionNeumannFlux(const unsigned int phaseIdx) const
{ return phaseNeumannFluxes_[phaseIdx]; } { return phaseNeumannFluxes_[phaseIdx]; }
//! Returns whether or not this cache has been updated
bool isUpdated() const
{ return isUpdated_; }
//! Sets the update status from outside. Allows an update of the cache specific
//! to processes that have solution dependent parameters, e.g. only updating
//! the diffusion transmissibilities leaving the advective ones untouched
void setUpdateStatus(const bool status)
{
isUpdated_ = status;
}
private: private:
bool isUpdated_; // Quantities associated with advection
Stencil volVarsStencil_; Stencil volVarsStencil_;
PositionVector volVarsPositions_; PositionVector volVarsPositions_;
TransmissibilityVector tij_; TransmissibilityVector tij_;
std::array<Scalar, numPhases> phaseNeumannFluxes_; std::array<Scalar, numPhases> phaseNeumannFluxes_;
}; };
// specialization for the case of advection & diffusion //! Base class for the diffusive cache in mpfa methods
template<class TypeTag> template<class TypeTag>
class MpfaPorousMediumFluxVariablesCache<TypeTag, true, true, false> class MpfaDiffusionCache
{ {
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables);
using BoundaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, BoundaryInteractionVolume);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using Element = typename GridView::template Codim<0>::Entity; using BoundaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, BoundaryInteractionVolume);
using IndexType = typename GridView::IndexSet::IndexType;
static const int numPhases = GET_PROP_VALUE(TypeTag, NumPhases); static const int numPhases = GET_PROP_VALUE(TypeTag, NumPhases);
static const int numComponents = GET_PROP_VALUE(TypeTag, NumComponents); static const int numComponents = GET_PROP_VALUE(TypeTag, NumComponents);
// We always use the dynamic types here to be compatible on the boundary // We always use the dynamic types here to be compatible on the boundary
using IndexType = typename GridView::IndexSet::IndexType;
using Stencil = typename BoundaryInteractionVolume::GlobalIndexSet; using Stencil = typename BoundaryInteractionVolume::GlobalIndexSet;
using TransmissibilityVector = typename BoundaryInteractionVolume::Vector; using TransmissibilityVector = typename BoundaryInteractionVolume::Vector;
using PositionVector = typename BoundaryInteractionVolume::PositionVector; using PositionVector = typename BoundaryInteractionVolume::PositionVector;
public: public:
// the constructor
MpfaPorousMediumFluxVariablesCache() : isUpdated_(false) {}
// update cached objects for the advective fluxes
template<typename InteractionVolume>
void updateAdvection(const SubControlVolumeFace &scvf,
const InteractionVolume& interactionVolume)
{
const auto& localFaceData = interactionVolume.getLocalFaceData(scvf);
advectionVolVarsStencil_ = interactionVolume.volVarsStencil();
advectionVolVarsPositions_ = interactionVolume.volVarsPositions();
advectionTij_ = interactionVolume.getTransmissibilities(localFaceData);
}
// update cached objects for the diffusive fluxes // update cached objects for the diffusive fluxes
template<typename InteractionVolume> template<typename InteractionVolume>
void updateDiffusion(const SubControlVolumeFace &scvf, void updateDiffusion(const SubControlVolumeFace &scvf,
...@@ -311,29 +267,6 @@ public: ...@@ -311,29 +267,6 @@ public:
diffusionTij_[phaseIdx][compIdx] = interactionVolume.getTransmissibilities(localFaceData); diffusionTij_[phaseIdx][compIdx] = interactionVolume.getTransmissibilities(localFaceData);
} }
//! This method is here for compatibility reasons
//! TODO: How to implement neumann fluxes for !useTpfa when diffusion is active?
template<typename InteractionVolume>
void updatePhaseNeumannFlux(const SubControlVolumeFace &scvf,
const InteractionVolume& interactionVolume,
const unsigned int phaseIdx) {}
//! Returns the volume variables indices necessary for flux computation
//! This includes all participating boundary volume variables. Since we
//! do not allow mixed BC for the mpfa this is the same for all phases.
const Stencil& advectionVolVarsStencil(const unsigned int phaseIdx) const
{ return advectionVolVarsStencil_; }
//! Returns the position on which the volume variables live. This is
//! necessary as we need to evaluate gravity also for the boundary volvars
const PositionVector& advectionVolVarsPositions(const unsigned int phaseIdx) const
{ return advectionVolVarsPositions_; }
//! Returns the transmissibilities associated with the volume variables
//! All phases flow through the same rock, thus, tij are equal for all phases
const TransmissibilityVector& advectionTij(const unsigned int phaseIdx) const
{ return advectionTij_; }
//! Returns the volume variables indices necessary for diffusive flux //! Returns the volume variables indices necessary for diffusive flux
//! computation. This includes all participating boundary volume variables //! computation. This includes all participating boundary volume variables
//! and it can be different for the phases & components. //! and it can be different for the phases & components.
...@@ -347,77 +280,27 @@ public: ...@@ -347,77 +280,27 @@ public:
const unsigned int compIdx) const const unsigned int compIdx) const
{ return diffusionTij_[phaseIdx][compIdx]; } { return diffusionTij_[phaseIdx][compIdx]; }
//! This method is needed for compatibility reasons
//! TODO: How to implement neumann fluxes for !useTpfa when diffusion is active?
Scalar advectionNeumannFlux(const unsigned int phaseIdx) const
{ return 0.0; }
//! Returns whether or not this cache has been updated
bool isUpdated() const
{ return isUpdated_; }
//! Sets the update status from outside. Allows an update of the cache specific
//! to processes that have solution dependent parameters, e.g. only updating
//! the diffusion transmissibilities leaving the advective ones untouched
void setUpdateStatus(const bool status)
{
isUpdated_ = status;
}
private: private:
bool isUpdated_;
// Quantities associated with advection
Stencil advectionVolVarsStencil_;
PositionVector advectionVolVarsPositions_;
TransmissibilityVector advectionTij_;
// Quantities associated with molecular diffusion // Quantities associated with molecular diffusion
std::array< std::array<Stencil, numComponents>, numPhases> diffusionVolVarsStencils_; std::array< std::array<Stencil, numComponents>, numPhases> diffusionVolVarsStencils_;
std::array< std::array<TransmissibilityVector, numComponents>, numPhases> diffusionTij_; std::array< std::array<TransmissibilityVector, numComponents>, numPhases> diffusionTij_;
}; };
// specialization for the case of advection & heat conduction //! Base class for the heat conduction cache in mpfa methods
template<class TypeTag> template<class TypeTag>
class MpfaPorousMediumFluxVariablesCache<TypeTag, true, false, true> class MpfaHeatConductionCache
{ {
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables);
using BoundaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, BoundaryInteractionVolume);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using Element = typename GridView::template Codim<0>::Entity; using BoundaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, BoundaryInteractionVolume);
using IndexType = typename GridView::IndexSet::IndexType;
static const int numPhases = GET_PROP_VALUE(TypeTag, NumPhases);
// We always use the dynamic types here to be compatible on the boundary // We always use the dynamic types here to be compatible on the boundary
using IndexType = typename GridView::IndexSet::IndexType;
using Stencil = typename BoundaryInteractionVolume::GlobalIndexSet; using Stencil = typename BoundaryInteractionVolume::GlobalIndexSet;
using TransmissibilityVector = typename BoundaryInteractionVolume::Vector; using TransmissibilityVector = typename BoundaryInteractionVolume::Vector;
using PositionVector = typename BoundaryInteractionVolume::PositionVector;
public: public:
// the constructor MpfaHeatConductionCache() : heatNeumannFlux_(0.0) {}
MpfaPorousMediumFluxVariablesCache()
: isUpdated_(false),
heatNeumannFlux_(0.0)
{
// We have to initialize the neumann fluxes to zero (for inner interaction volumes)
phaseNeumannFluxes_.fill(0.0);
}
// update cached objects for the advective fluxes
template<typename InteractionVolume>
void updateAdvection(const SubControlVolumeFace &scvf,
const InteractionVolume& interactionVolume)
{
const auto& localFaceData = interactionVolume.getLocalFaceData(scvf);
advectionVolVarsStencil_ = interactionVolume.volVarsStencil();
advectionVolVarsPositions_ = interactionVolume.volVarsPositions();
advectionTij_ = interactionVolume.getTransmissibilities(localFaceData);
}
// update cached objects for heat conduction // update cached objects for heat conduction
template<typename InteractionVolume> template<typename InteractionVolume>
...@@ -429,42 +312,6 @@ public: ...@@ -429,42 +312,6 @@ public:
heatConductionTij_ = interactionVolume.getTransmissibilities(localFaceData); heatConductionTij_ = interactionVolume.getTransmissibilities(localFaceData);
} }
//! update cached neumann boundary flux
template<typename InteractionVolume>
void updatePhaseNeumannFlux(const SubControlVolumeFace &scvf,
const InteractionVolume& interactionVolume,
const unsigned int phaseIdx)
{
const auto& localFaceData = interactionVolume.getLocalFaceData(scvf);
phaseNeumannFluxes_[phaseIdx] = interactionVolume.getNeumannFlux(localFaceData);
}
//! update cached neumann boundary flux
template<typename InteractionVolume>
void updateHeatNeumannFlux(const SubControlVolumeFace &scvf,
const InteractionVolume& interactionVolume,
const unsigned int phaseIdx)
{
const auto& localFaceData = interactionVolume.getLocalFaceData(scvf);
heatNeumannFlux_ = interactionVolume.getNeumannFlux(localFaceData);
}
//! Returns the volume variables indices necessary for flux computation
//! This includes all participating boundary volume variables. Since we
//! do not allow mixed BC for the mpfa this is the same for all phases.
const Stencil& advectionVolVarsStencil(const unsigned int phaseIdx) const
{ return advectionVolVarsStencil_; }
//! Returns the position on which the volume variables live. This is
//! necessary as we need to evaluate gravity also for the boundary volvars
const PositionVector& advectionVolVarsPositions(const unsigned int phaseIdx) const
{ return advectionVolVarsPositions_; }
//! Returns the transmissibilities associated with the volume variables
//! All phases flow through the same rock, thus, tij are equal for all phases
const TransmissibilityVector& advectionTij(const unsigned int phaseIdx) const
{ return advectionTij_; }
//! Returns the volume variables indices necessary for heat conduction flux //! Returns the volume variables indices necessary for heat conduction flux
//! computation. This includes all participating boundary volume variables //! computation. This includes all participating boundary volume variables
//! and it can be different for the phases & components. //! and it can be different for the phases & components.
...@@ -476,16 +323,40 @@ public: ...@@ -476,16 +323,40 @@ public:
const TransmissibilityVector& heatConductionTij() const const TransmissibilityVector& heatConductionTij() const
{ return heatConductionTij_; } { return heatConductionTij_; }
//! If the useTpfaBoundary property is set to false, the boundary conditions
//! are put into the local systems leading to possible contributions on all faces
Scalar advectionNeumannFlux(const unsigned int phaseIdx) const
{ return phaseNeumannFluxes_[phaseIdx]; }
//! If the useTpfaBoundary property is set to false, the boundary conditions //! If the useTpfaBoundary property is set to false, the boundary conditions
//! are put into the local systems leading to possible contributions on all faces //! are put into the local systems leading to possible contributions on all faces
Scalar heatNeumannFlux() const Scalar heatNeumannFlux() const
{ return heatNeumannFlux_; } { return heatNeumannFlux_; }
private:
// Quantities associated with heat conduction
Stencil heatConductionVolVarsStencil_;
TransmissibilityVector heatConductionTij_;
Scalar heatNeumannFlux_;
};
// specialization of the flux variables cache for cell centered mpfa methods
template<class TypeTag>
class PorousMediumFluxVariablesCacheImplementation<TypeTag, DiscretizationMethods::CCMpfa>
: public MpfaPorousMediumFluxVariablesCache<TypeTag,
GET_PROP_VALUE(TypeTag, EnableAdvection),
GET_PROP_VALUE(TypeTag, EnableMolecularDiffusion),
GET_PROP_VALUE(TypeTag, EnableEnergyBalance)> {};
// specialization for the case of pure advection
template<class TypeTag>
class MpfaPorousMediumFluxVariablesCache<TypeTag, true, false, false>
: public MpfaAdvectionCache<TypeTag>
{
using AdvectionCache = MpfaAdvectionCache<TypeTag>;
public:
//! the constructor
MpfaPorousMediumFluxVariablesCache()
: AdvectionCache(),
isUpdated_(false)
{}
//! Returns whether or not this cache has been updated //! Returns whether or not this cache has been updated
bool isUpdated() const bool isUpdated() const
{ return isUpdated_; } { return isUpdated_; }
...@@ -500,148 +371,123 @@ public: ...@@ -500,148 +371,123 @@ public:
private: private:
bool isUpdated_; bool isUpdated_;
// Quantities associated with advection
Stencil advectionVolVarsStencil_;
PositionVector advectionVolVarsPositions_;
TransmissibilityVector advectionTij_;
std::array<Scalar, numPhases> phaseNeumannFluxes_;
// Quantities associated with heat conduction
Stencil heatConductionVolVarsStencil_;
TransmissibilityVector heatConductionTij_;
Scalar heatNeumannFlux_;
}; };
// specialization for the case of advection, diffusion & heat conduction // specialization for the case of advection & diffusion
template<class TypeTag> template<class TypeTag>
class MpfaPorousMediumFluxVariablesCache<TypeTag, true, true, true> class MpfaPorousMediumFluxVariablesCache<TypeTag, true, true, false>
: public MpfaAdvectionCache<TypeTag>,
public MpfaDiffusionCache<TypeTag>
{ {
using AdvectionCache = MpfaAdvectionCache<TypeTag>;
using DiffusionCache = MpfaDiffusionCache<TypeTag>;
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables);
using BoundaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, BoundaryInteractionVolume);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using Element = typename GridView::template Codim<0>::Entity;
using IndexType = typename GridView::IndexSet::IndexType;
static const int numPhases = GET_PROP_VALUE(TypeTag, NumPhases);
static const int numComponents = GET_PROP_VALUE(TypeTag, NumComponents);
// We always use the dynamic types here to be compatible on the boundary
using Stencil = typename BoundaryInteractionVolume::GlobalIndexSet;
using TransmissibilityVector = typename BoundaryInteractionVolume::Vector;
using PositionVector = typename BoundaryInteractionVolume::PositionVector;
public: public:
// the constructor // the constructor
MpfaPorousMediumFluxVariablesCache() MpfaPorousMediumFluxVariablesCache()
: isUpdated_(false), : AdvectionCache(),
heatNeumannFlux_(0.0) DiffusionCache(),
isUpdated_(false)
{} {}
// update cached objects for the advective fluxes //! For compositional problems, neumann fluxes are not associated with a phase anymore
//! TODO: How to implement neumann fluxes for !useTpfa
template<typename InteractionVolume> template<typename InteractionVolume>
void updateAdvection(const SubControlVolumeFace &scvf, void updatePhaseNeumannFlux(const SubControlVolumeFace &scvf,
const InteractionVolume& interactionVolume) const InteractionVolume& interactionVolume,
{ const unsigned int phaseIdx) {}
const auto& localFaceData = interactionVolume.getLocalFaceData(scvf);
advectionVolVarsStencil_ = interactionVolume.volVarsStencil();
advectionVolVarsPositions_ = interactionVolume.volVarsPositions();
advectionTij_ = interactionVolume.getTransmissibilities(localFaceData);
}
// update cached objects for the diffusive fluxes //! TODO: How to implement neumann fluxes for !useTpfa
template<typename InteractionVolume> Scalar advectionNeumannFlux(const unsigned int phaseIdx) const
void updateDiffusion(const SubControlVolumeFace &scvf, { return 0.0; }
const InteractionVolume& interactionVolume,
const unsigned int phaseIdx,
const unsigned int compIdx)
{
const auto& localFaceData = interactionVolume.getLocalFaceData(scvf);
diffusionVolVarsStencils_[phaseIdx][compIdx] = interactionVolume.volVarsStencil();
diffusionTij_[phaseIdx][compIdx] = interactionVolume.getTransmissibilities(localFaceData);
}
// update cached objects for heat conduction //! Returns whether or not this cache has been updated
template<typename InteractionVolume> bool isUpdated() const
void updateHeatConduction(const SubControlVolumeFace &scvf, { return isUpdated_; }
const InteractionVolume& interactionVolume)
//! Sets the update status from outside. Allows an update of the cache specific
//! to processes that have solution dependent parameters, e.g. only updating
//! the diffusion transmissibilities leaving the advective ones untouched
void setUpdateStatus(const bool status)
{ {
const auto& localFaceData = interactionVolume.getLocalFaceData(scvf); isUpdated_ = status;
heatConductionVolVarsStencil_ = interactionVolume.volVarsStencil();
heatConductionTij_ = interactionVolume.getTransmissibilities(localFaceData);
} }
//! update cached neumann boundary flux private:
template<typename InteractionVolume> bool isUpdated_;
void updateHeatNeumannFlux(const SubControlVolumeFace &scvf, };
const InteractionVolume& interactionVolume,
const unsigned int phaseIdx) // specialization for the case of advection & heat conduction
template<class TypeTag>
class MpfaPorousMediumFluxVariablesCache<TypeTag, true, false, true>
: public MpfaAdvectionCache<TypeTag>,
public MpfaHeatConductionCache<TypeTag>
{
using AdvectionCache = MpfaAdvectionCache<TypeTag>;
using HeatConductionCache = MpfaHeatConductionCache<TypeTag>;
public:
// the constructor
MpfaPorousMediumFluxVariablesCache()
: AdvectionCache(),
HeatConductionCache(),
isUpdated_(false)
{}
//! Returns whether or not this cache has been updated
bool isUpdated() const
{ return isUpdated_; }
//! Sets the update status from outside. Allows an update of the cache specific
//! to processes that have solution dependent parameters, e.g. only updating
//! the diffusion transmissibilities leaving the advective ones untouched
void setUpdateStatus(const bool status)
{ {
const auto& localFaceData = interactionVolume.getLocalFaceData(scvf); isUpdated_ = status;
heatNeumannFlux_ = interactionVolume.getNeumannFlux(localFaceData);
} }
//! This method is here for compatibility reasons private:
bool isUpdated_;
};
// specialization for the case of advection, diffusion & heat conduction
template<class TypeTag>
class MpfaPorousMediumFluxVariablesCache<TypeTag, true, true, true>
: public MpfaAdvectionCache<TypeTag>,
public MpfaDiffusionCache<TypeTag>,
public MpfaHeatConductionCache<TypeTag>
{
using AdvectionCache = MpfaAdvectionCache<TypeTag>;
using DiffusionCache = MpfaDiffusionCache<TypeTag>;
using HeatConductionCache = MpfaHeatConductionCache<TypeTag>;
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
public:
// the constructor
MpfaPorousMediumFluxVariablesCache()
: AdvectionCache(),
DiffusionCache(),
HeatConductionCache(),
isUpdated_(false)
{}
//! TODO: How to implement neumann fluxes for !useTpfa when diffusion/heat conduction is active? //! TODO: How to implement neumann fluxes for !useTpfa when diffusion/heat conduction is active?
template<typename InteractionVolume> template<typename InteractionVolume>
void updatePhaseNeumannFlux(const SubControlVolumeFace &scvf, void updatePhaseNeumannFlux(const SubControlVolumeFace &scvf,
const InteractionVolume& interactionVolume, const InteractionVolume& interactionVolume,
const unsigned int phaseIdx) {} const unsigned int phaseIdx) {}
//! Returns the volume variables indices necessary for flux computation
//! This includes all participating boundary volume variables. Since we
//! do not allow mixed BC for the mpfa this is the same for all phases.
const Stencil& advectionVolVarsStencil(const unsigned int phaseIdx) const
{ return advectionVolVarsStencil_; }
//! Returns the position on which the volume variables live. This is
//! necessary as we need to evaluate gravity also for the boundary volvars
const PositionVector& advectionVolVarsPositions(const unsigned int phaseIdx) const
{ return advectionVolVarsPositions_; }
//! Returns the transmissibilities associated with the volume variables
//! All phases flow through the same rock, thus, tij are equal for all phases
const TransmissibilityVector& advectionTij(const unsigned int phaseIdx) const
{ return advectionTij_; }
//! Returns the volume variables indices necessary for diffusive flux
//! computation. This includes all participating boundary volume variables
//! and it can be different for the phases & components.
const Stencil& diffusionVolVarsStencil(const unsigned int phaseIdx,
const unsigned int compIdx) const
{ return diffusionVolVarsStencils_[phaseIdx][compIdx]; }
//! Returns the transmissibilities associated with the volume variables
//! This can be different for the phases & components.
const TransmissibilityVector& diffusionTij(const unsigned int phaseIdx,
const unsigned int compIdx) const
{ return diffusionTij_[phaseIdx][compIdx]; }
//! Returns the volume variables indices necessary for heat conduction flux
//! computation. This includes all participating boundary volume variables
//! and it can be different for the phases & components.
const Stencil& heatConductionVolVarsStencil() const
{ return heatConductionVolVarsStencil_; }
//! Returns the transmissibilities associated with the volume variables
//! This can be different for the phases & components.
const TransmissibilityVector& heatConductionTij() const
{ return heatConductionTij_; }
//! This method is needed for compatibility reasons //! This method is needed for compatibility reasons
//! TODO: How to implement neumann fluxes for !useTpfa when diffusion is active? //! TODO: How to implement neumann fluxes for !useTpfa when diffusion is active?
Scalar advectionNeumannFlux(const unsigned int phaseIdx) const Scalar advectionNeumannFlux(const unsigned int phaseIdx) const
{ return 0.0; } { return 0.0; }
//! If the useTpfaBoundary property is set to false, the boundary conditions
//! are put into the local systems leading to possible contributions on all faces
Scalar heatNeumannFlux() const
{ return heatNeumannFlux_; }
//! Returns whether or not this cache has been updated //! Returns whether or not this cache has been updated
bool isUpdated() const bool isUpdated() const
{ return isUpdated_; } { return isUpdated_; }
...@@ -656,19 +502,6 @@ public: ...@@ -656,19 +502,6 @@ public:
private: private:
bool isUpdated_; bool isUpdated_;
// Quantities associated with advection
Stencil advectionVolVarsStencil_;
PositionVector advectionVolVarsPositions_;
TransmissibilityVector advectionTij_;
// Quantities associated with molecular diffusion
std::array< std::array<Stencil, numComponents>, numPhases> diffusionVolVarsStencils_;
std::array< std::array<TransmissibilityVector, numComponents>, numPhases> diffusionTij_;
// Quantities associated with heat conduction
Stencil heatConductionVolVarsStencil_;
TransmissibilityVector heatConductionTij_;
Scalar heatNeumannFlux_;
}; };
} // end namespace } // end namespace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment