Commit 2bd183b6 authored by Timo Koch's avatar Timo Koch
Browse files

[volvars][cc] Only build boudary volvars on pure dirichlet boundaries. Other...

[volvars][cc] Only build boudary volvars on pure dirichlet boundaries. Other they're possibly undefined!
parent 613f56fe
......@@ -277,6 +277,20 @@ public:
bool isDirichlet(unsigned eqIdx) const
{ return boundaryInfo_[eqIdx].isDirichlet; }
/*!
* \brief Returns true if an equation is used to specify a
* Dirichlet condition.
*
* \param eqIdx The index of the equation
*/
bool hasOnlyDirichlet() const
{
return std::all_of(boundaryInfo_.begin(),
boundaryInfo_.end(),
[](const BoundaryInfo& b){ return b.isDirichlet; }
);
}
/*!
* \brief Returns true if some equation is used to specify a
* Dirichlet condition.
......
......@@ -128,6 +128,7 @@ public:
// update the volume variables of the element at hand
auto&& scvI = fvGeometry.scv(eIdx);
assert(scv.dofIndex() == eIdx);
volumeVariables_[localIdx].update(sol[eIdx], globalVolVars().problem_(), element, scvI);
volVarIndices_[localIdx] = scvI.index();
++localIdx;
......@@ -149,12 +150,18 @@ public:
if (!scvf.boundary())
continue;
const auto dirichletPriVars = globalVolVars().problem_().dirichlet(element, scvf);
volumeVariables_.resize(localIdx+1);
volVarIndices_.resize(localIdx+1);
volumeVariables_[localIdx].update(dirichletPriVars, globalVolVars().problem_(), element, scvI);
volVarIndices_[localIdx] = scvf.outsideScvIdx();
++localIdx;
// check if boundary is a pure dirichlet boundary
const auto bcTypes = globalVolVars().problem_().boundaryTypes(element, scvf);
if (bcTypes.hasOnlyDirichlet())
{
const auto dirichletPriVars = globalVolVars().problem_().dirichlet(element, scvf);
volumeVariables_.resize(localIdx+1);
volVarIndices_.resize(localIdx+1);
volumeVariables_[localIdx].update(dirichletPriVars, globalVolVars().problem_(), element, scvI);
volVarIndices_[localIdx] = scvf.outsideScvIdx();
++localIdx;
}
}
}
......
......@@ -81,11 +81,16 @@ public:
if (!scvf.boundary())
continue;
const auto insideScvIdx = scvf.insideScvIdx();
const auto& insideScv = fvGeometry.scv(insideScvIdx);
const auto dirichletPriVars = problem.dirichlet(element, scvf);
volumeVariables_[scvf.outsideScvIdx()].update(dirichletPriVars, problem, element, insideScv);
// check if boundary is a pure dirichlet boundary
const auto bcTypes = problem.boundaryTypes(element, scvf);
if (bcTypes.hasOnlyDirichlet())
{
const auto insideScvIdx = scvf.insideScvIdx();
const auto& insideScv = fvGeometry.scv(insideScvIdx);
const auto dirichletPriVars = problem.dirichlet(element, scvf);
volumeVariables_[scvf.outsideScvIdx()].update(dirichletPriVars, problem, element, insideScv);
}
}
}
}
......
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