From 9798702ff8ef58df370a0ada15324bab7aa3bf93 Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Fri, 26 Feb 2016 08:41:02 +0100 Subject: [PATCH] [pointsource] Adapt pointsource interface. Correct problem methods. --- dumux/common/pointsource.hh | 10 ++++------ dumux/implicit/problem.hh | 13 ++++++------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/dumux/common/pointsource.hh b/dumux/common/pointsource.hh index 33607ce412..de844ea491 100644 --- a/dumux/common/pointsource.hh +++ b/dumux/common/pointsource.hh @@ -63,6 +63,7 @@ class PointSource typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem; typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables; typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; + typedef typename GET_PROP_TYPE(TypeTag, SubControlVolume) SubControlVolume; typedef typename GridView::template Codim<0>::Entity Element; static const int dimworld = GridView::dimensionworld; @@ -139,9 +140,7 @@ public: // to be overloaded by derived classes void update(const Problem &problem, const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx, - const ElementVolumeVariables &elemVolVars) + const SubControlVolume& scv) {} //! set the number of embeddings for this point source @@ -225,6 +224,7 @@ class TimeDependentPointSource : public PointSource<TypeTag> typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables; typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; + typedef typename GET_PROP_TYPE(TypeTag, SubControlVolume) SubControlVolume; typedef typename GridView::template Codim<0>::Entity Element; static const int dimworld = GridView::dimensionworld; @@ -250,9 +250,7 @@ public: // to be overloaded by derived classes void update(const Problem &problem, const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx, - const ElementVolumeVariables &elemVolVars) + const SubControlVolume &scv) { this->values_ = valueFunction_(problem.timeManager(), this->position()); } //! Convenience = operator overload modifying only the values diff --git a/dumux/implicit/problem.hh b/dumux/implicit/problem.hh index 510bd81674..048a0697d9 100644 --- a/dumux/implicit/problem.hh +++ b/dumux/implicit/problem.hh @@ -391,9 +391,9 @@ public: * Positive values mean that the conserved quantity is created, negative ones mean that it vanishes. * E.g. for the mass balance that would be a mass rate in \f$ [ kg / s ] \f$. */ - PrimaryVariables pointSource(PointSource& pointSource, - const Element &element, - const SubControlVolume &scv) const + void pointSource(PointSource& pointSource, + const Element &element, + const SubControlVolume &scv) const { // forward to space dependent interface method asImp_().pointSourceAtPos(pointSource, pointSource.position()); @@ -974,9 +974,8 @@ public: PrimaryVariables scvPointSources(const Element &element, const SubControlVolume &scv) const { PrimaryVariables source(0); - int scvIdx = scv.indexInElement(); - auto key = std::make_pair(this->gridView().indexSet().index(element), scvIdx); + auto key = std::make_pair(this->gridView().indexSet().index(element), scv.indexInElement()); if (pointSourceMap_.count(key)) { // call the solDependent function. Herein the user might fill/add values to the point sources @@ -1001,9 +1000,9 @@ public: // we do an update e.g. used for TimeDependentPointSource pointSource.update(asImp_(), element, scv); // call convienience problem interface function - source = asImp_().pointSource(pointSource, element, scv); + asImp_().pointSource(pointSource, element, scv); // at last take care about multiplying with the correct volume - source /= volume; + pointSource /= volume; // add the point source values to the local residual source += pointSource.values(); } -- GitLab