From 8b46f8c9e39e2e115a5b3049d30713dc3003566f Mon Sep 17 00:00:00 2001 From: Gabriele Seitz <seitz@molly.site> Date: Wed, 31 May 2017 11:57:18 +0200 Subject: [PATCH] [box] rename function scv.index() in scv.indexInElement() --- dumux/common/pointsource.hh | 2 +- dumux/discretization/box/darcyslaw.hh | 4 ++-- dumux/discretization/box/elementvolumevariables.hh | 8 ++++---- dumux/discretization/box/fickslaw.hh | 6 +++--- dumux/discretization/box/fourierslaw.hh | 2 +- dumux/discretization/box/globalvolumevariables.hh | 2 +- dumux/discretization/box/subcontrolvolume.hh | 2 +- dumux/discretization/volumevariables.hh | 2 +- dumux/implicit/box/elementboundarytypes.hh | 2 +- dumux/implicit/box/localjacobian.hh | 10 +++++----- dumux/implicit/box/localresidual.hh | 6 +++--- dumux/implicit/localresidual.hh | 6 +++--- dumux/implicit/problem.hh | 2 +- dumux/mixeddimension/integrationpointsource.hh | 2 +- dumux/mixeddimension/subproblemlocaljacobian.hh | 6 +++--- dumux/porousmediumflow/2p2c/implicit/model.hh | 2 +- dumux/porousmediumflow/2pnc/implicit/model.hh | 2 +- dumux/porousmediumflow/2pncmin/implicit/model.hh | 2 +- .../2pncmin/implicit/volumevariables.hh | 4 ++-- dumux/porousmediumflow/3p3c/implicit/model.hh | 2 +- .../compositional/primaryvariableswitch.hh | 3 ++- dumux/porousmediumflow/implicit/velocityoutput.hh | 2 +- test/discretization/box/test_boxfvgeometry.cc | 2 +- 23 files changed, 41 insertions(+), 40 deletions(-) diff --git a/dumux/common/pointsource.hh b/dumux/common/pointsource.hh index 75a2fe5239..0f66f4c45d 100644 --- a/dumux/common/pointsource.hh +++ b/dumux/common/pointsource.hh @@ -389,7 +389,7 @@ public: for (auto&& scv : scvs(fvGeometry)) { if (BoundingBoxTreeHelper<dimworld>::pointInGeometry(scv.geometry(), globalPos)) - scvIndices.push_back(scv.index()); + scvIndices.push_back(scv.indexInElement()); } // for all scvs that where tested positiv add the point sources // to the element/scv to point source map diff --git a/dumux/discretization/box/darcyslaw.hh b/dumux/discretization/box/darcyslaw.hh index 9b1790b131..e76e7123d5 100644 --- a/dumux/discretization/box/darcyslaw.hh +++ b/dumux/discretization/box/darcyslaw.hh @@ -110,11 +110,11 @@ public: const auto& volVars = elemVolVars[scv]; if (enableGravity) - rho += volVars.density(phaseIdx)*shapeValues[scv.index()][0]; + rho += volVars.density(phaseIdx)*shapeValues[scv.indexInElement()][0]; // the global shape function gradient DimVector gradN; - jacInvT.mv(shapeJacobian[scv.index()][0], gradN); + jacInvT.mv(shapeJacobian[scv.indexInElement()][0], gradN); gradP.axpy(volVars.pressure(phaseIdx), gradN); } diff --git a/dumux/discretization/box/elementvolumevariables.hh b/dumux/discretization/box/elementvolumevariables.hh index 83bf970d29..3ef2e870a4 100644 --- a/dumux/discretization/box/elementvolumevariables.hh +++ b/dumux/discretization/box/elementvolumevariables.hh @@ -65,7 +65,7 @@ public: { return globalVolVars().volVars(eIdx_, scvIdx); } const VolumeVariables& operator [](const SubControlVolume& scv) const - { return globalVolVars().volVars(eIdx_, scv.index()); } + { return globalVolVars().volVars(eIdx_, scv.indexInElement()); } // For compatibility reasons with the case of not storing the vol vars. // function to be called before assembling an element, preparing the vol vars within the stencil @@ -137,7 +137,7 @@ public: { // TODO: INTERFACE SOLVER // globalVolVars().problem_().model().boxInterfaceConditionSolver().updateScvVolVars(element, scv, sol); - volumeVariables_[scv.index()].update(elemSol, globalVolVars().problem_(), element, scv); + volumeVariables_[scv.indexInElement()].update(elemSol, globalVolVars().problem_(), element, scv); } } @@ -148,10 +148,10 @@ public: { return volumeVariables_[scvIdx]; } const VolumeVariables& operator [](const SubControlVolume& scv) const - { return volumeVariables_[scv.index()]; } + { return volumeVariables_[scv.indexInElement()]; } VolumeVariables& operator [](const SubControlVolume& scv) - { return volumeVariables_[scv.index()]; } + { return volumeVariables_[scv.indexInElement()]; } //! The global volume variables object we are a restriction of const GlobalVolumeVariables& globalVolVars() const diff --git a/dumux/discretization/box/fickslaw.hh b/dumux/discretization/box/fickslaw.hh index 0ae115f46c..d4b4a4275d 100644 --- a/dumux/discretization/box/fickslaw.hh +++ b/dumux/discretization/box/fickslaw.hh @@ -115,12 +115,12 @@ public: const auto& volVars = elemVolVars[scv]; // density interpolation - rho += useMoles ? volVars.molarDensity(phaseIdx)*shapeValues[scv.index()][0] - : volVars.density(phaseIdx)*shapeValues[scv.index()][0]; + rho += useMoles ? volVars.molarDensity(phaseIdx)*shapeValues[scv.indexInElement()][0] + : volVars.density(phaseIdx)*shapeValues[scv.indexInElement()][0]; // the mole/mass fraction gradient GlobalPosition gradI; - jacInvT.mv(shapeJacobian[scv.index()][0], gradI); + jacInvT.mv(shapeJacobian[scv.indexInElement()][0], gradI); gradI *= useMoles ? volVars.moleFraction(phaseIdx, compIdx) : volVars.massFraction(phaseIdx, compIdx); gradX += gradI; diff --git a/dumux/discretization/box/fourierslaw.hh b/dumux/discretization/box/fourierslaw.hh index d77e89a689..a19160a372 100644 --- a/dumux/discretization/box/fourierslaw.hh +++ b/dumux/discretization/box/fourierslaw.hh @@ -112,7 +112,7 @@ public: // the mole/mass fraction gradient GlobalPosition gradI; - jacInvT.mv(shapeJacobian[scv.index()][0], gradI); + jacInvT.mv(shapeJacobian[scv.indexInElement()][0], gradI); gradI *= volVars.temperature(); gradTemp += gradI; } diff --git a/dumux/discretization/box/globalvolumevariables.hh b/dumux/discretization/box/globalvolumevariables.hh index fe77856b8e..dc069bd3fe 100644 --- a/dumux/discretization/box/globalvolumevariables.hh +++ b/dumux/discretization/box/globalvolumevariables.hh @@ -80,7 +80,7 @@ public: volumeVariables_[eIdx].resize(fvGeometry.numScv()); for (auto&& scv : scvs(fvGeometry)) { - volumeVariables_[eIdx][scv.index()].update(elemSol, + volumeVariables_[eIdx][scv.indexInElement()].update(elemSol, problem, element, scv); diff --git a/dumux/discretization/box/subcontrolvolume.hh b/dumux/discretization/box/subcontrolvolume.hh index 00c9c29a1c..e4343d39c2 100644 --- a/dumux/discretization/box/subcontrolvolume.hh +++ b/dumux/discretization/box/subcontrolvolume.hh @@ -86,7 +86,7 @@ public: } //! The global index of this scv - IndexType index() const + IndexType indexInElement() const { return scvIdx_; } diff --git a/dumux/discretization/volumevariables.hh b/dumux/discretization/volumevariables.hh index 0db136d09e..7296a8c6b5 100644 --- a/dumux/discretization/volumevariables.hh +++ b/dumux/discretization/volumevariables.hh @@ -91,7 +91,7 @@ public: */ static const PrimaryVariables& extractDofPriVars(const ElementSolutionVector& elemSol, const SubControlVolume& scv) - { return isBox ? elemSol[scv.index()] : elemSol[0]; } + { return isBox ? elemSol[scv.indexInElement()] : elemSol[0]; } /*! * \brief Return the vector of primary variables diff --git a/dumux/implicit/box/elementboundarytypes.hh b/dumux/implicit/box/elementboundarytypes.hh index 1a8e24d072..d24c76827b 100644 --- a/dumux/implicit/box/elementboundarytypes.hh +++ b/dumux/implicit/box/elementboundarytypes.hh @@ -91,7 +91,7 @@ public: for (auto&& scv : scvs(fvGeometry)) { - int scvIdxLocal = scv.index(); + int scvIdxLocal = scv.indexInElement(); (*this)[scvIdxLocal].reset(); if (problem.model().onBoundary(scv)) diff --git a/dumux/implicit/box/localjacobian.hh b/dumux/implicit/box/localjacobian.hh index f032f83b69..d2e9186c01 100644 --- a/dumux/implicit/box/localjacobian.hh +++ b/dumux/implicit/box/localjacobian.hh @@ -146,7 +146,7 @@ public: VolumeVariables origVolVars(curVolVars); // add precalculated residual for this scv into the global container - residual[dofIdx] += this->residual_[scv.index()]; + residual[dofIdx] += this->residual_[scv.indexInElement()]; // calculate derivatives w.r.t to the privars at the dof at hand for (int pvIdx = 0; pvIdx < numEq; pvIdx++) @@ -166,7 +166,7 @@ public: curVolVars = origVolVars; // restore the original element solution - curElemSol[scv.index()][pvIdx] = this->model_().curSol()[scv.dofIndex()][pvIdx]; + curElemSol[scv.indexInElement()][pvIdx] = this->model_().curSol()[scv.dofIndex()][pvIdx]; } // TODO: what if we have an extended source stencil???? @@ -242,7 +242,7 @@ protected: // calculate f(x + \epsilon) // deflect primary variables - curElemSol[scv.index()][pvIdx] += eps; + curElemSol[scv.indexInElement()][pvIdx] += eps; delta += eps; // update the volume variables connected to the dof @@ -268,7 +268,7 @@ protected: // need to calculate f(x - \epsilon) // deflect the primary variables - curElemSol[scv.index()][pvIdx] -= delta + eps; + curElemSol[scv.indexInElement()][pvIdx] -= delta + eps; delta += eps; // update the volume variables connected to the dof @@ -301,7 +301,7 @@ protected: template<class T = TypeTag> typename std::enable_if<GET_PROP_VALUE(T, EnableGlobalVolumeVariablesCache), VolumeVariables>::type& getCurVolVars(ElementVolumeVariables& elemVolVars, const SubControlVolume& scv) - { return this->model_().nonConstCurGlobalVolVars().volVars(scv.elementIndex(), scv.index()); } + { return this->model_().nonConstCurGlobalVolVars().volVars(scv.elementIndex(), scv.indexInElement()); } //! When global volume variables caching is disabled, return the local volvar object template<class T = TypeTag> diff --git a/dumux/implicit/box/localresidual.hh b/dumux/implicit/box/localresidual.hh index 3dcb322ecb..47013b4a5d 100644 --- a/dumux/implicit/box/localresidual.hh +++ b/dumux/implicit/box/localresidual.hh @@ -108,7 +108,7 @@ protected: if (scvf.boundary()) { auto&& scv = fvGeometry.scv(scvf.insideScvIdx()); - this->asImp_().evalBoundaryFluxes_(element, fvGeometry, elemVolVars, scvf, scv, bcTypes[scv.index()], elemFluxVarsCache); + this->asImp_().evalBoundaryFluxes_(element, fvGeometry, elemVolVars, scvf, scv, bcTypes[scv.indexInElement()], elemFluxVarsCache); } } } @@ -118,7 +118,7 @@ protected: { for (auto&& scv : scvs(fvGeometry)) { - auto scvBcTypes = bcTypes[scv.index()]; + auto scvBcTypes = bcTypes[scv.indexInElement()]; if (scvBcTypes.hasDirichlet()) this->asImp_().evalDirichlet_(element, fvGeometry, elemVolVars, scv, scvBcTypes); } @@ -149,7 +149,7 @@ protected: // get the primary variables const auto& priVars = elemVolVars[scv].priVars(); - this->residual_[scv.index()][eqIdx] = priVars[pvIdx] - dirichletValues[pvIdx]; + this->residual_[scv.indexInElement()][eqIdx] = priVars[pvIdx] - dirichletValues[pvIdx]; } } } diff --git a/dumux/implicit/localresidual.hh b/dumux/implicit/localresidual.hh index 207c47b079..ca8d1a337c 100644 --- a/dumux/implicit/localresidual.hh +++ b/dumux/implicit/localresidual.hh @@ -313,7 +313,7 @@ protected: // all sub control volumes for (auto&& scv : scvs(fvGeometry)) { - auto localScvIdx = isBox ? scv.index() : 0; + auto localScvIdx = isBox ? scv.indexInElement() : 0; const auto& volVars = curElemVolVars[scv]; storageTerm_[localScvIdx] = asImp_().computeStorage(scv, volVars); storageTerm_[localScvIdx] *= scv.volume() * volVars.extrusionFactor(); @@ -352,7 +352,7 @@ protected: // evaluate the volume terms (storage + source terms) for (auto&& scv : scvs(fvGeometry)) { - auto localScvIdx = isBox ? scv.index() : 0; + auto localScvIdx = isBox ? scv.indexInElement() : 0; auto curExtrusionFactor = curElemVolVars[scv].extrusionFactor(); // subtract the source term from the local rate @@ -379,7 +379,7 @@ protected: // evaluate the volume terms (storage + source terms) for (auto&& scv : scvs(fvGeometry)) { - auto localScvIdx = isBox ? scv.index() : 0; + auto localScvIdx = isBox ? scv.indexInElement() : 0; const auto& curVolVars = curElemVolVars[scv]; const auto& prevVolVars = prevElemVolVars[scv]; diff --git a/dumux/implicit/problem.hh b/dumux/implicit/problem.hh index 28ea314e18..f5acbe298c 100644 --- a/dumux/implicit/problem.hh +++ b/dumux/implicit/problem.hh @@ -981,7 +981,7 @@ public: const SubControlVolume &scv) const { PrimaryVariables source(0); - auto scvIdx = isBox ? scv.index() : 0; + auto scvIdx = isBox ? scv.indexInElement() : 0; auto key = std::make_pair(this->gridView().indexSet().index(element), scvIdx); if (pointSourceMap_.count(key)) { diff --git a/dumux/mixeddimension/integrationpointsource.hh b/dumux/mixeddimension/integrationpointsource.hh index 33ae6fc55f..86866d746a 100644 --- a/dumux/mixeddimension/integrationpointsource.hh +++ b/dumux/mixeddimension/integrationpointsource.hh @@ -150,7 +150,7 @@ public: for (auto&& scv : scvs(fvGeometry)) { if (BoundingBoxTreeHelper<dimworld>::pointInGeometry(scv.geometry(), globalPos)) - scvIndices.push_back(scv.index()); + scvIndices.push_back(scv.indexInElement()); } // for all scvs that where tested positiv add the point sources // to the element/scv to point source map diff --git a/dumux/mixeddimension/subproblemlocaljacobian.hh b/dumux/mixeddimension/subproblemlocaljacobian.hh index 43ddbb99cd..a623cfac49 100644 --- a/dumux/mixeddimension/subproblemlocaljacobian.hh +++ b/dumux/mixeddimension/subproblemlocaljacobian.hh @@ -257,7 +257,7 @@ protected: VolumeVariables origVolVars(curVolVars); // add precalculated residual for this scv into the global container - residual[dofIdx] += this->residual_[scv.index()]; + residual[dofIdx] += this->residual_[scv.indexInElement()]; // calculate derivatives w.r.t to the privars at the dof at hand for (int pvIdx = 0; pvIdx < numEq; pvIdx++) @@ -277,7 +277,7 @@ protected: curVolVars = origVolVars; // restore the original element solution - curElemSol[scv.index()][pvIdx] = this->problem_().model().curSol()[scv.dofIndex()][pvIdx]; + curElemSol[scv.indexInElement()][pvIdx] = this->problem_().model().curSol()[scv.dofIndex()][pvIdx]; } // TODO: what if we have an extended source stencil???? } @@ -506,7 +506,7 @@ protected: // this->updateGlobalJacobian_(couplingMatrix, scv.dofIndex(), globalJ, pvIdx, partialDeriv[scv.dofIndex()]); for (auto&& scv : scvs(fvGeometry)) - this->updateGlobalJacobian_(couplingMatrix, scv.dofIndex(), globalJ, pvIdx, partialDeriv[scv.index()]); + this->updateGlobalJacobian_(couplingMatrix, scv.dofIndex(), globalJ, pvIdx, partialDeriv[scv.indexInElement()]); } } } diff --git a/dumux/porousmediumflow/2p2c/implicit/model.hh b/dumux/porousmediumflow/2p2c/implicit/model.hh index 91d1579ba0..e49f84c691 100644 --- a/dumux/porousmediumflow/2p2c/implicit/model.hh +++ b/dumux/porousmediumflow/2p2c/implicit/model.hh @@ -215,7 +215,7 @@ public: if (priVarSwitch_().wasSwitched(dofIdxGlobal)) { const auto elemSol = this->elementSolution(element, this->curSol()); - this->nonConstCurGlobalVolVars().volVars(scv.index()).update(elemSol, + this->nonConstCurGlobalVolVars().volVars(scv()).update(elemSol, this->problem_(), element, scv); diff --git a/dumux/porousmediumflow/2pnc/implicit/model.hh b/dumux/porousmediumflow/2pnc/implicit/model.hh index 0f4a7446c8..9e0ad199aa 100644 --- a/dumux/porousmediumflow/2pnc/implicit/model.hh +++ b/dumux/porousmediumflow/2pnc/implicit/model.hh @@ -233,7 +233,7 @@ public: auto dofIdxGlobal = scv.dofIndex(); if (priVarSwitch_().wasSwitched(dofIdxGlobal)) { - this->nonConstCurGlobalVolVars().volVars(scv.index()).update(this->curSol()[dofIdxGlobal], + this->nonConstCurGlobalVolVars().volVars(scv()).update(this->curSol()[dofIdxGlobal], this->problem_(), element, scv); diff --git a/dumux/porousmediumflow/2pncmin/implicit/model.hh b/dumux/porousmediumflow/2pncmin/implicit/model.hh index 313167208f..730c44fc21 100644 --- a/dumux/porousmediumflow/2pncmin/implicit/model.hh +++ b/dumux/porousmediumflow/2pncmin/implicit/model.hh @@ -233,7 +233,7 @@ public: auto dofIdxGlobal = scv.dofIndex(); if (priVarSwitch_().wasSwitched(dofIdxGlobal)) { - this->nonConstCurGlobalVolVars().volVars(scv.index()).update(this->curSol()[dofIdxGlobal], + this->nonConstCurGlobalVolVars().volVars(scv()).update(this->curSol()[dofIdxGlobal], this->problem_(), element, scv); diff --git a/dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh b/dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh index e10ed139f6..99093ca98c 100644 --- a/dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh +++ b/dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh @@ -126,7 +126,7 @@ public: ///////////// // calculate the remaining quantities ///////////// - auto&& priVars = isBox ? elemSol[scv.index()] : elemSol[0]; + auto&& priVars = isBox ? elemSol[scv.indexInElement()] : elemSol[0]; sumPrecipitates_ = 0.0; for(int sPhaseIdx = 0; sPhaseIdx < numSPhases; ++sPhaseIdx) @@ -173,7 +173,7 @@ public: fluidState.setTemperature(t); auto phasePresence = problem.model().priVarSwitch().phasePresence(scv.dofIndex()); - auto&& priVars = isBox ? elemSol[scv.index()] : elemSol[0]; + auto&& priVars = isBox ? elemSol[scv.indexInElement()] : elemSol[0]; ///////////// // set the saturations diff --git a/dumux/porousmediumflow/3p3c/implicit/model.hh b/dumux/porousmediumflow/3p3c/implicit/model.hh index b0571fb2dc..6c2af828d4 100644 --- a/dumux/porousmediumflow/3p3c/implicit/model.hh +++ b/dumux/porousmediumflow/3p3c/implicit/model.hh @@ -212,7 +212,7 @@ public: if (priVarSwitch_().wasSwitched(dofIdxGlobal)) { - this->nonConstCurGlobalVolVars().volVars(scv.index()).update(this->curSol()[dofIdxGlobal], + this->nonConstCurGlobalVolVars().volVars(scv()).update(this->curSol()[dofIdxGlobal], this->problem_(), element, scv); diff --git a/dumux/porousmediumflow/compositional/primaryvariableswitch.hh b/dumux/porousmediumflow/compositional/primaryvariableswitch.hh index e9485dd050..d07294d8dd 100644 --- a/dumux/porousmediumflow/compositional/primaryvariableswitch.hh +++ b/dumux/porousmediumflow/compositional/primaryvariableswitch.hh @@ -194,7 +194,8 @@ public: visited_[dofIdxGlobal] = true; // Compute temporary volVars on which grounds we decide // if we need to switch the primary variables - auto&& volVars = curGlobalVolVars.volVars(scv.index()); + //auto&& volVars = curGlobalVolVars.volVars(scv.index()); + auto&& volVars = curGlobalVolVars.volVars(scv()); volVars.update(curElemSol, problem, element, scv); if (asImp_().update_(curSol[dofIdxGlobal], volVars, dofIdxGlobal, scv.dofPosition())) diff --git a/dumux/porousmediumflow/implicit/velocityoutput.hh b/dumux/porousmediumflow/implicit/velocityoutput.hh index 6d7abb4f0d..eacef597ed 100644 --- a/dumux/porousmediumflow/implicit/velocityoutput.hh +++ b/dumux/porousmediumflow/implicit/velocityoutput.hh @@ -196,7 +196,7 @@ public: // calculate the subcontrolvolume velocity by the Piola transformation Dune::FieldVector<CoordScalar, dimWorld> scvVelocity(0); - jacobianT2.mtv(scvVelocities[scv.index()], scvVelocity); + jacobianT2.mtv(scvVelocities[scv.indexInElement()], scvVelocity); scvVelocity /= geometry.integrationElement(localPos)*cellNum_[vIdxGlobal]; // add up the wetting phase subcontrolvolume velocities for each vertex velocity[vIdxGlobal] += scvVelocity; diff --git a/test/discretization/box/test_boxfvgeometry.cc b/test/discretization/box/test_boxfvgeometry.cc index 0348275a33..929e8e33c7 100644 --- a/test/discretization/box/test_boxfvgeometry.cc +++ b/test/discretization/box/test_boxfvgeometry.cc @@ -129,7 +129,7 @@ int main (int argc, char *argv[]) try for (auto&& scv : scvs(fvGeometry)) { - std::cout << "-- scv " << scv.index() << " center at: " << scv.center() << " , volume: " << scv.volume() << std::endl; + std::cout << "-- scv " << scv.indexInElement() << " center at: " << scv.center() << " , volume: " << scv.volume() << std::endl; } auto range2 = scvfs(fvGeometry); -- GitLab