Commit 54e9f2e4 authored by Martin Schneider's avatar Martin Schneider Committed by Timo Koch
Browse files

[ccwmpfa] Update stencils and related boundary volVars

parent 08d303cd
...@@ -112,6 +112,17 @@ namespace CCWMpfa { ...@@ -112,6 +112,17 @@ namespace CCWMpfa {
volVars.emplace_back(std::move(dirichletVolVars)); volVars.emplace_back(std::move(dirichletVolVars));
volVarIndices.push_back(scvf.outsideScvIdx()); volVarIndices.push_back(scvf.outsideScvIdx());
} }
else
{
VolumeVariables dirichletVolVars;
dirichletVolVars.update(elementSolution<FVElemGeom>(problem.dirichlet(element, scvf)),
problem,
element,
scvI);
volVars.emplace_back(std::move(dirichletVolVars));
volVarIndices.push_back(scvf.outsideScvIdx());
}
} }
} }
return std::make_pair(volVars, volVarIndices); return std::make_pair(volVars, volVarIndices);
...@@ -175,30 +186,30 @@ public: ...@@ -175,30 +186,30 @@ public:
const FVElementGeometry& fvGeometry, const FVElementGeometry& fvGeometry,
const SolutionVector& sol) const SolutionVector& sol)
{ {
if (!fvGeometry.hasBoundaryScvf())
return;
clear_(); clear_();
auto&& [volVars, indices] = CCWMpfa::boundaryVolVars<VolumeVariables, std::size_t>(gridVolVars().problem(), element, fvGeometry); if (fvGeometry.hasBoundaryScvf())
std::move(volVars.begin(), volVars.end(), std::back_inserter(boundaryVolumeVariables_)); {
std::move(indices.begin(), indices.end(), std::back_inserter(boundaryVolVarIndices_)); auto&& [volVars, indices] = CCWMpfa::boundaryVolVars<VolumeVariables, std::size_t>(gridVolVars().problem(), element, fvGeometry);
std::move(volVars.begin(), volVars.end(), std::back_inserter(boundaryVolumeVariables_));
std::move(indices.begin(), indices.end(), std::back_inserter(boundaryVolVarIndices_));
}
const auto& gridGeometry = fvGeometry.gridGeometry();
const auto globalI = gridGeometry.elementMapper().index(element);
const auto& assemblyMapI = gridGeometry.connectivityMap()[globalI];
// add boundary volVars of neighbors // add boundary volVars of neighbors
for (const auto& scvf : scvfs(fvGeometry)) for (const auto& dataJ : assemblyMapI)
{ {
if (scvf.boundary()) const auto& elementJ = gridGeometry.element(dataJ.globalJ);
continue; auto fvGeometryJ = localView(gridGeometry);
fvGeometryJ.bind(elementJ);
const auto outsideScvIdx = scvf.outsideScvIdx();
const auto outsideElement = fvGeometry.gridGeometry().element(outsideScvIdx);
auto fvGeometryJ = localView(fvGeometry.gridGeometry());
fvGeometryJ.bind(outsideElement);
if (!fvGeometryJ.hasBoundaryScvf()) if (!fvGeometryJ.hasBoundaryScvf())
continue; continue;
auto&& [volVars, indices] = CCWMpfa::boundaryVolVars<VolumeVariables, std::size_t>(gridVolVars().problem(), outsideElement, fvGeometryJ); auto&& [volVars, indices] = CCWMpfa::boundaryVolVars<VolumeVariables, std::size_t>(gridVolVars().problem(), elementJ, fvGeometryJ);
std::move(volVars.begin(), volVars.end(), std::back_inserter(boundaryVolumeVariables_)); std::move(volVars.begin(), volVars.end(), std::back_inserter(boundaryVolumeVariables_));
std::move(indices.begin(), indices.end(), std::back_inserter(boundaryVolVarIndices_)); std::move(indices.begin(), indices.end(), std::back_inserter(boundaryVolVarIndices_));
} }
...@@ -229,6 +240,10 @@ private: ...@@ -229,6 +240,10 @@ private:
int getLocalIdx_(const int volVarIdx) const int getLocalIdx_(const int volVarIdx) const
{ {
auto it = std::find(boundaryVolVarIndices_.begin(), boundaryVolVarIndices_.end(), volVarIdx); auto it = std::find(boundaryVolVarIndices_.begin(), boundaryVolVarIndices_.end(), volVarIdx);
if(it == boundaryVolVarIndices_.end())
{
int shit = 1;
}
assert(it != boundaryVolVarIndices_.end() && "Could not find the current volume variables for volVarIdx!"); assert(it != boundaryVolVarIndices_.end() && "Could not find the current volume variables for volVarIdx!");
return std::distance(boundaryVolVarIndices_.begin(), it); return std::distance(boundaryVolVarIndices_.begin(), it);
} }
......
...@@ -147,12 +147,12 @@ public: ...@@ -147,12 +147,12 @@ public:
//! Returns the indices of the elements required for flux calculation on an scvf. //! Returns the indices of the elements required for flux calculation on an scvf.
static Stencil stencil(const Element& element, static Stencil stencil(const Element& element,
const FVElementGeometry& fvGeometry, const FVElementGeometry& fvGeometry,
const SubControlVolumeFace& scvf) const SubControlVolumeFace& scvf)
{ {
const auto& gridGeometry = fvGeometry.gridGeometry(); const auto& gridGeometry = fvGeometry.gridGeometry();
//ToDo correct stencil! At the moment simply all neighors of neighbors are added //ToDo correct stencil! At the moment simply all neighors of the neighbor are added
Stencil stencil({scvf.insideScvIdx()}); Stencil stencil({scvf.insideScvIdx()});
for (const auto& scvf : scvfs(fvGeometry)) for (const auto& scvf : scvfs(fvGeometry))
{ {
...@@ -160,7 +160,10 @@ public: ...@@ -160,7 +160,10 @@ public:
continue; continue;
stencil.push_back(scvf.outsideScvIdx()); stencil.push_back(scvf.outsideScvIdx());
}
if (!scvf.boundary())
{
const auto outsideScvIdx = scvf.outsideScvIdx(); const auto outsideScvIdx = scvf.outsideScvIdx();
const auto outsideElement = gridGeometry.element(outsideScvIdx); const auto outsideElement = gridGeometry.element(outsideScvIdx);
auto fvGeometryJ = localView(gridGeometry); auto fvGeometryJ = localView(gridGeometry);
......
...@@ -732,10 +732,9 @@ class PorousMediumFluxVariablesCacheFillerImplementation<TypeTag, Discretization ...@@ -732,10 +732,9 @@ class PorousMediumFluxVariablesCacheFillerImplementation<TypeTag, Discretization
static constexpr bool heatConductionIsSolDependent = getPropValue<TypeTag, Properties::SolutionDependentHeatConduction>(); static constexpr bool heatConductionIsSolDependent = getPropValue<TypeTag, Properties::SolutionDependentHeatConduction>();
public: public:
//! This cache filler is always solution-dependent, as it updates the static constexpr bool isSolDependent = (advectionEnabled && advectionIsSolDependent) ||
//! vectors of cell unknowns with which the transmissibilities have to be (diffusionEnabled && diffusionIsSolDependent) ||
//! multiplied in order to obtain the fluxes. (heatConductionEnabled && heatConductionIsSolDependent);
static constexpr bool isSolDependent = true;
//! The constructor. Sets problem pointer. //! The constructor. Sets problem pointer.
PorousMediumFluxVariablesCacheFillerImplementation(const Problem& problem) PorousMediumFluxVariablesCacheFillerImplementation(const Problem& problem)
...@@ -817,6 +816,7 @@ private: ...@@ -817,6 +816,7 @@ private:
template< class Handle, class IntOP, class TensorFunction > template< class Handle, class IntOP, class TensorFunction >
void prepareHandle_(Handle& handle, const IntOP& intOp, const TensorFunction& tensor, const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) void prepareHandle_(Handle& handle, const IntOP& intOp, const TensorFunction& tensor, const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf)
{ {
handle.prepare();
handle.decompose(intOp, tensor, fvGeometry, scvf); handle.decompose(intOp, tensor, fvGeometry, scvf);
} }
...@@ -830,11 +830,11 @@ private: ...@@ -830,11 +830,11 @@ private:
const ElementVolumeVariables& elemVolVars, const ElementVolumeVariables& elemVolVars,
const SubControlVolumeFace& scvf) const SubControlVolumeFace& scvf)
{ {
// using AdvectionType = GetPropType<TypeTag, Properties::AdvectionType>; using AdvectionType = GetPropType<TypeTag, Properties::AdvectionType>;
// using AdvectionFiller = typename AdvectionType::Cache::Filler; using AdvectionFiller = typename AdvectionType::Cache::Filler;
// // forward to the filler for the advective quantities // forward to the filler for the advective quantities
// AdvectionFiller::fill(scvfFluxVarsCache, problem(), element, fvGeometry, elemVolVars, scvf, *this); AdvectionFiller::fill(scvfFluxVarsCache, problem(), element, fvGeometry, elemVolVars, scvf, *this);
} }
// //! method to fill the diffusive quantities // //! method to fill the diffusive quantities
......
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