diff --git a/dumux/common/pointsource.hh b/dumux/common/pointsource.hh index 75a2fe52393e5ea163480ed373b6514c5492cef5..0f66f4c45d56396637cac91244cb275d313dc341 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 9b1790b131c71790e7baa11f473f1e7894fd57a4..e76e7123d5d449255e21790d8581251cc8fc1093 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 83bf970d29db07c657fce480e070c26803ffa46c..3ef2e870a49c8ebc7f3bac8dff01056f912fad0d 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 0ae115f46c3c862313e63923addb6d894ed33a63..d4b4a4275dce8ac2185c7393a8e56b194a367afb 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 d77e89a689cd78e22c0b4dfb388fe9793876716d..a19160a3720ab5417d51324c7957315c1833217c 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 fe77856b8e9538c407a992cfd45d6b6ca8158635..dc069bd3fe11551039d06c61c56540b492214565 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 00c9c29a1c2dd8242c79c52fe4538036b4e767b2..e4343d39c2f6e230d3f194609678e2a828fe6fde 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 0db136d09ea6e90e397e8ee618a05533405811fa..7296a8c6b51df9d423722c426adbd2b2f96cfdc1 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 1a8e24d07213544a52c16c9ebd89c98cc9b65db9..d24c76827ba5dc933415daf5ef526a53373ad0fa 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 f032f83b6921bea7860befd25f201b5c2e5cdd83..d2e9186c0117ecebc99f50fd927db9eb564b0e79 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 3dcb322ecb997d5af2fa2e26630eddd245b85b6f..47013b4a5dc5945ee1c1f5641bd84bd26e1f5d11 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 207c47b0790100ad5462cb998ff87654c113690b..ca8d1a337cfd30087d4d5ce9301d70598ce118a8 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 28ea314e1808957c8d4e0fd2bf97dfad5b597dc0..f5acbe298ce8a081953e72863945bdfc5704e637 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 33ae6fc55f583d0b65ed287c3cd9732292eefe78..86866d746a24a033984f33c9a0632a81066a26ad 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 43ddbb99cdf8466a1248a791eaabdbcd28672e56..a623cfac49cdd40f81cbf7e4490b93072e27aba3 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 91d1579ba0e9ac21689a15e30b719a19d4846e45..e49f84c69144467906270d94f5111879cb9d9b99 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 0f4a7446c84d203aa3c95f38d752e40ca1b51455..9e0ad199aac197440dc1c8548d8715083e7d85b2 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 313167208f4d28fffd3b39d00cd34a13a3777d9b..730c44fc21eabc18dffe991b61a28384de356560 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 e10ed139f6d76290f70a45ec2598b2d231e563af..99093ca98c7d263b742b5e2d4740066f7a1ecd3b 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 b0571fb2dc6c1e54889dfc8ae7188179166ac509..6c2af828d406df57a14297b5b0b56698c9fcdd3b 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 e9485dd050ee2cd87babf38611d7bbb3db7d823c..d07294d8ddf3f0abcbe4a831b61f8a568bfd3860 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 6d7abb4f0d181c3f4e8b8feff1538a924fb6724f..eacef597ed3e9b18d05421040113bc78e6af0f0e 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 0348275a33a19f04f9be12e5db1c3e58c44e7f98..929e8e33c75fb6974559c792ec494adb16b3ec2e 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);