From 450f209659533e38f226700ee44942954cebbcc7 Mon Sep 17 00:00:00 2001 From: Andreas Lauser <and@poware.org> Date: Fri, 2 Sep 2011 11:54:49 +0000 Subject: [PATCH] lecture/msm: make the problems using box models compile for Scalar != double, cleanups git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6573 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- appl/lecture/msm/1p2cvs2p/lens_1p2c.cc | 2 +- appl/lecture/msm/1p2cvs2p/lens_2p.cc | 2 +- appl/lecture/msm/1p2cvs2p/lensproblem1p2c.hh | 42 +++++++++---------- appl/lecture/msm/1p2cvs2p/lensproblem2p.hh | 36 ++++++++-------- .../msm/1p2cvs2p/lensspatialparameters1p2c.hh | 12 +++--- .../msm/1p2cvs2p/lensspatialparameters2p.hh | 8 ++-- tutorial/tutorialproblem_coupled.hh | 4 +- 7 files changed, 53 insertions(+), 53 deletions(-) diff --git a/appl/lecture/msm/1p2cvs2p/lens_1p2c.cc b/appl/lecture/msm/1p2cvs2p/lens_1p2c.cc index b3268c87bd..551aa757de 100755 --- a/appl/lecture/msm/1p2cvs2p/lens_1p2c.cc +++ b/appl/lecture/msm/1p2cvs2p/lens_1p2c.cc @@ -118,7 +118,7 @@ void usage(const char *progname) int main(int argc, char** argv) { try { - typedef TTAG(LensProblem) TypeTag; + typedef TTAG(LensProblem1p2c) TypeTag; typedef GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; typedef GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid; typedef GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem; diff --git a/appl/lecture/msm/1p2cvs2p/lens_2p.cc b/appl/lecture/msm/1p2cvs2p/lens_2p.cc index 3514b23cb2..1f9446f0f7 100755 --- a/appl/lecture/msm/1p2cvs2p/lens_2p.cc +++ b/appl/lecture/msm/1p2cvs2p/lens_2p.cc @@ -118,7 +118,7 @@ void usage(const char *progname) int main(int argc, char** argv) { try { - typedef TTAG(LensProblem) TypeTag; + typedef TTAG(LensProblem2p) TypeTag; typedef GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; typedef GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid; typedef GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem; diff --git a/appl/lecture/msm/1p2cvs2p/lensproblem1p2c.hh b/appl/lecture/msm/1p2cvs2p/lensproblem1p2c.hh index 8280d9064a..958c3d4473 100644 --- a/appl/lecture/msm/1p2cvs2p/lensproblem1p2c.hh +++ b/appl/lecture/msm/1p2cvs2p/lensproblem1p2c.hh @@ -19,8 +19,8 @@ * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ -#ifndef DUMUX_LENSPROBLEM1P2C_HH -#define DUMUX_LENSPROBLEM1P2C_HH +#ifndef DUMUX_LENS_PROBLEM_1P2C_HH +#define DUMUX_LENS_PROBLEM_1P2C_HH #if HAVE_UG #include <dune/grid/uggrid.hh> @@ -42,17 +42,17 @@ namespace Dumux { template <class TypeTag> -class LensProblem; +class LensProblem1p2c; ////////// // Specify the properties for the lens problem ////////// namespace Properties { -NEW_TYPE_TAG(LensProblem, INHERITS_FROM(BoxOnePTwoC)); +NEW_TYPE_TAG(LensProblem1p2c, INHERITS_FROM(BoxOnePTwoC)); // Set the grid type -SET_PROP(LensProblem, Grid) +SET_PROP(LensProblem1p2c, Grid) { #if HAVE_UG typedef Dune::UGGrid<2> type; @@ -63,30 +63,30 @@ SET_PROP(LensProblem, Grid) }; // Set the problem property -SET_PROP(LensProblem, Problem) +SET_PROP(LensProblem1p2c, Problem) { - typedef Dumux::LensProblem<TypeTag> type; + typedef Dumux::LensProblem1p2c<TypeTag> type; }; // Set fluid configuration -SET_PROP(LensProblem, FluidSystem) +SET_PROP(LensProblem1p2c, FluidSystem) { typedef Dumux::WaterContaminant<TypeTag> type; }; // Set the spatial parameters -SET_PROP(LensProblem, SpatialParameters) +SET_PROP(LensProblem1p2c, SpatialParameters) { typedef Dumux::LensSpatialParameters1p2c<TypeTag> type; }; // Define whether mole(true) or mass(false) fractions are used -SET_BOOL_PROP(LensProblem, UseMoles, true); +SET_BOOL_PROP(LensProblem1p2c, UseMoles, true); // Disable gravity -SET_BOOL_PROP(LensProblem, EnableGravity, false); +SET_BOOL_PROP(LensProblem1p2c, EnableGravity, false); // Disable Jacobian recycling -SET_BOOL_PROP(LensProblem, EnableJacobianRecycling, false); +SET_BOOL_PROP(LensProblem1p2c, EnableJacobianRecycling, false); } /*! @@ -118,9 +118,9 @@ SET_BOOL_PROP(LensProblem, EnableJacobianRecycling, false); * <tt>./lens_1p2c 30000 100</tt> */ template <class TypeTag > -class LensProblem : public OnePTwoCBoxProblem<TypeTag> +class LensProblem1p2c : public OnePTwoCBoxProblem<TypeTag> { - typedef LensProblem<TypeTag> ThisType; + typedef LensProblem1p2c<TypeTag> ThisType; typedef OnePTwoCBoxProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; @@ -156,12 +156,12 @@ class LensProblem : public OnePTwoCBoxProblem<TypeTag> typedef typename GET_PROP_TYPE(TypeTag, PTAG(SolutionVector)) SolutionVector; public: - LensProblem(TimeManager &timeManager, - const GridView &gridView, - const GlobalPosition &lowerLeft, - const GlobalPosition &upperRight, - const GlobalPosition &lensLowerLeft, - const GlobalPosition &lensUpperRight) + LensProblem1p2c(TimeManager &timeManager, + const GridView &gridView, + const GlobalPosition &lowerLeft, + const GlobalPosition &upperRight, + const GlobalPosition &lensLowerLeft, + const GlobalPosition &lensUpperRight) : ParentType(timeManager, gridView) { this->spatialParameters().setLensCoords(lensLowerLeft, lensUpperRight); @@ -403,7 +403,7 @@ private: && lambda > (bboxMax_[0] - 0.55*width)/width; } - static const Scalar eps_ = 3e-6; + static constexpr Scalar eps_ = 3e-6; GlobalPosition bboxMin_; GlobalPosition bboxMax_; diff --git a/appl/lecture/msm/1p2cvs2p/lensproblem2p.hh b/appl/lecture/msm/1p2cvs2p/lensproblem2p.hh index c54d50739c..8b108f2de9 100644 --- a/appl/lecture/msm/1p2cvs2p/lensproblem2p.hh +++ b/appl/lecture/msm/1p2cvs2p/lensproblem2p.hh @@ -19,8 +19,8 @@ * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ -#ifndef DUMUX_LENSPROBLEM2P_HH -#define DUMUX_LENSPROBLEM2P_HH +#ifndef DUMUX_LENSPROBLEM_2P_HH +#define DUMUX_LENSPROBLEM_2P_HH #if HAVE_UG #include <dune/grid/uggrid.hh> @@ -41,17 +41,17 @@ namespace Dumux { template <class TypeTag> -class LensProblem; +class LensProblem2p; ////////// // Specify the properties for the lens problem ////////// namespace Properties { -NEW_TYPE_TAG(LensProblem, INHERITS_FROM(BoxTwoP, LensSpatialParameters2p)); +NEW_TYPE_TAG(LensProblem2p, INHERITS_FROM(BoxTwoP, LensSpatialParameters2p)); // Set the grid type -SET_PROP(LensProblem, Grid) +SET_PROP(LensProblem2p, Grid) { #if HAVE_UG typedef Dune::UGGrid<2> type; @@ -62,13 +62,13 @@ SET_PROP(LensProblem, Grid) }; // Set the problem property -SET_PROP(LensProblem, Problem) +SET_PROP(LensProblem2p, Problem) { - typedef Dumux::LensProblem<TypeTag> type; + typedef Dumux::LensProblem2p<TypeTag> type; }; // Set the wetting phase -SET_PROP(LensProblem, WettingPhase) +SET_PROP(LensProblem2p, WettingPhase) { private: typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; @@ -77,7 +77,7 @@ public: }; // Set the non-wetting phase -SET_PROP(LensProblem, NonwettingPhase) +SET_PROP(LensProblem2p, NonwettingPhase) { private: typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; @@ -86,7 +86,7 @@ public: }; // Enable gravity -SET_BOOL_PROP(LensProblem, EnableGravity, false); +SET_BOOL_PROP(LensProblem2p, EnableGravity, false); } /*! @@ -121,9 +121,9 @@ SET_BOOL_PROP(LensProblem, EnableGravity, false); * <tt>./lens_2p 50000 100</tt> */ template <class TypeTag > -class LensProblem : public TwoPProblem<TypeTag> +class LensProblem2p : public TwoPProblem<TypeTag> { - typedef LensProblem<TypeTag> ThisType; + typedef LensProblem2p<TypeTag> ThisType; typedef TwoPProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; @@ -171,12 +171,12 @@ class LensProblem : public TwoPProblem<TypeTag> typedef typename GET_PROP(TypeTag, PTAG(ParameterTree)) Params; public: - LensProblem(TimeManager &timeManager, - const GridView &gridView, - const GlobalPosition &lowerLeft, - const GlobalPosition &upperRight, - const GlobalPosition &lensLowerLeft, - const GlobalPosition &lensUpperRight) + LensProblem2p(TimeManager &timeManager, + const GridView &gridView, + const GlobalPosition &lowerLeft, + const GlobalPosition &upperRight, + const GlobalPosition &lensLowerLeft, + const GlobalPosition &lensUpperRight) : ParentType(timeManager, gridView) { this->spatialParameters().setLensCoords(lensLowerLeft, lensUpperRight); diff --git a/appl/lecture/msm/1p2cvs2p/lensspatialparameters1p2c.hh b/appl/lecture/msm/1p2cvs2p/lensspatialparameters1p2c.hh index ded344020c..642af8d4a5 100644 --- a/appl/lecture/msm/1p2cvs2p/lensspatialparameters1p2c.hh +++ b/appl/lecture/msm/1p2cvs2p/lensspatialparameters1p2c.hh @@ -58,7 +58,7 @@ class LensSpatialParameters1p2c : public BoxSpatialParametersOneP<TypeTag> }; typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition; - typedef Dune::FieldMatrix<CoordScalar,dimWorld,dimWorld> FieldMatrix; + typedef Dune::FieldMatrix<Scalar,dim,dim> Tensor; typedef typename GridView::template Codim<0>::Entity Element; typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry; @@ -95,9 +95,9 @@ public: * \param scvIdx The index sub-control volume face where the * intrinsic velocity ought to be calculated. */ - const FieldMatrix& intrinsicPermeability(const Element &element, - const FVElementGeometry &fvElemGeom, - int scvIdx) const + const Tensor& intrinsicPermeability(const Element &element, + const FVElementGeometry &fvElemGeom, + int scvIdx) const { const GlobalPosition &globalPos = fvElemGeom.subContVol[scvIdx].global; if (isInLens_(globalPos)) @@ -176,8 +176,8 @@ private: GlobalPosition lensLowerLeft_; GlobalPosition lensUpperRight_; - FieldMatrix lensK_; - FieldMatrix outerK_; + Tensor lensK_; + Tensor outerK_; Scalar lensPorosity_; Scalar outerPorosity_; Scalar longitudinalDispersivity_; diff --git a/appl/lecture/msm/1p2cvs2p/lensspatialparameters2p.hh b/appl/lecture/msm/1p2cvs2p/lensspatialparameters2p.hh index 93fd762501..969ae297c2 100644 --- a/appl/lecture/msm/1p2cvs2p/lensspatialparameters2p.hh +++ b/appl/lecture/msm/1p2cvs2p/lensspatialparameters2p.hh @@ -82,7 +82,7 @@ class LensSpatialParameters2p : public BoxSpatialParameters<TypeTag> }; typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition; - typedef Dune::FieldMatrix<CoordScalar,dimWorld,dimWorld> FieldMatrix; + typedef Dune::FieldMatrix<Scalar,dimWorld,dimWorld> Tensor; typedef typename GridView::template Codim<0>::Entity Element; typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry; @@ -142,7 +142,7 @@ public: * \param scvIdx The index sub-control volume face where the * intrinsic velocity ought to be calculated. */ - const FieldMatrix& intrinsicPermeability(const Element &element, + const Tensor &intrinsicPermeability(const Element &element, const FVElementGeometry &fvElemGeom, int scvIdx) const { @@ -196,8 +196,8 @@ private: GlobalPosition lensLowerLeft_; GlobalPosition lensUpperRight_; - FieldMatrix lensK_; - FieldMatrix outerK_; + Tensor lensK_; + Tensor outerK_; Scalar lensPorosity_; Scalar outerPorosity_; MaterialLawParams lensMaterialParams_; diff --git a/tutorial/tutorialproblem_coupled.hh b/tutorial/tutorialproblem_coupled.hh index 972493c935..c1cfe0ff09 100644 --- a/tutorial/tutorialproblem_coupled.hh +++ b/tutorial/tutorialproblem_coupled.hh @@ -23,8 +23,8 @@ * * \brief Tutorial problem for a fully coupled twophase box model. */ -#ifndef DUMUX_TUTORIALPROBLEM_COUPLED_HH // guardian macro /*@\label{tutorial-coupled:guardian1}@*/ -#define DUMUX_TUTORIALPROBLEM_COUPLED_HH // guardian macro /*@\label{tutorial-coupled:guardian2}@*/ +#ifndef DUMUX_TUTORIAL_PROBLEM_COUPLED_HH // guardian macro /*@\label{tutorial-coupled:guardian1}@*/ +#define DUMUX_TUTORIAL_PROBLEM_COUPLED_HH // guardian macro /*@\label{tutorial-coupled:guardian2}@*/ // the numerical model #include <dumux/boxmodels/2p/2pmodel.hh> -- GitLab