Skip to content
Snippets Groups Projects
Commit 452489ff authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[3p3c][model] Adapt to new volVar interface

parent 206798e0
No related branches found
No related tags found
2 merge requests!617[WIP] Next,!537Fix/global volvar cache for box
...@@ -106,6 +106,7 @@ class ThreePThreeCModel: public GET_PROP_TYPE(TypeTag, BaseModel) ...@@ -106,6 +106,7 @@ class ThreePThreeCModel: public GET_PROP_TYPE(TypeTag, BaseModel)
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
enum { enum {
...@@ -198,27 +199,49 @@ public: ...@@ -198,27 +199,49 @@ public:
// update the secondary variables if global caching is enabled // update the secondary variables if global caching is enabled
// \note we only updated if phase presence changed as the volume variables // \note we only updated if phase presence changed as the volume variables
// are already updated once by the switch // are already updated once by the switch
if (switchFlag_) for (const auto& element : elements(this->problem_().gridView()))
{ {
for (const auto& element : elements(this->problem_().gridView())) // make sure FVElementGeometry & vol vars are bound to the element
{ auto fvGeometry = localView(this->globalFvGeometry());
// make sure FVElementGeometry & vol vars are bound to the element fvGeometry.bindElement(element);
auto fvGeometry = localView(this->globalFvGeometry());
fvGeometry.bindElement(element);
if (switchFlag_)
{
for (auto&& scv : scvs(fvGeometry)) for (auto&& scv : scvs(fvGeometry))
{ {
auto dofIdxGlobal = scv.dofIndex(); auto dofIdxGlobal = scv.dofIndex();
if (priVarSwitch_().wasSwitched(dofIdxGlobal)) if (priVarSwitch_().wasSwitched(dofIdxGlobal))
{ {
const auto eIdx = this->problem_().elementMapper().index(element);
this->nonConstCurGlobalVolVars().volVars(scv).update(this->curSol()[dofIdxGlobal], const auto elemSol = this->elementSolution(element, this->curSol());
this->problem_(), this->nonConstCurGlobalVolVars().volVars(eIdx, scv.indexInElement()).update(elemSol,
element, this->problem_(),
scv); element,
scv);
} }
} }
}
// handle the boundary volume variables for cell-centered models
if(!isBox)
{
for (auto&& scvf : scvfs(fvGeometry))
{
// if we are not on a boundary, skip the rest
if (!scvf.boundary())
continue;
// check if boundary is a pure dirichlet boundary
const auto bcTypes = this->problem_().boundaryTypes(element, scvf);
if (bcTypes.hasOnlyDirichlet())
{
const auto insideScvIdx = scvf.insideScvIdx();
const auto& insideScv = fvGeometry.scv(insideScvIdx);
const auto elemSol = ElementSolutionVector{this->problem_().dirichlet(element, scvf)};
this->nonConstCurGlobalVolVars().volVars(scvf.outsideScvIdx(), 0/*indexInElement*/).update(elemSol, this->problem_(), element, insideScv);
}
}
} }
} }
} }
......
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