Commit 968e8292 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[mpfa][fluxvarcache] pull DirichletData out of process-specific caches

This implies that all processes use the same interaction volume on the boundaries. We typically
use the o-method on boundaries, where this is guaranteed.
parent 489d158d
......@@ -195,10 +195,6 @@ public:
const LocalFaceDataContainer& localFaceData() const
{ DUNE_THROW(Dune::NotImplemented, "Interaction volume implementation does not provide a localFaceData() method."); }
//! returns a reference to the container with the data on Dirichlet boundaries
const DirichletDataContainer& dirichletData() const
{ DUNE_THROW(Dune::NotImplemented, "Interaction volume implementation does not provide a dirichletData() method."); }
//! returns the indices of the volvars in the stencil of the interaction volume
const GlobalIndexContainer& volVarsStencil() const
{ DUNE_THROW(Dune::NotImplemented, "Interaction volume implementation does not provide a volVarsStencil() method."); }
......
......@@ -46,9 +46,8 @@ namespace Dumux
void resizeAB(unsigned int n, unsigned int m) {}
void resizeOutsideTij(unsigned int n, unsigned int m) {}
//! functions to set the pointers to stencil and Dirichlet data
//! functions to set the pointers to the stencil
void setVolVarsStencilPointer(const GlobalIndexContainer& stencil) {}
void setDirichletDataPointer(const DirichletDataContainer& data) {}
//! return functions for the stored data
const GlobalIndexContainer& volVarsStencil() const { return throw_<const GlobalIndexContainer&>(); }
......@@ -80,18 +79,16 @@ namespace Dumux
using Vector = typename InteractionVolume::Traits::DynamicVector;
public:
//! functions to set the size of the matrices
//! set the sizes of the matrices
void resizeT(unsigned int n, unsigned int m) { advectionT_.resize(n, m); }
void resizeAB(unsigned int n, unsigned int m) { advectionAB_.resize(n, m); }
void resizeOutsideTij(unsigned int n, unsigned int m) { advectionTout_.resize(n, m); }
//! functions to set the pointers to stencil and Dirichlet data
//! sets the pointer to the stencil
void setVolVarsStencilPointer(const GlobalIndexContainer& stencil) { advectionVolVarsStencil_ = &stencil; }
void setDirichletDataPointer(const DirichletDataContainer& data) { advectionDirichletData_ = &data; }
//! return functions for the stored data
const GlobalIndexContainer& volVarsStencil() const { return *advectionVolVarsStencil_; }
const DirichletDataContainer& dirichletData() const { return *advectionDirichletData_; }
const Matrix& T() const { return advectionT_; }
Matrix& T() { return advectionT_; }
......@@ -105,7 +102,6 @@ namespace Dumux
private:
// advection-related variables
const GlobalIndexContainer* advectionVolVarsStencil_; //! Pointer to the global volvar indices (stored in the interaction volume)
const DirichletDataContainer* advectionDirichletData_; //! Pointer to the container with dirichlet data of the iv
Matrix advectionT_; //! The transmissibilities
Matrix advectionAB_; //! Coefficients for gradient reconstruction
Matrix advectionTout_; //! The transmissibilities associated with "outside" faces (only necessary on surface grids)
......@@ -133,7 +129,7 @@ namespace Dumux
contextCompIdx_ = compIdx;
}
//! functions to set the size of the matrices
//! set the sizes of the matrices
void resizeT(unsigned int n, unsigned int m)
{
for (auto& array : diffusionT_)
......@@ -155,24 +151,16 @@ namespace Dumux
matrix.resize(n, m);
}
//! functions to set the pointers to stencil and Dirichlet data
//! sets the pointer to stencil
void setVolVarsStencilPointer(const GlobalIndexContainer& stencil)
{
diffusionVolVarsStencil_[contextPhaseIdx_][contextCompIdx_] = &stencil;
}
void setDirichletDataPointer(const DirichletDataContainer& data)
{
diffusionDirichletData_[contextPhaseIdx_][contextCompIdx_] = &data;
}
//! return functions for the stored data
const GlobalIndexContainer& volVarsStencil() const
{ return *diffusionVolVarsStencil_[contextPhaseIdx_][contextCompIdx_]; }
const DirichletDataContainer& dirichletData() const
{ return *diffusionDirichletData_[contextPhaseIdx_][contextCompIdx_]; }
const Matrix& T() const { return diffusionT_[contextPhaseIdx_][contextCompIdx_]; }
Matrix& T() { return diffusionT_[contextPhaseIdx_][contextCompIdx_]; }
......@@ -187,7 +175,6 @@ namespace Dumux
unsigned int contextPhaseIdx_; //! The phase index set for the context
unsigned int contextCompIdx_; //! The component index set for the context
std::array<std::array<const GlobalIndexContainer*, numComponents>, numPhases> diffusionVolVarsStencil_;
std::array<std::array<const DirichletDataContainer*, numComponents>, numPhases> diffusionDirichletData_;
std::array<std::array<Matrix, numComponents>, numPhases> diffusionT_;
std::array<std::array<Matrix, numComponents>, numPhases> diffusionAB_;
std::array<std::array<Matrix, numComponents>, numPhases> diffusionTout_;
......@@ -205,18 +192,16 @@ namespace Dumux
using Vector = typename InteractionVolume::Traits::DynamicVector;
public:
//! functions to set the size of the matrices
//! set the sizes of the matrices
void resizeT(unsigned int n, unsigned int m) { heatConductionT_.resize(n, m); }
void resizeAB(unsigned int n, unsigned int m) { heatConductionAB_.resize(n, m); }
void resizeOutsideTij(unsigned int n, unsigned int m) { heatConductionTout_.resize(n, m); }
//! functions to set the pointers to stencil and Dirichlet data
//! sets the pointer to the stencil
void setVolVarsStencilPointer(const GlobalIndexContainer& stencil) { heatConductionVolVarsStencil_ = &stencil; }
void setDirichletDataPointer(const DirichletDataContainer& data) { heatConductionDirichletData_ = &data; }
//! return functions for the stored data
const GlobalIndexContainer& volVarsStencil() const { return *heatConductionVolVarsStencil_; }
const DirichletDataContainer& dirichletData() const { return *heatConductionDirichletData_; }
const Matrix& T() const { return heatConductionT_; }
Matrix& T() { return heatConductionT_; }
......@@ -230,7 +215,6 @@ namespace Dumux
private:
// heat conduction-related variables
const GlobalIndexContainer* heatConductionVolVarsStencil_; //! Pointer to the global volvar indices (stored in the interaction volume)
const DirichletDataContainer* heatConductionDirichletData_; //! Pointer to the container with dirichlet data of the iv
Matrix heatConductionT_; //! The transmissibilities
Matrix heatConductionAB_; //! Coefficients for gradient reconstruction
Matrix heatConductionTout_; //! The transmissibilities associated with "outside" faces (only necessary on surface grids)
......@@ -282,7 +266,7 @@ namespace Dumux
//! returns the current context
Contexts getContext() const { return context_; }
//! functions to set the size of the matrices
//! set the sizes of the matrices
void resizeT(unsigned int n, unsigned int m)
{
AdvectionHandle::resizeT(n, m);
......@@ -304,7 +288,7 @@ namespace Dumux
HeatConductionHandle::resizeOutsideTij(n, m);
}
//! functions to set the pointers to stencil and Dirichlet data
//! sets the pointer to the stencil
void setVolVarsStencilPointer(const GlobalIndexContainer& stencil)
{
if (context_ == Contexts::advection)
......@@ -317,19 +301,15 @@ namespace Dumux
DUNE_THROW(Dune::InvalidStateException, "No valid context set!");
}
void setDirichletDataPointer(const DirichletDataContainer& data)
//! sets the dirichlet data container
void setDirichletData(DirichletDataContainer&& data)
{
if (context_ == Contexts::advection)
AdvectionHandle::setDirichletDataPointer(data);
else if (context_ == Contexts::diffusion)
DiffusionHandle::setDirichletDataPointer(data);
else if (context_ == Contexts::heatConduction)
HeatConductionHandle::setDirichletDataPointer(data);
else
DUNE_THROW(Dune::InvalidStateException, "No valid context set!");
dirichletData_ = std::move(data);
}
//! return functions for the stored data
const DirichletDataContainer& dirichletData() const { return dirichletData_; }
const GlobalIndexContainer& volVarsStencil() const
{
if (context_ == Contexts::advection)
......@@ -342,18 +322,6 @@ namespace Dumux
DUNE_THROW(Dune::InvalidStateException, "No valid context set!");
}
const DirichletDataContainer& dirichletData() const
{
if (context_ == Contexts::advection)
return AdvectionHandle::dirichletData();
else if (context_ == Contexts::diffusion)
return DiffusionHandle::dirichletData();
else if (context_ == Contexts::heatConduction)
return HeatConductionHandle::dirichletData();
else
DUNE_THROW(Dune::InvalidStateException, "No valid context set!");
}
const Matrix& T() const
{
if (context_ == Contexts::advection)
......@@ -427,7 +395,8 @@ namespace Dumux
}
private:
Contexts context_; //! The context variable
Contexts context_; //! The context variable
DirichletDataContainer dirichletData_; //! The dirichlet data container of this iv
};
} // end namespace Dumux
......
......@@ -202,11 +202,11 @@ public:
{
const auto globalScvfIdx = indexSet.nodalIndexSet().scvfIdxGlobal(outsideLocalScvIdx, coord);
const auto& flipScvf = fvGeometry.scvf(globalScvfIdx);
localFaceData_.emplace_back(faceIdxLocal, //! iv-local scvf idx
outsideLocalScvIdx, //! iv-local scv index
numOutsideFaces_++, //! iv-local index in outside faces
i-1, //! scvf-local index in outside faces
flipScvf.index()); //! global scvf index
localFaceData_.emplace_back(faceIdxLocal, //! iv-local scvf idx
outsideLocalScvIdx, //! iv-local scv index
numOutsideFaces_++, //! iv-local index in outside faces
i-1, //! scvf-local index in outside faces
flipScvf.index()); //! global scvf index
}
}
}
......@@ -226,6 +226,9 @@ public:
// resize the transmissibility matrix in the data handle
dataHandle.resizeT(numFaces_, numPotentials_);
// move the dirichlet data into the handle
dataHandle.setDirichletData(std::move(dirichletData_));
// resize possible additional containers in the data handle
if (requireABMatrix_())
dataHandle.resizeAB(numUnknowns_, numPotentials_);
......@@ -261,9 +264,8 @@ public:
dataHandle.AB() = B_.leftmultiply(A_);
}
// // set vol vars stencil & positions pointer in handle
// set vol vars stencil pointer in handle
dataHandle.setVolVarsStencilPointer(indexSet().globalScvIndices());
dataHandle.setDirichletDataPointer(dirichletData_);
// on surface grids, additionally prepare the outside transmissibilities
if (dim < dimWorld)
......@@ -291,9 +293,6 @@ public:
//! returns the local scv entity corresponding to a given iv-local scv idx
const LocalScvType& localScv(const LocalIndexType ivLocalScvfIdx) const { return scvs_[ivLocalScvfIdx]; }
//! returns a reference to the container with the data on Dirichlet boundaries
const DirichletDataContainer& dirichletData() const { return dirichletData_; }
//! returns a reference to the container with the local face data
const std::vector<LocalFaceData>& localFaceData() const { return localFaceData_; }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment