From 9c7c80dfec8f1c7e6fbb762c3e60274dece37f11 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch <bernd@iws.uni-stuttgart.de> Date: Mon, 4 Jun 2012 12:47:13 +0000 Subject: [PATCH] Offer outflow boundary conditions for all box models. This implements FS#117 and #99. git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@8429 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- CHANGELOG | 14 ++++-- dumux/boxmodels/1p2c/1p2clocalresidual.hh | 31 -------------- dumux/boxmodels/2p2c/2p2clocalresidual.hh | 31 -------------- dumux/boxmodels/common/boxlocalresidual.hh | 50 +++++++++++++++------- 4 files changed, 45 insertions(+), 81 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c9b6b66730..d525ff69dc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,9 +8,17 @@ Differences Between DuMuX 2.1 and DuMuX 2.2 has to be replaced by SET...PROP(..., SpatialParams ... - - TwoPIndices, TwoPNIIndices, and RichardsIndices additionally get TypeTag - as template parameter. If the Indices are not obtained via the property, - this has to be adapted. + - Implicit models: TwoPIndices, TwoPNIIndices, and RichardsIndices additionally + get TypeTag as template parameter. If the Indices are not obtained via the + property, this has to be adapted. + + - Implicit models: All model-specific computeFlux functions in + ...localresidual.hh have to get an additional bool parameter onBoundary, + which is by default set to false. If outflow conditions should + be properly implemented, also the constructor of the flux variables in + ...fluxvariables.hh has to get the additional argument and the + class has to be adapted to deal with boundary faces. See FS#117 and #99 + for details. * Deprecated CLASSES/FILES, to be removed after 2.2: - Model specific base box problems: The common functionality has been collected diff --git a/dumux/boxmodels/1p2c/1p2clocalresidual.hh b/dumux/boxmodels/1p2c/1p2clocalresidual.hh index 3a17d7f6d2..bb324b49b6 100644 --- a/dumux/boxmodels/1p2c/1p2clocalresidual.hh +++ b/dumux/boxmodels/1p2c/1p2clocalresidual.hh @@ -279,37 +279,6 @@ public: this->curVolVars_()); } - /*! - * \brief Add Outflow boundary conditions for a single sub-control - * volume face to the local residual. - * - * \param isIt The intersection iterator of current element - * \param scvIdx The index of the considered face of the sub-control volume - * \param boundaryFaceIdx The index of the considered boundary face of the sub control volume - */ - void evalOutflowSegment(const IntersectionIterator &isIt, - const int scvIdx, - const int boundaryFaceIdx) - { - const BoundaryTypes &bcTypes = this->bcTypes_(scvIdx); - // deal with outflow boundaries - if (bcTypes.hasOutflow()) - { - //calculate outflow fluxes - PrimaryVariables values(0.0); - asImp_()->computeFlux(values, boundaryFaceIdx, true); - Valgrind::CheckDefined(values); - - for (int equationIdx = 0; equationIdx < numEq; ++equationIdx) - { - if (!bcTypes.isOutflow(equationIdx) ) - continue; - // deduce outflow - this->residual_[scvIdx][equationIdx] += values[equationIdx]; - } - } - } - Implementation *asImp_() { return static_cast<Implementation *> (this); } const Implementation *asImp_() const diff --git a/dumux/boxmodels/2p2c/2p2clocalresidual.hh b/dumux/boxmodels/2p2c/2p2clocalresidual.hh index 5d3c798bd4..3b9a45b340 100644 --- a/dumux/boxmodels/2p2c/2p2clocalresidual.hh +++ b/dumux/boxmodels/2p2c/2p2clocalresidual.hh @@ -132,37 +132,6 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual) evalPhaseStorage_(phaseIdx); } - /*! - * \brief Evaluate the outflow conditions at a boundary face. - * This is still a beta version and only available - * for the 2p2c and the 2p2cni model yet. - * - * \param isIt The intersection iterator - * \param scvIdx The index of the sub-control volume containing the outflow face - * \param boundaryFaceIdx The index of the boundary face - */ - void evalOutflowSegment(const IntersectionIterator &isIt, - const int scvIdx, - const int boundaryFaceIdx) - { - const BoundaryTypes &bcTypes = this->bcTypes_(scvIdx); - - // deal with outflow boundaries - if (bcTypes.hasOutflow()) - { - PrimaryVariables values(0.0); - asImp_()->computeFlux(values, boundaryFaceIdx, true); - Valgrind::CheckDefined(values); - - for (int eqIdx = 0; eqIdx < numEq; ++eqIdx) - { - if (!bcTypes.isOutflow(eqIdx) ) - continue; - this->residual_[scvIdx][eqIdx] += values[eqIdx]; - } - } - } - /*! * \brief Evaluate the amount all conservation quantities * (e.g. phase mass) within a sub-control volume. diff --git a/dumux/boxmodels/common/boxlocalresidual.hh b/dumux/boxmodels/common/boxlocalresidual.hh index 8202e724fc..9757cd7dde 100644 --- a/dumux/boxmodels/common/boxlocalresidual.hh +++ b/dumux/boxmodels/common/boxlocalresidual.hh @@ -273,19 +273,6 @@ public: #endif // HAVE_VALGRIND } - /*! - * \brief Add Outflow boundary conditions for a single sub-control - * volume face to the local residual. - * - * \note This is so far an empty method doing not more than - * nothing. A beta version is available for the 2p2c and - * 2p2cni model. There you can find a sample implementation. - */ - void evalOutflowSegment(const IntersectionIterator &isIt, - int scvIdx, - int boundaryFaceIdx) - { } - /*! * \brief Returns the local residual for all sub-control * volumes of the element. @@ -421,9 +408,9 @@ protected: // evaluate the outflow conditions at the boundary face // ATTENTION: This is so far a beta version that is only for the 2p2c and 2p2cni model // available and not thoroughly tested. - asImp_().evalOutflowSegment(isIt, - scvIdx, - boundaryFaceIdx); + asImp_().evalOutflowSegment_(isIt, + scvIdx, + boundaryFaceIdx); } } } @@ -464,6 +451,37 @@ protected: } } + /*! + * \brief Add outflow boundary conditions for a single sub-control + * volume face to the local residual. + * + * \param isIt The intersection iterator of current element + * \param scvIdx The index of the considered face of the sub-control volume + * \param boundaryFaceIdx The index of the considered boundary face of the sub control volume + */ + void evalOutflowSegment_(const IntersectionIterator &isIt, + const int scvIdx, + const int boundaryFaceIdx) + { + const BoundaryTypes &bcTypes = this->bcTypes_(scvIdx); + // deal with outflow boundaries + if (bcTypes.hasOutflow()) + { + //calculate outflow fluxes + PrimaryVariables values(0.0); + asImp_().computeFlux(values, boundaryFaceIdx, true); + Valgrind::CheckDefined(values); + + for (int equationIdx = 0; equationIdx < numEq; ++equationIdx) + { + if (!bcTypes.isOutflow(equationIdx) ) + continue; + // deduce outflow + this->residual_[scvIdx][equationIdx] += values[equationIdx]; + } + } + } + /*! * \brief Add the flux terms to the local residual of all * sub-control volumes of the current element. -- GitLab