From 5b332992e2d8d3b6ae066e7a1d4a704c0780ee0d Mon Sep 17 00:00:00 2001 From: Andreas Lauser <and@poware.org> Date: Fri, 2 Sep 2011 11:54:50 +0000 Subject: [PATCH] box models: move extrusion factor to problem and query it via the volume variables this has the advantage that the common infrastructure for the box model does not require to access the spatial parameters of a problem. (the latter are not always present, e.g. in stokes) git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6574 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- dumux/boxmodels/common/boxlocalresidual.hh | 12 ++--- dumux/boxmodels/common/boxproblem.hh | 29 ++++++++++++ dumux/boxmodels/common/boxvolumevariables.hh | 16 +++++++ .../richards/richardsvolumevariables.hh | 1 - .../boxspatialparameters1p.hh | 45 ------------------- 5 files changed, 51 insertions(+), 52 deletions(-) diff --git a/dumux/boxmodels/common/boxlocalresidual.hh b/dumux/boxmodels/common/boxlocalresidual.hh index a907c4febe..7dbae42acd 100644 --- a/dumux/boxmodels/common/boxlocalresidual.hh +++ b/dumux/boxmodels/common/boxlocalresidual.hh @@ -474,9 +474,7 @@ protected: std::cerr << "undefined: " << values << "\n"; values *= fvElemGeom_().boundaryFace[boundaryFaceIdx].area - * problem_().spatialParameters().extrusionFactorScv(elem_(), - fvElemGeom_(), - scvIdx); + * curVolVars_(scvIdx).extrusionFactor(); Valgrind::CheckDefined(values); residual_[scvIdx] += values; } @@ -498,9 +496,11 @@ protected: PrimaryVariables flux; Valgrind::SetUndefined(flux); this->asImp_().computeFlux(flux, k); - flux *= problem_().spatialParameters().extrusionFactorScvf(elem_(), - fvElemGeom_(), - k); + Scalar extrusionFactor = + (curVolVars_(i).extrusionFactor() + + curVolVars_(j).extrusionFactor()) + / 2; + flux *= extrusionFactor; Valgrind::CheckDefined(flux); // The balance equation for a finite volume is: diff --git a/dumux/boxmodels/common/boxproblem.hh b/dumux/boxmodels/common/boxproblem.hh index c38f3ce4b4..b8284c38f3 100644 --- a/dumux/boxmodels/common/boxproblem.hh +++ b/dumux/boxmodels/common/boxproblem.hh @@ -402,6 +402,35 @@ public: "a initialAtPos() method."); } + /*! + * \brief Return how much the domain is extruded at a given sub-control volume. + * + * This means the factor by which a lower-dimensional (1D or 2D) + * entity needs to be expanded to get a full dimensional cell. The + * default is 1.0 which means that 1D problems are actually + * thought as pipes with a cross section of 1 m^2 and 2D problems + * are assumed to extend 1 m to the back. + */ + Scalar boxExtrusionFactor(const Element &element, + const FVElementGeometry &fvElemGeom, + int scvIdx) const + { + // forward to generic interface + return asImp_().extrusionFactorAtPos(fvElemGeom.subContVol[scvIdx].global); + } + + /*! + * \brief Return how much the domain is extruded at a given position. + * + * This means the factor by which a lower-dimensional (1D or 2D) + * entity needs to be expanded to get a full dimensional cell. The + * default is 1.0 which means that 1D problems are actually + * thought as pipes with a cross section of 1 m^2 and 2D problems + * are assumed to extend 1 m to the back. + */ + Scalar extrusionFactorAtPos(const GlobalPosition &pos) const + { return 1.0; } + /*! * \brief If model coupling is used, this updates the parameters * required to calculate the coupling fluxes between the diff --git a/dumux/boxmodels/common/boxvolumevariables.hh b/dumux/boxmodels/common/boxvolumevariables.hh index 4881568f07..626d7a9801 100644 --- a/dumux/boxmodels/common/boxvolumevariables.hh +++ b/dumux/boxmodels/common/boxvolumevariables.hh @@ -60,6 +60,7 @@ public: { evalPoint_ = 0; primaryVars_ = v.primaryVars_; + extrusionFactor_ = v.extrusionFactor_; }; /*! @@ -69,6 +70,7 @@ public: { evalPoint_ = 0; primaryVars_ = v.primaryVars_; + extrusionFactor_ = v.extrusionFactor_; return *this; }; @@ -124,6 +126,7 @@ public: { Valgrind::CheckDefined(priVars); primaryVars_ = priVars; + extrusionFactor_ = problem.boxExtrusionFactor(element, elemGeom, scvIdx); } /*! @@ -142,6 +145,18 @@ public: return primaryVars_[pvIdx]; } + /*! + * \brief Return how much the sub-control volume is extruded. + * + * This means the factor by which a lower-dimensional (1D or 2D) + * entity needs to be expanded to get a full dimensional cell. The + * default is 1.0 which means that 1D problems are actually + * thought as pipes with a cross section of 1 m^2 and 2D problems + * are assumed to extend 1 m to the back. + */ + Scalar extrusionFactor() const + { return extrusionFactor_; } + /*! * \brief If running in valgrind this makes sure that all * quantities in the volume variables are defined. @@ -166,6 +181,7 @@ protected: const Implementation *evalPoint_; PrimaryVariables primaryVars_; + Scalar extrusionFactor_; }; } // end namepace diff --git a/dumux/boxmodels/richards/richardsvolumevariables.hh b/dumux/boxmodels/richards/richardsvolumevariables.hh index 8df6ac0e46..c29fede935 100644 --- a/dumux/boxmodels/richards/richardsvolumevariables.hh +++ b/dumux/boxmodels/richards/richardsvolumevariables.hh @@ -203,7 +203,6 @@ public: Scalar capillaryPressure() const { return fluidState_.capillaryPressure(); } - protected: void updateTemperature_(const PrimaryVariables &priVars, const Element &element, diff --git a/dumux/material/spatialparameters/boxspatialparameters1p.hh b/dumux/material/spatialparameters/boxspatialparameters1p.hh index e80e92f5ab..5dbcde60fb 100644 --- a/dumux/material/spatialparameters/boxspatialparameters1p.hh +++ b/dumux/material/spatialparameters/boxspatialparameters1p.hh @@ -74,51 +74,6 @@ public: ~BoxSpatialParametersOneP() {} - /*! - * \brief Returns the factor by which the volume of a sub control - * volume needs to be multiplied in order to get cubic - * meters. - * - * \param element The current finite element - * \param fvElemGeom The current finite volume geometry of the element - * \param scvIdx The index sub-control volume face where the - * factor ought to be calculated. - * - * By default that's just 1.0 - */ - Scalar extrusionFactorScv(const Element &element, - const FVElementGeometry &fvElemGeom, - int scvIdx) const - { return 1.0; } - - /*! - * \brief Returns the factor by which the area of a sub control - * volume face needs to be multiplied in order to get - * square meters. - * - * \param element The current finite element - * \param fvElemGeom The current finite volume geometry of the element - * \param scvfIdx The index sub-control volume face where the - * factor ought to be calculated. - * - * By default it is the arithmetic mean of the extrusion factor of - * the face's two sub-control volumes. - */ - Scalar extrusionFactorScvf(const Element &element, - const FVElementGeometry &fvElemGeom, - int scvfIdx) const - { - return - 0.5 * - (asImp_().extrusionFactorScv(element, - fvElemGeom, - fvElemGeom.subContVolFace[scvfIdx].i) - + - asImp_().extrusionFactorScv(element, - fvElemGeom, - fvElemGeom.subContVolFace[scvfIdx].j)); - } - /*! * \brief Averages the intrinsic permeability (Scalar). * \param result averaged intrinsic permeability -- GitLab