diff --git a/dumux/boxmodels/common/boxproblem.hh b/dumux/boxmodels/common/boxproblem.hh index 2a70a0ccd82e7940b5bf03af3c3c2af5c1c76037..7599784201b5a2b356a575b70ea67fa097c17ab4 100644 --- a/dumux/boxmodels/common/boxproblem.hh +++ b/dumux/boxmodels/common/boxproblem.hh @@ -1,3 +1,65 @@ -#warning This file is deprecated. Include dumux/implicit/box/boxproblem.hh instead. +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * \brief Base class for all problems which use the box scheme + */ +#ifndef DUMUX_BOX_PROBLEM_HH +#define DUMUX_BOX_PROBLEM_HH -#include <dumux/implicit/box/boxproblem.hh> +#include <dumux/implicit/common/implicitproblem.hh> + +namespace Dumux +{ +/*! + * \ingroup BoxModel + * \ingroup BoxBaseProblems + * \brief Base class for all problems which use the box scheme. + * + * \note All quantities are specified assuming a threedimensional + * world. Problems discretized using 2D grids are assumed to be + * extruded by \f$1 m\f$ and 1D grids are assumed to have a + * cross section of \f$1m \times 1m\f$. + */ +template<class TypeTag> +class BoxProblem : public ImplicitProblem<TypeTag> +{ + typedef ImplicitProblem<TypeTag> ParentType; + typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; + typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + + // copying a problem is not a good idea + BoxProblem(const BoxProblem &); + +public: + /*! + * \brief Constructor + * + * \param timeManager The TimeManager which is used by the simulation + * \param gridView The simulation's idea about physical space + */ + DUNE_DEPRECATED_MSG("Use ImplicitProblem from dumux/implicit/common/implicitproblem.hh.") + BoxProblem(TimeManager &timeManager, const GridView &gridView) + : ParentType(timeManager, gridView) + {} +}; + +} + +#endif diff --git a/dumux/boxmodels/common/porousmediaboxproblem.hh b/dumux/boxmodels/common/porousmediaboxproblem.hh index e253d280d008ddee741a9547461c85717b6b2345..63cd95cb08977333ad9fdab9814b3b4b3f695f80 100644 --- a/dumux/boxmodels/common/porousmediaboxproblem.hh +++ b/dumux/boxmodels/common/porousmediaboxproblem.hh @@ -1,3 +1,60 @@ -#warning This file is deprecated. Include dumux/implicit/box/porousmediaboxproblem.hh instead. +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * 2012 by Bernd Flemisch * + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * \brief Base class for all problems which use the two-phase box model + */ +#ifndef DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH +#define DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> + +namespace Dumux +{ +/*! + * \ingroup BoxBaseProblems + * \brief Base class for all porous media box problems + */ +template<class TypeTag> +class PorousMediaBoxProblem : public ImplicitPorousMediaProblem<TypeTag> +{ + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; + typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; + +public: + /*! + * \brief The constructor + * + * \param timeManager The time manager + * \param gridView The grid view + * \param verbose Turn verbosity on or off + */ + DUNE_DEPRECATED_MSG("Use ImplicitPorousMediaProblem from dumux/implicit/common/implicitporousmediaproblem.hh.") + PorousMediaBoxProblem(TimeManager &timeManager, + const GridView &gridView, + const bool verbose = true) + : ParentType(timeManager, gridView) + {} +}; + +} + +#endif diff --git a/dumux/freeflow/stokes/stokesproblem.hh b/dumux/freeflow/stokes/stokesproblem.hh index afceb9474bd90fe7a2af83f2c1517cd836e81e87..20636c89d4fc6cee45ee42ed5ba22ad6722a45cd 100644 --- a/dumux/freeflow/stokes/stokesproblem.hh +++ b/dumux/freeflow/stokes/stokesproblem.hh @@ -23,7 +23,7 @@ #ifndef DUMUX_STOKES_PROBLEM_HH #define DUMUX_STOKES_PROBLEM_HH -#include <dumux/implicit/box/boxproblem.hh> +#include <dumux/implicit/common/implicitproblem.hh> #include "stokesproperties.hh" diff --git a/dumux/implicit/2pdfm/2pdfmproblem.hh b/dumux/implicit/2pdfm/2pdfmproblem.hh index ea20182d8ec5fc8db72032caf57f79575b68b546..2d1cc615ece954639c99c438952f20947c2ee493 100644 --- a/dumux/implicit/2pdfm/2pdfmproblem.hh +++ b/dumux/implicit/2pdfm/2pdfmproblem.hh @@ -21,7 +21,7 @@ #ifndef DUMUX_BOXMODELS_2PDFM_PROBLEM_HH #define DUMUX_BOXMODELS_2PDFM_PROBLEM_HH -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include "2pdfmproperties.hh" namespace Dumux @@ -32,9 +32,9 @@ namespace Dumux * \brief Base class for all problems which use the two-phase box model */ template<class TypeTag> -class TwoPDFMProblem : public PorousMediaBoxProblem<TypeTag> +class TwoPDFMProblem : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; @@ -48,7 +48,7 @@ public: * \param gridView The grid view * \param verbose Turn verbosity on or off */ - DUNE_DEPRECATED_MSG("use PorousMediaBoxProblem instead") + DUNE_DEPRECATED_MSG("use ImplicitPorousMediaProblem instead") TwoPDFMProblem(TimeManager &timeManager, const GridView &gridView, bool verbose = true) diff --git a/dumux/implicit/box/boxproblem.hh b/dumux/implicit/box/boxproblem.hh deleted file mode 100644 index c455443807b5b990d59e43d0bad635b32fd87f98..0000000000000000000000000000000000000000 --- a/dumux/implicit/box/boxproblem.hh +++ /dev/null @@ -1,835 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * \brief Base class for all problems which use the box scheme - */ -#ifndef DUMUX_BOX_PROBLEM_HH -#define DUMUX_BOX_PROBLEM_HH - -#include "boxproperties.hh" - -#include <dumux/io/vtkmultiwriter.hh> -#include <dumux/io/restart.hh> - -namespace Dumux -{ -/*! - * \ingroup BoxModel - * \ingroup BoxBaseProblems - * \brief Base class for all problems which use the box scheme. - * - * \note All quantities are specified assuming a threedimensional - * world. Problems discretized using 2D grids are assumed to be - * extruded by \f$1 m\f$ and 1D grids are assumed to have a - * cross section of \f$1m \times 1m\f$. - */ -template<class TypeTag> -class BoxProblem -{ -private: - typedef typename GET_PROP_TYPE(TypeTag, Problem) Implementation; - typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - - typedef Dumux::VtkMultiWriter<GridView> VtkMultiWriter; - - typedef typename GET_PROP_TYPE(TypeTag, NewtonMethod) NewtonMethod; - typedef typename GET_PROP_TYPE(TypeTag, NewtonController) NewtonController; - - typedef typename GET_PROP_TYPE(TypeTag, Model) Model; - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; - - typedef typename GET_PROP_TYPE(TypeTag, VertexMapper) VertexMapper; - typedef typename GET_PROP_TYPE(TypeTag, ElementMapper) ElementMapper; - - typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; - typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables; - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; - - enum { - dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; - - typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<dim>::Entity Vertex; - typedef typename GridView::template Codim<dim>::Iterator VertexIterator; - typedef typename GridView::Intersection Intersection; - - typedef typename GridView::Grid::ctype CoordScalar; - typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition; - - // copying a problem is not a good idea - BoxProblem(const BoxProblem &); - -public: - /*! - * \brief Constructor - * - * \param timeManager The TimeManager which is used by the simulation - * \param gridView The simulation's idea about physical space - */ - BoxProblem(TimeManager &timeManager, const GridView &gridView) - : gridView_(gridView) - , bboxMin_(std::numeric_limits<double>::max()) - , bboxMax_(-std::numeric_limits<double>::max()) - , elementMapper_(gridView) - , vertexMapper_(gridView) - , timeManager_(&timeManager) - , newtonMethod_(asImp_()) - , newtonCtl_(asImp_()) - { - // calculate the bounding box of the local partition of the grid view - VertexIterator vIt = gridView.template begin<dim>(); - const VertexIterator vEndIt = gridView.template end<dim>(); - for (; vIt!=vEndIt; ++vIt) { - for (int i=0; i<dim; i++) { - bboxMin_[i] = std::min(bboxMin_[i], vIt->geometry().corner(0)[i]); - bboxMax_[i] = std::max(bboxMax_[i], vIt->geometry().corner(0)[i]); - } - } - - // communicate to get the bounding box of the whole domain - if (gridView.comm().size() > 1) - for (int i = 0; i < dim; ++i) { - bboxMin_[i] = gridView.comm().min(bboxMin_[i]); - bboxMax_[i] = gridView.comm().max(bboxMax_[i]); - } - - // set a default name for the problem - simName_ = "sim"; - - resultWriter_ = NULL; - } - - ~BoxProblem() - { - delete resultWriter_; - }; - - - /*! - * \brief Called by the Dumux::TimeManager in order to - * initialize the problem. - * - * If you overload this method don't forget to call - * ParentType::init() - */ - void init() - { - // set the initial condition of the model - model().init(asImp_()); - } - - /*! - * \brief Specifies which kind of boundary condition should be - * used for which equation on a given boundary segment. - * - * \param values The boundary types for the conservation equations - * \param vertex The vertex for which the boundary type is set - */ - void boundaryTypes(BoundaryTypes &values, - const Vertex &vertex) const - { - // forward it to the method which only takes the global coordinate - asImp_().boundaryTypesAtPos(values, vertex.geometry().center()); - } - - /*! - * \brief Specifies which kind of boundary condition should be - * used for which equation on a given boundary segment. - * - * \param values The boundary types for the conservation equations - * \param pos The position of the finite volume in global coordinates - */ - void boundaryTypesAtPos(BoundaryTypes &values, - const GlobalPosition &pos) const - { - // Throw an exception (there is no reasonable default value - // for Dirichlet conditions) - DUNE_THROW(Dune::InvalidStateException, - "The problem does not provide " - "a boundaryTypes() method."); - } - - - /*! - * \brief Evaluate the boundary conditions for a dirichlet - * control volume. - * - * \param values The dirichlet values for the primary variables - * \param vertex The vertex representing the "half volume on the boundary" - * - * For this method, the \a values parameter stores primary variables. - */ - void dirichlet(PrimaryVariables &values, - const Vertex &vertex) const - { - // forward it to the method which only takes the global coordinate - asImp_().dirichletAtPos(values, vertex.geometry().center()); - } - - /*! - * \brief Evaluate the boundary conditions for a dirichlet - * control volume. - * - * \param values The dirichlet values for the primary variables - * \param pos The position of the center of the finite volume - * for which the dirichlet condition ought to be - * set in global coordinates - * - * For this method, the \a values parameter stores primary variables. - */ - void dirichletAtPos(PrimaryVariables &values, - const GlobalPosition &pos) const - { - // Throw an exception (there is no reasonable default value - // for Dirichlet conditions) - DUNE_THROW(Dune::InvalidStateException, - "The problem specifies that some boundary " - "segments are dirichlet, but does not provide " - "a dirichlet() method."); - } - - /*! - * \brief Evaluate the boundary conditions for a neumann - * boundary segment. - * - * This is the method for the case where the Neumann condition is - * potentially solution dependent and requires some box method - * specific things. - * - * \param values The neumann values for the conservation equations [kg / (m^2 *s )] - * \param element The finite element - * \param fvGeometry The finite-volume geometry in the box scheme - * \param is The intersection between element and boundary - * \param scvIdx The local vertex index - * \param boundaryFaceIdx The index of the boundary face - * \param elemVolVars All volume variables for the element - * - * For this method, the \a values parameter stores the mass flux - * in normal direction of each phase. Negative values mean influx. - */ - void boxSDNeumann(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeometry, - const Intersection &is, - const int scvIdx, - const int boundaryFaceIdx, - const ElementVolumeVariables &elemVolVars) const - { - // forward it to the interface without the volume variables - asImp_().neumann(values, - element, - fvGeometry, - is, - scvIdx, - boundaryFaceIdx); - } - - /*! - * \brief Evaluate the boundary conditions for a neumann - * boundary segment. - * - * \param values The neumann values for the conservation equations [kg / (m^2 *s )] - * \param element The finite element - * \param fvGeometry The finite-volume geometry in the box scheme - * \param is The intersection between element and boundary - * \param scvIdx The local vertex index - * \param boundaryFaceIdx The index of the boundary face - * - * For this method, the \a values parameter stores the mass flux - * in normal direction of each phase. Negative values mean influx. - */ - void neumann(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeometry, - const Intersection &is, - const int scvIdx, - const int boundaryFaceIdx) const - { - // forward it to the interface with only the global position - asImp_().neumannAtPos(values, fvGeometry.boundaryFace[boundaryFaceIdx].ipGlobal); - } - - /*! - * \brief Evaluate the boundary conditions for a neumann - * boundary segment. - * - * \param values The neumann values for the conservation equations [kg / (m^2 *s )] - * \param pos The position of the boundary face's integration point in global coordinates - * - * For this method, the \a values parameter stores the mass flux - * in normal direction of each phase. Negative values mean influx. - */ - void neumannAtPos(PrimaryVariables &values, - const GlobalPosition &pos) const - { - // Throw an exception (there is no reasonable default value - // for Neumann conditions) - DUNE_THROW(Dune::InvalidStateException, - "The problem specifies that some boundary " - "segments are neumann, but does not provide " - "a neumannAtPos() method."); - } - - /*! - * \brief Evaluate the source term for all phases within a given - * sub-control-volume. - * - * This is the method for the case where the source term is - * potentially solution dependent and requires some box method - * specific things. - * - * \param values The source and sink values for the conservation equations - * \param element The finite element - * \param fvGeometry The finite-volume geometry in the box scheme - * \param scvIdx The local vertex index - * \param elemVolVars All volume variables for the element - * - * For this method, the \a values parameter stores the rate mass - * generated or annihilate per volume unit. Positive values mean - * that mass is created, negative ones mean that it vanishes. - */ - void boxSDSource(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx, - const ElementVolumeVariables &elemVolVars) const - { - // forward to solution independent, box specific interface - asImp_().source(values, element, fvGeometry, scvIdx); - } - - /*! - * \brief Evaluate the source term for all phases within a given - * sub-control-volume. - * - * \param values The source and sink values for the conservation equations - * \param element The finite element - * \param fvGeometry The finite-volume geometry in the box scheme - * \param scvIdx The local vertex index - * - * For this method, the \a values parameter stores the rate mass - * generated or annihilate per volume unit. Positive values mean - * that mass is created, negative ones mean that it vanishes. - */ - void source(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { - // forward to generic interface - asImp_().sourceAtPos(values, fvGeometry.subContVol[scvIdx].global); - } - - /*! - * \brief Evaluate the source term for all phases within a given - * sub-control-volume. - * - * \param values The source and sink values for the conservation equations - * \param pos The position of the center of the finite volume - * for which the source term ought to be - * specified in global coordinates - * - * For this method, the \a values parameter stores the rate mass - * generated or annihilate per volume unit. Positive values mean - * that mass is created, negative ones mean that it vanishes. - */ - void sourceAtPos(PrimaryVariables &values, - const GlobalPosition &pos) const - { - DUNE_THROW(Dune::InvalidStateException, - "The problem does not provide " - "a sourceAtPos() method."); - } - - /*! - * \brief Evaluate the initial value for a control volume. - * - * \param values The initial values for the primary variables - * \param element The finite element - * \param fvGeometry The finite-volume geometry in the box scheme - * \param scvIdx The local vertex index - * - * For this method, the \a values parameter stores primary - * variables. - */ - void initial(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { - // forward to generic interface - asImp_().initialAtPos(values, fvGeometry.subContVol[scvIdx].global); - } - - /*! - * \brief Evaluate the initial value for a control volume. - * - * \param values The dirichlet values for the primary variables - * \param pos The position of the center of the finite volume - * for which the initial values ought to be - * set (in global coordinates) - * - * For this method, the \a values parameter stores primary variables. - */ - void initialAtPos(PrimaryVariables &values, - const GlobalPosition &pos) const - { - // Throw an exception (there is no reasonable default value - // for Dirichlet conditions) - DUNE_THROW(Dune::InvalidStateException, - "The problem does not provide " - "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 &fvGeometry, - const int scvIdx) const - { - // forward to generic interface - return asImp_().extrusionFactorAtPos(fvGeometry.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 - * sub-models. - * - * By default it does nothing - * - * \param element The DUNE Codim<0> entity for which the coupling - * parameters should be computed. - */ - void updateCouplingParams(const Element &element) const - {} - - /*! - * \name Simulation steering - */ - // \{ - - /*! - * \brief Called by the time manager before the time integration. - */ - void preTimeStep() - {} - - /*! - * \brief Called by Dumux::TimeManager in order to do a time - * integration on the model. - */ - void timeIntegration() - { - const int maxFails = 10; - for (int i = 0; i < maxFails; ++i) { - if (model_.update(newtonMethod_, newtonCtl_)) - return; - - Scalar dt = timeManager().timeStepSize(); - Scalar nextDt = dt / 2; - timeManager().setTimeStepSize(nextDt); - - // update failed - std::cout << "Newton solver did not converge with dt="<<dt<<" seconds. Retrying with time step of " - << nextDt << " seconds\n"; - } - - DUNE_THROW(Dune::MathError, - "Newton solver didn't converge after " - << maxFails - << " time-step divisions. dt=" - << timeManager().timeStepSize()); - } - - /*! - * \brief Returns the newton method object - */ - NewtonMethod &newtonMethod() - { return newtonMethod_; } - - /*! - * \copydoc newtonMethod() - */ - const NewtonMethod &newtonMethod() const - { return newtonMethod_; } - - /*! - * \brief Returns the newton contoller object - */ - NewtonController &newtonController() - { return newtonCtl_; } - - /*! - * \copydoc newtonController() - */ - const NewtonController &newtonController() const - { return newtonCtl_; } - - /*! - * \brief Called by Dumux::TimeManager whenever a solution for a - * time step has been computed and the simulation time has - * been updated. - * - * \param dt The current time-step size - */ - Scalar nextTimeStepSize(const Scalar dt) - { - return std::min(GET_PARAM_FROM_GROUP(TypeTag, Scalar, TimeManager, MaxTimeStepSize), - newtonCtl_.suggestTimeStepSize(dt)); - }; - - /*! - * \brief Returns true if a restart file should be written to - * disk. - * - * The default behavior is to write one restart file every 5 time - * steps. This file is intended to be overwritten by the - * implementation. - */ - bool shouldWriteRestartFile() const - { - return timeManager().timeStepIndex() > 0 && - (timeManager().timeStepIndex() % 10 == 0); - } - - /*! - * \brief Returns true if the current solution should be written to - * disk (i.e. as a VTK file) - * - * The default behavior is to write out every the solution for - * very time step. This file is intended to be overwritten by the - * implementation. - */ - bool shouldWriteOutput() const - { return true; } - - /*! - * \brief Called by the time manager after the time integration to - * do some post processing on the solution. - */ - void postTimeStep() - { } - - /*! - * \brief Called by the time manager after everything which can be - * done about the current time step is finished and the - * model should be prepared to do the next time integration. - */ - void advanceTimeLevel() - { - model_.advanceTimeLevel(); - } - - /*! - * \brief Called when the end of an simulation episode is reached. - * - * Typically a new episode should be started in this method. - */ - void episodeEnd() - { - std::cerr << "The end of an episode is reached, but the problem " - << "does not override the episodeEnd() method. " - << "Doing nothing!\n"; - }; - // \} - - /*! - * \brief The problem name. - * - * This is used as a prefix for files generated by the simulation. - * It could be either overwritten by the problem files, or simply - * declared over the setName() function in the application file. - */ - const char *name() const - { - return simName_.c_str(); - } - - /*! - * \brief Set the problem name. - * - * This static method sets the simulation name, which should be - * called before the application problem is declared! If not, the - * default name "sim" will be used. - * - * \param newName The problem's name - */ - void setName(const char *newName) - { - simName_ = newName; - } - - - /*! - * \brief Returns the number of the current VTK file. - */ - int currentVTKFileNumber() - { - createResultWriter_(); - return resultWriter_->curWriterNum(); - } - - /*! - * \brief The GridView which used by the problem. - */ - const GridView &gridView() const - { return gridView_; } - - /*! - * \brief The coordinate of the corner of the GridView's bounding - * box with the smallest values. - */ - const GlobalPosition &bboxMin() const - { return bboxMin_; } - - /*! - * \brief The coordinate of the corner of the GridView's bounding - * box with the largest values. - */ - const GlobalPosition &bboxMax() const - { return bboxMax_; } - - /*! - * \brief Returns the mapper for vertices to indices. - */ - const VertexMapper &vertexMapper() const - { return vertexMapper_; } - - /*! - * \brief Returns the mapper for elements to indices. - */ - const ElementMapper &elementMapper() const - { return elementMapper_; } - - /*! - * \brief Returns TimeManager object used by the simulation - */ - TimeManager &timeManager() - { return *timeManager_; } - - /*! - * \copydoc timeManager() - */ - const TimeManager &timeManager() const - { return *timeManager_; } - - /*! - * \brief Returns numerical model used for the problem. - */ - Model &model() - { return model_; } - - /*! - * \copydoc model() - */ - const Model &model() const - { return model_; } - // \} - - /*! - * \name Restart mechanism - */ - // \{ - - /*! - * \brief This method writes the complete state of the simulation - * to the harddisk. - * - * The file will start with the prefix returned by the name() - * method, has the current time of the simulation clock in it's - * name and uses the extension <tt>.drs</tt>. (Dumux ReStart - * file.) See Dumux::Restart for details. - */ - void serialize() - { - typedef Dumux::Restart Restarter; - Restarter res; - res.serializeBegin(asImp_()); - if (gridView().comm().rank() == 0) - std::cout << "Serialize to file '" << res.fileName() << "'\n"; - - timeManager().serialize(res); - asImp_().serialize(res); - res.serializeEnd(); - } - - /*! - * \brief This method writes the complete state of the problem - * to the harddisk. - * - * The file will start with the prefix returned by the name() - * method, has the current time of the simulation clock in it's - * name and uses the extension <tt>.drs</tt>. (Dumux ReStart - * file.) See Dumux::Restart for details. - * - * \tparam Restarter The serializer type - * - * \param res The serializer object - */ - template <class Restarter> - void serialize(Restarter &res) - { - createResultWriter_(); - resultWriter_->serialize(res); - model().serialize(res); - } - - /*! - * \brief Load a previously saved state of the whole simulation - * from disk. - * - * \param tRestart The simulation time on which the program was - * written to disk. - */ - void restart(const Scalar tRestart) - { - typedef Dumux::Restart Restarter; - - Restarter res; - - res.deserializeBegin(asImp_(), tRestart); - if (gridView().comm().rank() == 0) - std::cout << "Deserialize from file '" << res.fileName() << "'\n"; - timeManager().deserialize(res); - asImp_().deserialize(res); - res.deserializeEnd(); - } - - /*! - * \brief This method restores the complete state of the problem - * from disk. - * - * It is the inverse of the serialize() method. - * - * \tparam Restarter The deserializer type - * - * \param res The deserializer object - */ - template <class Restarter> - void deserialize(Restarter &res) - { - createResultWriter_(); - resultWriter_->deserialize(res); - model().deserialize(res); - } - - // \} - - /*! - * \brief Adds additional VTK output data to the VTKWriter. Function is called by writeOutput(). - */ - void addOutputVtkFields() - {} - - /*! - * \brief Write the relevant secondary variables of the current - * solution into an VTK output file. - */ - void writeOutput(const bool verbose = true) - { - // write the current result to disk - if (asImp_().shouldWriteOutput()) { - if (verbose && gridView().comm().rank() == 0) - std::cout << "Writing result file for \"" << asImp_().name() << "\"\n"; - - // calculate the time _after_ the time was updated - Scalar t = timeManager().time() + timeManager().timeStepSize(); - createResultWriter_(); - resultWriter_->beginWrite(t); - model().addOutputVtkFields(model().curSol(), *resultWriter_); - asImp_().addOutputVtkFields(); - resultWriter_->endWrite(); - } - } - -protected: - //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation &asImp_() - { return *static_cast<Implementation *>(this); } - - //! \copydoc asImp_() - const Implementation &asImp_() const - { return *static_cast<const Implementation *>(this); } - - //! Returns the applied VTK-writer for the output - VtkMultiWriter& resultWriter() - { - createResultWriter_(); - return *resultWriter_; - } - //! \copydoc Dumux::IMPETProblem::resultWriter() - VtkMultiWriter& resultWriter() const - { - createResultWriter_(); - return *resultWriter_; - } - - -private: - // makes sure that the result writer exists - void createResultWriter_() - { if (!resultWriter_) resultWriter_ = new VtkMultiWriter(gridView_, asImp_().name()); }; - - std::string simName_; - const GridView gridView_; - - GlobalPosition bboxMin_; - GlobalPosition bboxMax_; - - ElementMapper elementMapper_; - VertexMapper vertexMapper_; - - TimeManager *timeManager_; - - Model model_; - - NewtonMethod newtonMethod_; - NewtonController newtonCtl_; - - VtkMultiWriter *resultWriter_; -}; - -} - -#endif diff --git a/dumux/implicit/box/porousmediaboxproblem.hh b/dumux/implicit/box/porousmediaboxproblem.hh deleted file mode 100644 index 3fc4d54d9cb68729762584098c06c0983f0ff769..0000000000000000000000000000000000000000 --- a/dumux/implicit/box/porousmediaboxproblem.hh +++ /dev/null @@ -1,197 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * 2012 by Bernd Flemisch * - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * \brief Base class for all problems which use the two-phase box model - */ -#ifndef DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH -#define DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH - -#include "boxproperties.hh" - -#include <dumux/implicit/box/boxproblem.hh> - -namespace Dumux -{ -namespace Properties -{ -NEW_PROP_TAG(SpatialParams); //!< The type of the spatial parameters object -NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered in the problem -} - -/*! - * \ingroup BoxBaseProblems - * \brief Base class for all porous media box problems - */ -template<class TypeTag> -class PorousMediaBoxProblem : public BoxProblem<TypeTag> -{ - typedef BoxProblem<TypeTag> ParentType; - - typedef typename GET_PROP_TYPE(TypeTag, Problem) Implementation; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - typedef typename GET_PROP_TYPE(TypeTag, SpatialParams) SpatialParams; - - typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GridView::template Codim<0>::Entity Element; - enum { - dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; - - typedef typename GridView::ctype CoordScalar; - typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition; - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef Dune::FieldVector<Scalar, dim> DimVector; - -public: - /*! - * \brief The constructor - * - * \param timeManager The time manager - * \param gridView The grid view - * \param verbose Turn verbosity on or off - */ - PorousMediaBoxProblem(TimeManager &timeManager, - const GridView &gridView, - const bool verbose = true) - : ParentType(timeManager, gridView), - gravity_(0) - { - newSpatialParams_ = true; - spatialParams_ = new SpatialParams(gridView); - - if (GET_PARAM_FROM_GROUP(TypeTag, bool, Problem, EnableGravity)) - gravity_[dim-1] = -9.81; - } - - ~PorousMediaBoxProblem() - { - if (newSpatialParams_) - delete spatialParams_; - } - - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief Returns the temperature \f$\mathrm{[K]}\f$ within a control volume. - * - * This is the discretization specific interface for the box - * method. By default it just calls temperature(pos). - * - * \param element The DUNE Codim<0> enitiy which intersects with - * the finite volume. - * \param fvGeometry The finite volume geometry of the element. - * \param scvIdx The local index of the sub control volume inside the element - */ - Scalar boxTemperature(const Element &element, - const FVElementGeometry fvGeometry, - const int scvIdx) const - { return asImp_().temperatureAtPos(fvGeometry.subContVol[scvIdx].global); } - - /*! - * \brief Returns the temperature \f$\mathrm{[K]}\f$ at a given global position. - * - * This is not specific to the discretization. By default it just - * calls temperature(). - * - * \param pos The position in global coordinates where the temperature should be specified. - */ - Scalar temperatureAtPos(const GlobalPosition &pos) const - { return asImp_().temperature(); } - - /*! - * \brief Returns the temperature \f$\mathrm{[K]}\f$ for an isothermal problem. - * - * This is not specific to the discretization. By default it just - * throws an exception so it must be overloaded by the problem if - * no energy equation is used. - */ - Scalar temperature() const - { DUNE_THROW(Dune::NotImplemented, "temperature() method not implemented by the actual problem"); }; - - /*! - * \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$. - * - * This is the box discretization specific interface. By default - * it just calls gravityAtPos(). - */ - const DimVector &boxGravity(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return asImp_().gravityAtPos(fvGeometry.subContVol[scvIdx].global); } - - /*! - * \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$. - * - * This is discretization independent interface. By default it - * just calls gravity(). - */ - const DimVector &gravityAtPos(const GlobalPosition &pos) const - { return asImp_().gravity(); } - - /*! - * \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$. - * - * This method is used for problems where the gravitational - * acceleration does not depend on the spatial position. The - * default behaviour is that if the <tt>EnableGravity</tt> - * property is true, \f$\boldsymbol{g} = ( 0,\dots,\ -9.81)^T \f$ holds, - * else \f$\boldsymbol{g} = ( 0,\dots, 0)^T \f$. - */ - const DimVector &gravity() const - { return gravity_; } - - /*! - * \brief Returns the spatial parameters object. - */ - SpatialParams &spatialParams() - { return *spatialParams_; } - - /*! - * \brief Returns the spatial parameters object. - */ - const SpatialParams &spatialParams() const - { return *spatialParams_; } - - // \} - -protected: - //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation &asImp_() - { return *static_cast<Implementation *>(this); } - //! \copydoc asImp_() - const Implementation &asImp_() const - { return *static_cast<const Implementation *>(this); } - - DimVector gravity_; - - // fluids and material properties - SpatialParams* spatialParams_; - bool newSpatialParams_; -}; - -} - -#endif diff --git a/dumux/implicit/cellcentered/ccproblem.hh b/dumux/implicit/cellcentered/ccproblem.hh deleted file mode 100644 index 716bc59f568906ed6085ee3f78584737ed14f70b..0000000000000000000000000000000000000000 --- a/dumux/implicit/cellcentered/ccproblem.hh +++ /dev/null @@ -1,839 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * Copyright (C) 2009 by Andreas Lauser * - * Institute for Modelling Hydraulic and Environmental Systems * - * University of Stuttgart, Germany * - * email: <givenname>.<name>@iws.uni-stuttgart.de * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * \brief Base class for all problems which use the box scheme - */ -#ifndef DUMUX_CC_PROBLEM_HH -#define DUMUX_CC_PROBLEM_HH - -#include "ccproperties.hh" - -#include <dumux/io/vtkmultiwriter.hh> -#include <dumux/io/restart.hh> - -namespace Dumux -{ -/*! - * \ingroup CCModel - * \ingroup CCBaseProblems - * \brief Base class for all problems which use the box scheme. - * - * \note All quantities are specified assuming a threedimensional - * world. Problems discretized using 2D grids are assumed to be - * extruded by \f$1 m\f$ and 1D grids are assumed to have a - * cross section of \f$1m \times 1m\f$. - */ -template<class TypeTag> -class CCProblem -{ -private: - typedef typename GET_PROP_TYPE(TypeTag, Problem) Implementation; - typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - - typedef Dumux::VtkMultiWriter<GridView> VtkMultiWriter; - - typedef typename GET_PROP_TYPE(TypeTag, NewtonMethod) NewtonMethod; - typedef typename GET_PROP_TYPE(TypeTag, NewtonController) NewtonController; - - typedef typename GET_PROP_TYPE(TypeTag, Model) Model; - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; - - typedef typename GET_PROP_TYPE(TypeTag, VertexMapper) VertexMapper; - typedef typename GET_PROP_TYPE(TypeTag, ElementMapper) ElementMapper; - - typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; - typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables; - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; - - enum { - dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; - - typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<dim>::Entity Vertex; - typedef typename GridView::template Codim<dim>::Iterator VertexIterator; - typedef typename GridView::template Codim<0>::Iterator ElementIterator; - typedef typename GridView::Intersection Intersection; - - typedef typename GridView::Grid::ctype CoordScalar; - typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition; - - // copying a problem is not a good idea - CCProblem(const CCProblem &); - -public: - /*! - * \brief Constructor - * - * \param timeManager The TimeManager which is used by the simulation - * \param gridView The simulation's idea about physical space - */ - CCProblem(TimeManager &timeManager, const GridView &gridView) - : gridView_(gridView) - , bboxMin_(std::numeric_limits<double>::max()) - , bboxMax_(-std::numeric_limits<double>::max()) - , elementMapper_(gridView) - , vertexMapper_(gridView) - , timeManager_(&timeManager) - , newtonMethod_(asImp_()) - , newtonCtl_(asImp_()) - { - // calculate the bounding box of the local partition of the grid view - VertexIterator vIt = gridView.template begin<dim>(); - const VertexIterator vEndIt = gridView.template end<dim>(); - for (; vIt!=vEndIt; ++vIt) { - for (int i=0; i<dim; i++) { - bboxMin_[i] = std::min(bboxMin_[i], vIt->geometry().corner(0)[i]); - bboxMax_[i] = std::max(bboxMax_[i], vIt->geometry().corner(0)[i]); - } - } - - // communicate to get the bounding box of the whole domain - if (gridView.comm().size() > 1) - for (int i = 0; i < dim; ++i) { - bboxMin_[i] = gridView.comm().min(bboxMin_[i]); - bboxMax_[i] = gridView.comm().max(bboxMax_[i]); - } - - // set a default name for the problem - simName_ = "sim"; - - resultWriter_ = NULL; - } - - ~CCProblem() - { - delete resultWriter_; - }; - - - /*! - * \brief Called by the Dumux::TimeManager in order to - * initialize the problem. - * - * If you overload this method don't forget to call - * ParentType::init() - */ - void init() - { - // set the initial condition of the model - model().init(asImp_()); - } - - /*! - * \brief Specifies which kind of boundary condition should be - * used for which equation on a given boundary segment. - * - * \param values The boundary types for the conservation equations - * \param intersection The intersection for which the boundary type is set - */ - void boundaryTypes(BoundaryTypes &values, - const Intersection &intersection) const - { - // forward it to the method which only takes the global coordinate - asImp_().boundaryTypesAtPos(values, intersection.geometry().center()); - } - - /*! - * \brief Specifies which kind of boundary condition should be - * used for which equation on a given boundary segment. - * - * \param values The boundary types for the conservation equations - * \param pos The position of the finite volume in global coordinates - */ - void boundaryTypesAtPos(BoundaryTypes &values, - const GlobalPosition &pos) const - { - // Throw an exception (there is no reasonable default value - // for Dirichlet conditions) - DUNE_THROW(Dune::InvalidStateException, - "The problem does not provide " - "a boundaryTypes() method."); - } - - - /*! - * \brief Evaluate the boundary conditions for a dirichlet - * control volume. - * - * \param values The dirichlet values for the primary variables - * \param intersection The intersection representing the "half volume on the boundary" - * - * For this method, the \a values parameter stores primary variables. - */ - void dirichlet(PrimaryVariables &values, - const Intersection &intersection) const - { - // forward it to the method which only takes the global coordinate - asImp_().dirichletAtPos(values, intersection.geometry().center()); - } - - /*! - * \brief Evaluate the boundary conditions for a dirichlet - * control volume. - * - * \param values The dirichlet values for the primary variables - * \param pos The position of the center of the finite volume - * for which the dirichlet condition ought to be - * set in global coordinates - * - * For this method, the \a values parameter stores primary variables. - */ - void dirichletAtPos(PrimaryVariables &values, - const GlobalPosition &pos) const - { - // Throw an exception (there is no reasonable default value - // for Dirichlet conditions) - DUNE_THROW(Dune::InvalidStateException, - "The problem specifies that some boundary " - "segments are dirichlet, but does not provide " - "a dirichlet() method."); - } - - /*! - * \brief Evaluate the boundary conditions for a neumann - * boundary segment. - * - * This is the method for the case where the Neumann condition is - * potentially solution dependent and requires some box method - * specific things. - * - * \param values The neumann values for the conservation equations [kg / (m^2 *s )] - * \param element The finite element - * \param fvElemGeom The finite-volume geometry in the box scheme - * \param is The intersection between element and boundary - * \param scvIdx The local vertex index - * \param boundaryFaceIdx The index of the boundary face - * \param elemVolVars All volume variables for the element - * - * For this method, the \a values parameter stores the mass flux - * in normal direction of each phase. Negative values mean influx. - */ - void boxSDNeumann(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvElemGeom, - const Intersection &is, - int scvIdx, - int boundaryFaceIdx, - const ElementVolumeVariables &elemVolVars) const - { - // forward it to the interface without the volume variables - asImp_().neumann(values, - element, - fvElemGeom, - is, - scvIdx, - boundaryFaceIdx); - } - - /*! - * \brief Evaluate the boundary conditions for a neumann - * boundary segment. - * - * \param values The neumann values for the conservation equations [kg / (m^2 *s )] - * \param element The finite element - * \param fvElemGeom The finite-volume geometry in the box scheme - * \param is The intersection between element and boundary - * \param scvIdx The local vertex index - * \param boundaryFaceIdx The index of the boundary face - * - * For this method, the \a values parameter stores the mass flux - * in normal direction of each phase. Negative values mean influx. - */ - void neumann(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvElemGeom, - const Intersection &is, - int scvIdx, - int boundaryFaceIdx) const - { - // forward it to the interface with only the global position - asImp_().neumannAtPos(values, fvElemGeom.boundaryFace[boundaryFaceIdx].ipGlobal); - } - - /*! - * \brief Evaluate the boundary conditions for a neumann - * boundary segment. - * - * \param values The neumann values for the conservation equations [kg / (m^2 *s )] - * \param pos The position of the boundary face's integration point in global coordinates - * - * For this method, the \a values parameter stores the mass flux - * in normal direction of each phase. Negative values mean influx. - */ - void neumannAtPos(PrimaryVariables &values, - const GlobalPosition &pos) const - { - // Throw an exception (there is no reasonable default value - // for Neumann conditions) - DUNE_THROW(Dune::InvalidStateException, - "The problem specifies that some boundary " - "segments are neumann, but does not provide " - "a neumannAtPos() method."); - } - - /*! - * \brief Evaluate the source term for all phases within a given - * sub-control-volume. - * - * This is the method for the case where the source term is - * potentially solution dependent and requires some box method - * specific things. - * - * \param values The source and sink values for the conservation equations - * \param element The finite element - * \param fvElemGeom The finite-volume geometry in the box scheme - * \param scvIdx The local vertex index - * \param elemVolVars All volume variables for the element - * - * For this method, the \a values parameter stores the rate mass - * generated or annihilate per volume unit. Positive values mean - * that mass is created, negative ones mean that it vanishes. - */ - void boxSDSource(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvElemGeom, - int scvIdx, - const ElementVolumeVariables &elemVolVars) const - { - // forward to solution independent, box specific interface - asImp_().source(values, element, fvElemGeom, scvIdx); - } - - /*! - * \brief Evaluate the source term for all phases within a given - * sub-control-volume. - * - * \param values The source and sink values for the conservation equations - * \param element The finite element - * \param fvElemGeom The finite-volume geometry in the box scheme - * \param scvIdx The local vertex index - * - * For this method, the \a values parameter stores the rate mass - * generated or annihilate per volume unit. Positive values mean - * that mass is created, negative ones mean that it vanishes. - */ - void source(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvElemGeom, - int scvIdx) const - { - // forward to generic interface - asImp_().sourceAtPos(values, fvElemGeom.subContVol[scvIdx].global); - } - - /*! - * \brief Evaluate the source term for all phases within a given - * sub-control-volume. - * - * \param values The source and sink values for the conservation equations - * \param pos The position of the center of the finite volume - * for which the source term ought to be - * specified in global coordinates - * - * For this method, the \a values parameter stores the rate mass - * generated or annihilate per volume unit. Positive values mean - * that mass is created, negative ones mean that it vanishes. - */ - void sourceAtPos(PrimaryVariables &values, - const GlobalPosition &pos) const - { - DUNE_THROW(Dune::InvalidStateException, - "The problem does not provide " - "a sourceAtPos() method."); - } - - /*! - * \brief Evaluate the initial value for a control volume. - * - * \param values The initial values for the primary variables - * \param element The finite element - * \param fvElemGeom The finite-volume geometry in the box scheme - * \param scvIdx The local vertex index - * - * For this method, the \a values parameter stores primary - * variables. - */ - void initial(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvElemGeom, - int scvIdx) const - { - // forward to generic interface - asImp_().initialAtPos(values, fvElemGeom.subContVol[scvIdx].global); - } - - /*! - * \brief Evaluate the initial value for a control volume. - * - * \param values The dirichlet values for the primary variables - * \param pos The position of the center of the finite volume - * for which the initial values ought to be - * set (in global coordinates) - * - * For this method, the \a values parameter stores primary variables. - */ - void initialAtPos(PrimaryVariables &values, - const GlobalPosition &pos) const - { - // Throw an exception (there is no reasonable default value - // for Dirichlet conditions) - DUNE_THROW(Dune::InvalidStateException, - "The problem does not provide " - "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 - * sub-models. - * - * By default it does nothing - * - * \param element The DUNE Codim<0> entity for which the coupling - * parameters should be computed. - */ - void updateCouplingParams(const Element &element) const - {} - - /*! - * \name Simulation steering - */ - // \{ - - /*! - * \brief Called by the time manager before the time integration. - */ - void preTimeStep() - {} - - /*! - * \brief Called by Dumux::TimeManager in order to do a time - * integration on the model. - */ - void timeIntegration() - { - const int maxFails = 10; - for (int i = 0; i < maxFails; ++i) { - if (model_.update(newtonMethod_, newtonCtl_)) - return; - - Scalar dt = timeManager().timeStepSize(); - Scalar nextDt = dt / 2; - timeManager().setTimeStepSize(nextDt); - - // update failed - std::cout << "Newton solver did not converge with dt="<<dt<<" seconds. Retrying with time step of " - << nextDt << " seconds\n"; - } - - DUNE_THROW(Dune::MathError, - "Newton solver didn't converge after " - << maxFails - << " time-step divisions. dt=" - << timeManager().timeStepSize()); - } - - /*! - * \brief Returns the newton method object - */ - NewtonMethod &newtonMethod() - { return newtonMethod_; } - - /*! - * \copydoc newtonMethod() - */ - const NewtonMethod &newtonMethod() const - { return newtonMethod_; } - - /*! - * \brief Returns the newton contoller object - */ - NewtonController &newtonController() - { return newtonCtl_; } - - /*! - * \copydoc newtonController() - */ - const NewtonController &newtonController() const - { return newtonCtl_; } - - /*! - * \brief Called by Dumux::TimeManager whenever a solution for a - * time step has been computed and the simulation time has - * been updated. - * - * \param dt The current time-step size - */ - Scalar nextTimeStepSize(Scalar dt) - { - return std::min(GET_PARAM_FROM_GROUP(TypeTag, Scalar, TimeManager, MaxTimeStepSize), - newtonCtl_.suggestTimeStepSize(dt)); - }; - - /*! - * \brief Returns true if a restart file should be written to - * disk. - * - * The default behavior is to write one restart file every 5 time - * steps. This file is intended to be overwritten by the - * implementation. - */ - bool shouldWriteRestartFile() const - { - return timeManager().timeStepIndex() > 0 && - (timeManager().timeStepIndex() % 10 == 0); - } - - /*! - * \brief Returns true if the current solution should be written to - * disk (i.e. as a VTK file) - * - * The default behavior is to write out every the solution for - * very time step. This file is intended to be overwritten by the - * implementation. - */ - bool shouldWriteOutput() const - { return true; } - - /*! - * \brief Called by the time manager after the time integration to - * do some post processing on the solution. - */ - void postTimeStep() - { } - - /*! - * \brief Called by the time manager after everything which can be - * done about the current time step is finished and the - * model should be prepared to do the next time integration. - */ - void advanceTimeLevel() - { - model_.advanceTimeLevel(); - } - - /*! - * \brief Called when the end of an simulation episode is reached. - * - * Typically a new episode should be started in this method. - */ - void episodeEnd() - { - std::cerr << "The end of an episode is reached, but the problem " - << "does not override the episodeEnd() method. " - << "Doing nothing!\n"; - }; - // \} - - /*! - * \brief The problem name. - * - * This is used as a prefix for files generated by the simulation. - * It could be either overwritten by the problem files, or simply - * declared over the setName() function in the application file. - */ - const char *name() const - { - return simName_.c_str(); - } - - /*! - * \brief Set the problem name. - * - * This static method sets the simulation name, which should be - * called before the application problem is declared! If not, the - * default name "sim" will be used. - * - * \param newName The problem's name - */ - void setName(const char *newName) - { - simName_ = newName; - } - - - /*! - * \brief Returns the number of the current VTK file. - */ - int currentVTKFileNumber() - { - createResultWriter_(); - return resultWriter_->curWriterNum(); - } - - /*! - * \brief The GridView which used by the problem. - */ - const GridView &gridView() const - { return gridView_; } - - /*! - * \brief The coordinate of the corner of the GridView's bounding - * box with the smallest values. - */ - const GlobalPosition &bboxMin() const - { return bboxMin_; } - - /*! - * \brief The coordinate of the corner of the GridView's bounding - * box with the largest values. - */ - const GlobalPosition &bboxMax() const - { return bboxMax_; } - - /*! - * \brief Returns the mapper for vertices to indices. - */ - const VertexMapper &vertexMapper() const - { return vertexMapper_; } - - /*! - * \brief Returns the mapper for elements to indices. - */ - const ElementMapper &elementMapper() const - { return elementMapper_; } - - /*! - * \brief Returns TimeManager object used by the simulation - */ - TimeManager &timeManager() - { return *timeManager_; } - - /*! - * \copydoc timeManager() - */ - const TimeManager &timeManager() const - { return *timeManager_; } - - /*! - * \brief Returns numerical model used for the problem. - */ - Model &model() - { return model_; } - - /*! - * \copydoc model() - */ - const Model &model() const - { return model_; } - // \} - - /*! - * \name Restart mechanism - */ - // \{ - - /*! - * \brief This method writes the complete state of the simulation - * to the harddisk. - * - * The file will start with the prefix returned by the name() - * method, has the current time of the simulation clock in it's - * name and uses the extension <tt>.drs</tt>. (Dumux ReStart - * file.) See Dumux::Restart for details. - */ - void serialize() - { - typedef Dumux::Restart Restarter; - Restarter res; - res.serializeBegin(asImp_()); - if (gridView().comm().rank() == 0) - std::cout << "Serialize to file '" << res.fileName() << "'\n"; - - timeManager().serialize(res); - asImp_().serialize(res); - res.serializeEnd(); - } - - /*! - * \brief This method writes the complete state of the problem - * to the harddisk. - * - * The file will start with the prefix returned by the name() - * method, has the current time of the simulation clock in it's - * name and uses the extension <tt>.drs</tt>. (Dumux ReStart - * file.) See Dumux::Restart for details. - * - * \tparam Restarter The serializer type - * - * \param res The serializer object - */ - template <class Restarter> - void serialize(Restarter &res) - { - createResultWriter_(); - resultWriter_->serialize(res); - model().serialize(res); - } - - /*! - * \brief Load a previously saved state of the whole simulation - * from disk. - * - * \param tRestart The simulation time on which the program was - * written to disk. - */ - void restart(Scalar tRestart) - { - typedef Dumux::Restart Restarter; - - Restarter res; - - res.deserializeBegin(asImp_(), tRestart); - if (gridView().comm().rank() == 0) - std::cout << "Deserialize from file '" << res.fileName() << "'\n"; - timeManager().deserialize(res); - asImp_().deserialize(res); - res.deserializeEnd(); - } - - /*! - * \brief This method restores the complete state of the problem - * from disk. - * - * It is the inverse of the serialize() method. - * - * \tparam Restarter The deserializer type - * - * \param res The deserializer object - */ - template <class Restarter> - void deserialize(Restarter &res) - { - createResultWriter_(); - resultWriter_->deserialize(res); - model().deserialize(res); - } - - // \} - - /*! - * \brief Adds additional VTK output data to the VTKWriter. Function is called by writeOutput(). - */ - void addOutputVtkFields() - {} - - /*! - * \brief Write the relevant secondary variables of the current - * solution into an VTK output file. - */ - void writeOutput(bool verbose = true) - { - // write the current result to disk - if (asImp_().shouldWriteOutput()) { - if (verbose && gridView().comm().rank() == 0) - std::cout << "Writing result file for \"" << asImp_().name() << "\"\n"; - - // calculate the time _after_ the time was updated - Scalar t = timeManager().time() + timeManager().timeStepSize(); - createResultWriter_(); - resultWriter_->beginWrite(t); - model().addOutputVtkFields(model().curSol(), *resultWriter_); - asImp_().addOutputVtkFields(); - resultWriter_->endWrite(); - } - } - -protected: - //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation &asImp_() - { return *static_cast<Implementation *>(this); } - - //! \copydoc asImp_() - const Implementation &asImp_() const - { return *static_cast<const Implementation *>(this); } - - //! Returns the applied VTK-writer for the output - VtkMultiWriter& resultWriter() - { - createResultWriter_(); - return *resultWriter_; - } - //! \copydoc Dumux::IMPETProblem::resultWriter() - VtkMultiWriter& resultWriter() const - { - createResultWriter_(); - return *resultWriter_; - } - - -private: - // makes sure that the result writer exists - void createResultWriter_() - { if (!resultWriter_) resultWriter_ = new VtkMultiWriter(gridView_, asImp_().name()); }; - - std::string simName_; - const GridView gridView_; - - GlobalPosition bboxMin_; - GlobalPosition bboxMax_; - - ElementMapper elementMapper_; - VertexMapper vertexMapper_; - - TimeManager *timeManager_; - - Model model_; - - NewtonMethod newtonMethod_; - NewtonController newtonCtl_; - - VtkMultiWriter *resultWriter_; -}; - -} - -#endif diff --git a/dumux/implicit/cellcentered/porousmediaccproblem.hh b/dumux/implicit/cellcentered/porousmediaccproblem.hh deleted file mode 100644 index 5556f53468eb12fd5113cba15a9b13226a7baadc..0000000000000000000000000000000000000000 --- a/dumux/implicit/cellcentered/porousmediaccproblem.hh +++ /dev/null @@ -1,199 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * Copyright (C) 2009 by Andreas Lauser * - * Institute for Modelling Hydraulic and Environmental Systems * - * University of Stuttgart, Germany * - * email: <givenname>.<name>@iws.uni-stuttgart.de * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * \brief Base class for all problems which use the two-phase box model - */ -#ifndef DUMUX_POROUS_MEDIA_CC_PROBLEM_HH -#define DUMUX_POROUS_MEDIA_CC_PROBLEM_HH - -#include <dumux/implicit/cellcentered/ccproblem.hh> -#include "ccproperties.hh" - -namespace Dumux -{ - -namespace Properties -{ - NEW_PROP_TAG(SpatialParams); - NEW_PROP_TAG(ProblemEnableGravity); -} - -/*! - * \ingroup CCBaseProblems - * \brief Base class for all fully implicit cell centered porous media problems - */ -template<class TypeTag> -class PorousMediaCCProblem : public CCProblem<TypeTag> -{ - typedef CCProblem<TypeTag> ParentType; - - typedef typename GET_PROP_TYPE(TypeTag, Problem) Implementation; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - typedef typename GET_PROP_TYPE(TypeTag, SpatialParams) SpatialParams; - - typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GridView::template Codim<0>::Entity Element; - enum { - dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; - - typedef typename GridView::ctype CoordScalar; - typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition; - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef Dune::FieldVector<Scalar, dim> Vector; - -public: - /*! - * \brief The constructor - * - * \param timeManager The time manager - * \param gridView The grid view - * \param verbose Turn verbosity on or off - */ - PorousMediaCCProblem(TimeManager &timeManager, - const GridView &gridView, - bool verbose = true) - : ParentType(timeManager, gridView), - gravity_(0) - { - newSpatialParams_ = true; - spatialParams_ = new SpatialParams(gridView); - - if (GET_PARAM_FROM_GROUP(TypeTag, bool, Problem, EnableGravity)) - gravity_[dim-1] = -9.81; - } - - ~PorousMediaCCProblem() - { - if (newSpatialParams_) - delete spatialParams_; - } - - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief Returns the temperature \f$\mathrm{[K]}\f$ within a control volume. - * - * This is the discretization specific interface for the box - * method. By default it just calls temperature(pos). - * - * \param element The DUNE Codim<0> enitiy which intersects with - * the finite volume. - * \param fvGeom The finite volume geometry of the element. - * \param scvIdx The local index of the sub control volume inside the element - */ - Scalar boxTemperature(const Element &element, - const FVElementGeometry fvGeom, - int scvIdx) const - { return asImp_().temperatureAtPos(fvGeom.neighbors[scvIdx]->geometry().center()); } - - /*! - * \brief Returns the temperature \f$\mathrm{[K]}\f$ at a given global position. - * - * This is not specific to the discretization. By default it just - * calls temperature(). - * - * \param pos The position in global coordinates where the temperature should be specified. - */ - Scalar temperatureAtPos(const GlobalPosition &pos) const - { return asImp_().temperature(); } - - /*! - * \brief Returns the temperature \f$\mathrm{[K]}\f$ for an isothermal problem. - * - * This is not specific to the discretization. By default it just - * throws an exception so it must be overloaded by the problem if - * no energy equation is used. - */ - Scalar temperature() const - { DUNE_THROW(Dune::NotImplemented, "temperature() method not implemented by the actual problem"); }; - - /*! - * \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$. - * - * This is the box discretization specific interface. By default - * it just calls gravityAtPos(). - */ - const Vector &boxGravity(const Element &element, - const FVElementGeometry &fvGeom, - int scvIdx) const - { return asImp_().gravityAtPos(fvGeom.neighbors[scvIdx]->geometry().center()); } - - /*! - * \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$. - * - * This is discretization independent interface. By default it - * just calls gravity(). - */ - const Vector &gravityAtPos(const GlobalPosition &pos) const - { return asImp_().gravity(); } - - /*! - * \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$. - * - * This method is used for problems where the gravitational - * acceleration does not depend on the spatial position. The - * default behaviour is that if the <tt>ProblemEnableGravity</tt> - * property is true, \f$\boldsymbol{g} = ( 0,\dots,\ -9.81)^T \f$ holds, - * else \f$\boldsymbol{g} = ( 0,\dots, 0)^T \f$. - */ - const Vector &gravity() const - { return gravity_; } - - /*! - * \brief Returns the spatial parameters object. - */ - SpatialParams &spatialParams() - { return *spatialParams_; } - - /*! - * \brief Returns the spatial parameters object. - */ - const SpatialParams &spatialParams() const - { return *spatialParams_; } - - // \} - -private: - //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation &asImp_() - { return *static_cast<Implementation *>(this); } - //! \copydoc asImp_() - const Implementation &asImp_() const - { return *static_cast<const Implementation *>(this); } - - Vector gravity_; - - // fluids and material properties - SpatialParams* spatialParams_; - bool newSpatialParams_; -}; - -} - -#endif diff --git a/dumux/implicit/common/porousmediaimplicitproblem.hh b/dumux/implicit/common/implicitporousmediaproblem.hh similarity index 86% rename from dumux/implicit/common/porousmediaimplicitproblem.hh rename to dumux/implicit/common/implicitporousmediaproblem.hh index 80e0465358929c2d8d42ba6fadacbccb33707ed8..0fbde7b6edbbef7299712e892a35a8ce6c6128b3 100644 --- a/dumux/implicit/common/porousmediaimplicitproblem.hh +++ b/dumux/implicit/common/implicitporousmediaproblem.hh @@ -19,14 +19,14 @@ *****************************************************************************/ /*! * \file - * \brief Base class for all problems which use the two-phase box model + * \brief Base class for all fully implicit porous media problems */ -#ifndef DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH -#define DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH +#ifndef DUMUX_IMPLICIT_POROUS_MEDIA_PROBLEM_HH +#define DUMUX_IMPLICIT_POROUS_MEDIA_PROBLEM_HH #include "implicitproperties.hh" -#include <dumux/implicit/box/boxproblem.hh> +#include <dumux/implicit/common/implicitproblem.hh> namespace Dumux { @@ -41,9 +41,9 @@ NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered i * \brief Base class for all porous media box problems */ template<class TypeTag> -class PorousMediaBoxProblem : public BoxProblem<TypeTag> +class ImplicitPorousMediaProblem : public ImplicitProblem<TypeTag> { - typedef BoxProblem<TypeTag> ParentType; + typedef ImplicitProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, Problem) Implementation; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; @@ -62,6 +62,8 @@ class PorousMediaBoxProblem : public BoxProblem<TypeTag> typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef Dune::FieldVector<Scalar, dim> DimVector; + enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; + public: /*! * \brief The constructor @@ -70,7 +72,7 @@ public: * \param gridView The grid view * \param verbose Turn verbosity on or off */ - PorousMediaBoxProblem(TimeManager &timeManager, + ImplicitPorousMediaProblem(TimeManager &timeManager, const GridView &gridView, const bool verbose = true) : ParentType(timeManager, gridView), @@ -83,7 +85,7 @@ public: gravity_[dim-1] = -9.81; } - ~PorousMediaBoxProblem() + ~ImplicitPorousMediaProblem() { if (newSpatialParams_) delete spatialParams_; @@ -108,8 +110,13 @@ public: Scalar boxTemperature(const Element &element, const FVElementGeometry fvGeometry, const int scvIdx) const - { return asImp_().temperatureAtPos(fvGeometry.subContVol[scvIdx].global); } - + { + if (isBox) + return asImp_().temperatureAtPos(fvGeometry.subContVol[scvIdx].global); + else + return asImp_().temperatureAtPos(fvGeometry.neighbors[scvIdx]->geometry().center()); + } + /*! * \brief Returns the temperature \f$\mathrm{[K]}\f$ at a given global position. * @@ -140,7 +147,12 @@ public: const DimVector &boxGravity(const Element &element, const FVElementGeometry &fvGeometry, const int scvIdx) const - { return asImp_().gravityAtPos(fvGeometry.subContVol[scvIdx].global); } + { + if (isBox) + return asImp_().gravityAtPos(fvGeometry.subContVol[scvIdx].global); + else + return asImp_().gravityAtPos(fvGeometry.neighbors[scvIdx]->geometry().center()); + } /*! * \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$. @@ -156,7 +168,7 @@ public: * * This method is used for problems where the gravitational * acceleration does not depend on the spatial position. The - * default behaviour is that if the <tt>EnableGravity</tt> + * default behaviour is that if the <tt>ProblemEnableGravity</tt> * property is true, \f$\boldsymbol{g} = ( 0,\dots,\ -9.81)^T \f$ holds, * else \f$\boldsymbol{g} = ( 0,\dots, 0)^T \f$. */ diff --git a/dumux/implicit/common/implicitproblem.hh b/dumux/implicit/common/implicitproblem.hh index 81182f447289cbb611bb343966d918fff6181649..13612313613018ac48d1bbfde2882bd25841daf9 100644 --- a/dumux/implicit/common/implicitproblem.hh +++ b/dumux/implicit/common/implicitproblem.hh @@ -18,10 +18,10 @@ *****************************************************************************/ /*! * \file - * \brief Base class for all problems which use the box scheme + * \brief Base class for all fully implicit problems */ -#ifndef DUMUX_BOX_PROBLEM_HH -#define DUMUX_BOX_PROBLEM_HH +#ifndef DUMUX_IMPLICIT_PROBLEM_HH +#define DUMUX_IMPLICIT_PROBLEM_HH #include "implicitproperties.hh" @@ -31,8 +31,8 @@ namespace Dumux { /*! - * \ingroup BoxModel - * \ingroup BoxBaseProblems + * \ingroup ImplicitModel + * \ingroup ImplicitBaseProblems * \brief Base class for all problems which use the box scheme. * * \note All quantities are specified assuming a threedimensional @@ -41,7 +41,7 @@ namespace Dumux * cross section of \f$1m \times 1m\f$. */ template<class TypeTag> -class BoxProblem +class ImplicitProblem { private: typedef typename GET_PROP_TYPE(TypeTag, Problem) Implementation; @@ -77,8 +77,10 @@ private: typedef typename GridView::Grid::ctype CoordScalar; typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition; + enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; + // copying a problem is not a good idea - BoxProblem(const BoxProblem &); + ImplicitProblem(const ImplicitProblem &); public: /*! @@ -87,7 +89,7 @@ public: * \param timeManager The TimeManager which is used by the simulation * \param gridView The simulation's idea about physical space */ - BoxProblem(TimeManager &timeManager, const GridView &gridView) + ImplicitProblem(TimeManager &timeManager, const GridView &gridView) : gridView_(gridView) , bboxMin_(std::numeric_limits<double>::max()) , bboxMax_(-std::numeric_limits<double>::max()) @@ -120,7 +122,7 @@ public: resultWriter_ = NULL; } - ~BoxProblem() + ~ImplicitProblem() { delete resultWriter_; }; @@ -149,10 +151,32 @@ public: void boundaryTypes(BoundaryTypes &values, const Vertex &vertex) const { + if (!isBox) + DUNE_THROW(Dune::InvalidStateException, + "boundaryTypes(..., vertex) called for cell-centered method."); + // forward it to the method which only takes the global coordinate asImp_().boundaryTypesAtPos(values, vertex.geometry().center()); } + /*! + * \brief Specifies which kind of boundary condition should be + * used for which equation on a given boundary segment. + * + * \param values The boundary types for the conservation equations + * \param intersection The intersection for which the boundary type is set + */ + void boundaryTypes(BoundaryTypes &values, + const Intersection &intersection) const + { + if (isBox) + DUNE_THROW(Dune::InvalidStateException, + "boundaryTypes(..., intersection) called for box method."); + + // forward it to the method which only takes the global coordinate + asImp_().boundaryTypesAtPos(values, intersection.geometry().center()); + } + /*! * \brief Specifies which kind of boundary condition should be * used for which equation on a given boundary segment. @@ -170,7 +194,6 @@ public: "a boundaryTypes() method."); } - /*! * \brief Evaluate the boundary conditions for a dirichlet * control volume. @@ -183,10 +206,34 @@ public: void dirichlet(PrimaryVariables &values, const Vertex &vertex) const { + if (!isBox) + DUNE_THROW(Dune::InvalidStateException, + "dirichlet(..., vertex) called for cell-centered method."); + // forward it to the method which only takes the global coordinate asImp_().dirichletAtPos(values, vertex.geometry().center()); } + /*! + * \brief Evaluate the boundary conditions for a dirichlet + * control volume. + * + * \param values The dirichlet values for the primary variables + * \param intersection The intersection for which the condition is evaluated + * + * For this method, the \a values parameter stores primary variables. + */ + void dirichlet(PrimaryVariables &values, + const Intersection &intersection) const + { + if (isBox) + DUNE_THROW(Dune::InvalidStateException, + "dirichlet(..., intersection) called for box method."); + + // forward it to the method which only takes the global coordinate + asImp_().dirichletAtPos(values, intersection.geometry().center()); + } + /*! * \brief Evaluate the boundary conditions for a dirichlet * control volume. diff --git a/dumux/implicit/richards/richardsproblem.hh b/dumux/implicit/richards/richardsproblem.hh index 59c080ce90dbe483f028f858c952fe88ef5805ac..2235f9acb0f58d8fe301250f14ab9cc6b78b51b0 100644 --- a/dumux/implicit/richards/richardsproblem.hh +++ b/dumux/implicit/richards/richardsproblem.hh @@ -23,7 +23,7 @@ #ifndef DUMUX_RICHARDS_PROBLEM_HH #define DUMUX_RICHARDS_PROBLEM_HH -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include "richardsproperties.hh" @@ -37,9 +37,9 @@ namespace Dumux * For a description of the Richards model, see Dumux::RichardsModel */ template<class TypeTag> -class RichardsBoxProblem : public PorousMediaBoxProblem<TypeTag> +class RichardsBoxProblem : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; @@ -56,7 +56,7 @@ public: * jacobian assembler, etc inside the constructor. * * If the problem requires information from these, the - * BoxProblem::init() method be overloaded. + * ImplicitProblem::init() method be overloaded. * * \param timeManager The TimeManager which keeps track of time * \param gridView The GridView used by the problem. diff --git a/test/common/generalproblem/generallensproblem.hh b/test/common/generalproblem/generallensproblem.hh index 30511d12deb106e9fd1f2a738d4b48d939019058..5e527df61026d181241c3f5e367ff4dc7e1d767b 100644 --- a/test/common/generalproblem/generallensproblem.hh +++ b/test/common/generalproblem/generallensproblem.hh @@ -35,7 +35,7 @@ #include <dumux/material/fluidsystems/liquidphase.hh> //box model -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/implicit/2p/2pmodel.hh> //decoupled model @@ -110,7 +110,7 @@ NEW_TYPE_TAG(BoxGeneralLensProblem, INHERITS_FROM(BoxTwoP, GeneralLensProblem)); // Set the problem property SET_PROP(BoxGeneralLensProblem, ProblemBaseClass) { - typedef Dumux::PorousMediaBoxProblem<TypeTag> type; + typedef Dumux::ImplicitPorousMediaProblem<TypeTag> type; }; // Set the problem property diff --git a/test/freeflow/stokes/stokestestproblem.hh b/test/freeflow/stokes/stokestestproblem.hh index 5b5bfe4f0a20ef4964ee291c1f374f13d779e13d..a104e300a17059c69ee816e5db415c5148e6cf17 100644 --- a/test/freeflow/stokes/stokestestproblem.hh +++ b/test/freeflow/stokes/stokestestproblem.hh @@ -158,7 +158,7 @@ public: */ // \{ - //! \copydoc BoxProblem::boundaryTypes() + //! \copydoc ImplicitProblem::boundaryTypes() void boundaryTypes(BoundaryTypes &values, const Vertex &vertex) const { const GlobalPosition globalPos = vertex.geometry().center(); @@ -179,7 +179,7 @@ public: values.setDirichlet(massBalanceIdx); } - //! \copydoc BoxProblem::dirichlet() + //! \copydoc ImplicitProblem::dirichlet() void dirichlet(PrimaryVariables &values, const Vertex &vertex) const { const GlobalPosition globalPos = vertex.geometry().center(); @@ -228,7 +228,7 @@ public: */ // \{ - //! \copydoc BoxProblem::source() + //! \copydoc ImplicitProblem::source() void source(PrimaryVariables &values, const Element &element, const FVElementGeometry &fvGeometry, @@ -239,7 +239,7 @@ public: values = Scalar(0.0); } - //! \copydoc BoxProblem::initial() + //! \copydoc ImplicitProblem::initial() void initial(PrimaryVariables &values, const Element &element, const FVElementGeometry &fvGeometry, diff --git a/test/freeflow/stokes2c/stokes2ctestproblem.hh b/test/freeflow/stokes2c/stokes2ctestproblem.hh index 47d039202b5951aeba686835e762cafddf2f4ffd..6cee5fdc6fc7a73f0703091e7e577bbe9d1ff824 100644 --- a/test/freeflow/stokes2c/stokes2ctestproblem.hh +++ b/test/freeflow/stokes2c/stokes2ctestproblem.hh @@ -166,7 +166,7 @@ public: */ // \{ - //! \copydoc BoxProblem::boundaryTypes() + //! \copydoc ImplicitProblem::boundaryTypes() void boundaryTypes(BoundaryTypes &values, const Vertex &vertex) const { const GlobalPosition globalPos = vertex.geometry().center(); @@ -187,7 +187,7 @@ public: values.setDirichlet(massBalanceIdx); } - //! \copydoc BoxProblem::dirichlet() + //! \copydoc ImplicitProblem::dirichlet() void dirichlet(PrimaryVariables &values, const Vertex &vertex) const { const GlobalPosition globalPos = vertex.geometry().center(); @@ -199,7 +199,7 @@ public: } } - //! \copydoc BoxProblem::neumann() + //! \copydoc ImplicitProblem::neumann() void neumann(PrimaryVariables &values, const Element &element, const FVElementGeometry &fvGeometry, @@ -216,7 +216,7 @@ public: */ // \{ - //! \copydoc BoxProblem::source() + //! \copydoc ImplicitProblem::source() void source(PrimaryVariables &values, const Element &element, const FVElementGeometry &fvGeometry, @@ -227,7 +227,7 @@ public: values = Scalar(0.0); } - //! \copydoc BoxProblem::initial() + //! \copydoc ImplicitProblem::initial() void initial(PrimaryVariables &values, const Element &element, const FVElementGeometry &fvGeometry, diff --git a/test/freeflow/stokes2cni/stokes2cnitestproblem.hh b/test/freeflow/stokes2cni/stokes2cnitestproblem.hh index 92a67cee1638b59a9868fa167357c89292099d23..4f9a60ad318c82f7330fd37b7230260a6bce9cf3 100644 --- a/test/freeflow/stokes2cni/stokes2cnitestproblem.hh +++ b/test/freeflow/stokes2cni/stokes2cnitestproblem.hh @@ -157,7 +157,7 @@ public: */ // \{ - //! \copydoc BoxProblem::boundaryTypes() + //! \copydoc ImplicitProblem::boundaryTypes() void boundaryTypes(BoundaryTypes &values, const Vertex &vertex) const { const GlobalPosition globalPos = vertex.geometry().center(); @@ -177,7 +177,7 @@ public: values.setDirichlet(massBalanceIdx); } - //! \copydoc BoxProblem::dirichlet() + //! \copydoc ImplicitProblem::dirichlet() void dirichlet(PrimaryVariables &values, const Vertex &vertex) const { const GlobalPosition globalPos = vertex.geometry().center(); @@ -185,7 +185,7 @@ public: initial_(values, globalPos); } - //! \copydoc BoxProblem::neumann() + //! \copydoc ImplicitProblem::neumann() void neumann(PrimaryVariables &values, const Element &element, const FVElementGeometry &fvGeometry, @@ -203,7 +203,7 @@ public: */ // \{ - //! \copydoc BoxProblem::source() + //! \copydoc ImplicitProblem::source() void source(PrimaryVariables &values, const Element &element, const FVElementGeometry &fvGeometry, @@ -214,7 +214,7 @@ public: values = Scalar(0.0); } - //! \copydoc BoxProblem::initial() + //! \copydoc ImplicitProblem::initial() void initial(PrimaryVariables &values, const Element &element, const FVElementGeometry &fvGeometry, diff --git a/test/implicit/1p/1ptestproblem.hh b/test/implicit/1p/1ptestproblem.hh index 9456d3326bd98f046aca697c5ca420a14565b47f..1ec22776767b502fe97197cc5b79f637a5c4a2fe 100644 --- a/test/implicit/1p/1ptestproblem.hh +++ b/test/implicit/1p/1ptestproblem.hh @@ -36,7 +36,7 @@ #include <dune/grid/io/file/gmshreader.hh> #include <dumux/implicit/1p/1pmodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/material/components/simpleh2o.hh> #include <dumux/material/fluidsystems/liquidphase.hh> @@ -107,9 +107,9 @@ SET_BOOL_PROP(OnePTestProblem, ProblemEnableGravity, true); * and use <tt>1p_3d.dgf</tt> in the parameter file. */ template <class TypeTag> -class OnePTestProblem : public PorousMediaBoxProblem<TypeTag> +class OnePTestProblem : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; diff --git a/test/implicit/1p2c/1p2coutflowproblem.hh b/test/implicit/1p2c/1p2coutflowproblem.hh index 78bf7689cdff45f40131985419b9f00ff98f9f68..6291ed94c48b2abdf5c155c789f781b0f71aa370 100644 --- a/test/implicit/1p2c/1p2coutflowproblem.hh +++ b/test/implicit/1p2c/1p2coutflowproblem.hh @@ -31,7 +31,7 @@ #include <dune/grid/io/file/dgfparser/dgfyasp.hh> #include <dumux/implicit/1p2c/1p2cmodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/material/fluidsystems/h2on2liquidphasefluidsystem.hh> #include "1p2coutflowspatialparams.hh" @@ -108,9 +108,9 @@ SET_BOOL_PROP(OnePTwoCOutflowProblem, ProblemEnableGravity, false); * <tt>./test_1p2c -parameterFile ./test_1p2c.input</tt> */ template <class TypeTag> -class OnePTwoCOutflowProblem : public PorousMediaBoxProblem<TypeTag> +class OnePTwoCOutflowProblem : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; diff --git a/test/implicit/2p/lensproblem.hh b/test/implicit/2p/lensproblem.hh index 78d953f198177a8c714e0d10628dc706903ed228..b9c19b5205b188d2ecb9bb49d4d983ce1d983661 100644 --- a/test/implicit/2p/lensproblem.hh +++ b/test/implicit/2p/lensproblem.hh @@ -36,8 +36,8 @@ #include <dumux/material/components/simpleh2o.hh> #include <dumux/material/components/dnapl.hh> #include <dumux/implicit/2p/2pmodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> -#include <dumux/implicit/cellcentered/porousmediaccproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/implicit/cellcentered/ccpropertydefaults.hh> #include <dumux/material/fluidsystems/h2on2fluidsystem.hh> @@ -115,8 +115,8 @@ SET_SCALAR_PROP(LensProblem, LinearSolverPreconditionerRelaxation, 1.0); SET_BOOL_PROP(LensProblem, ProblemEnableGravity, true); NEW_PROP_TAG(BaseProblem); -SET_TYPE_PROP(LensBoxProblem, BaseProblem, PorousMediaBoxProblem<TypeTag>); -SET_TYPE_PROP(LensCCProblem, BaseProblem, PorousMediaCCProblem<TypeTag>); +SET_TYPE_PROP(LensBoxProblem, BaseProblem, ImplicitPorousMediaProblem<TypeTag>); +SET_TYPE_PROP(LensCCProblem, BaseProblem, ImplicitPorousMediaProblem<TypeTag>); } diff --git a/test/implicit/2p2c/injectionproblem.hh b/test/implicit/2p2c/injectionproblem.hh index 09c4e58a7edf9840fab5219bfc36f7d0be62a977..6faef0455e261febffb53e5e8049cfa25665b9f3 100644 --- a/test/implicit/2p2c/injectionproblem.hh +++ b/test/implicit/2p2c/injectionproblem.hh @@ -27,7 +27,7 @@ #include <dune/grid/io/file/dgfparser/dgfs.hh> #include <dumux/implicit/2p2c/2p2cmodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/material/fluidsystems/h2on2fluidsystem.hh> #include "injectionspatialparams.hh" @@ -89,9 +89,9 @@ SET_BOOL_PROP(InjectionProblem, VtkAddVelocity, false); * <tt>./test_2p2c -parameterFile ./test_2p2c.input</tt> */ template <class TypeTag> -class InjectionProblem : public PorousMediaBoxProblem<TypeTag> +class InjectionProblem : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; diff --git a/test/implicit/2p2cni/waterairproblem.hh b/test/implicit/2p2cni/waterairproblem.hh index 5c2e3fe36e7383ddb83d4d4e6421a39120bc8b67..b88a5141a66dd9f9d546b3cf721840446a57f39b 100644 --- a/test/implicit/2p2cni/waterairproblem.hh +++ b/test/implicit/2p2cni/waterairproblem.hh @@ -32,7 +32,7 @@ #include <dumux/material/fluidsystems/h2on2fluidsystem.hh> #include <dumux/implicit/2p2cni/2p2cnimodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include "waterairspatialparams.hh" @@ -104,13 +104,13 @@ SET_BOOL_PROP(WaterAirProblem, NewtonWriteConvergence, false); * <tt>./test_2p2cni -parameterFile test_2p2cni.input</tt> * */ template <class TypeTag > -class WaterAirProblem : public PorousMediaBoxProblem<TypeTag> +class WaterAirProblem : public ImplicitPorousMediaProblem<TypeTag> { typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GridView::Grid Grid; - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; // copy some indices for convenience typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; diff --git a/test/implicit/2pdfm/2pdfmtestproblem.hh b/test/implicit/2pdfm/2pdfmtestproblem.hh index f62c6ea793c5b6b247530566cf0068039d5fdd4c..4aea1f87249dacd120cf729cac23d433122edd5f 100644 --- a/test/implicit/2pdfm/2pdfmtestproblem.hh +++ b/test/implicit/2pdfm/2pdfmtestproblem.hh @@ -32,7 +32,7 @@ #include <dune/grid/yaspgrid.hh> #include <dumux/implicit/2pdfm/2pdfmmodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/material/components/simpleh2o.hh> #include <dumux/material/components/dnapl.hh> #include <dumux/material/fluidsystems/h2on2fluidsystem.hh> @@ -119,9 +119,9 @@ SET_BOOL_PROP(TwoPDFMTestProblem, ProblemEnableGravity, false); * <tt>./test_2pDFM grids/defaultgrid.net 1e6 1</tt> */ template <class TypeTag > -class TwoPDFMTestProblem : public PorousMediaBoxProblem<TypeTag> +class TwoPDFMTestProblem : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; diff --git a/test/implicit/2pni/injectionproblem2pni.hh b/test/implicit/2pni/injectionproblem2pni.hh index 2a9c7d751cfc9c748bbc92d61b6e95c038442647..d3b4407fbff51fa6785723c276ee278954fea324 100644 --- a/test/implicit/2pni/injectionproblem2pni.hh +++ b/test/implicit/2pni/injectionproblem2pni.hh @@ -35,7 +35,7 @@ #include <dumux/common/cubegridcreator.hh> #include <dumux/implicit/2pni/2pnimodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/material/fluidsystems/h2on2fluidsystem.hh> @@ -143,9 +143,9 @@ SET_BOOL_PROP(InjectionProblem2PNI, NewtonWriteConvergence, true); * <tt>./test_2pni -parameterFile test_2pni.input</tt> */ template<class TypeTag> -class InjectionProblem2PNI : public PorousMediaBoxProblem<TypeTag> +class InjectionProblem2PNI : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; diff --git a/test/implicit/3p3c/infiltrationproblem.hh b/test/implicit/3p3c/infiltrationproblem.hh index 95363ea6988f364541a26ca7f957bbbdb71523e7..3c5736ec1199a8ba8602ea7645a0616451553103 100644 --- a/test/implicit/3p3c/infiltrationproblem.hh +++ b/test/implicit/3p3c/infiltrationproblem.hh @@ -32,7 +32,7 @@ #include <dumux/material/fluidsystems/h2oairmesitylenefluidsystem.hh> #include <dumux/implicit/3p3c/3p3cmodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include "infiltrationspatialparameters.hh" @@ -100,9 +100,9 @@ SET_INT_PROP(InfiltrationProblem, ImplicitNumericDifferenceMethod, 0); * <tt>./test_3p3c -parameterFile test_3p3c.input</tt> * */ template <class TypeTag > -class InfiltrationProblem : public PorousMediaBoxProblem<TypeTag> +class InfiltrationProblem : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; diff --git a/test/implicit/3p3cni/columnxylolproblem.hh b/test/implicit/3p3cni/columnxylolproblem.hh index 0b95dcaeb013bfdbf0d0af77e40dea4748fac405..0bc6e1f9820ffc80c25ff7234a52fea6217f79a2 100644 --- a/test/implicit/3p3cni/columnxylolproblem.hh +++ b/test/implicit/3p3cni/columnxylolproblem.hh @@ -33,7 +33,7 @@ #include <dumux/material/fluidsystems/h2oairxylenefluidsystem.hh> #include <dumux/implicit/3p3cni/3p3cnimodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include "columnxylolspatialparams.hh" @@ -84,13 +84,13 @@ SET_SCALAR_PROP(ColumnProblem, TimeManagerMaxTimeStepSize, 4.); * * */ template <class TypeTag > -class ColumnProblem : public PorousMediaBoxProblem<TypeTag> +class ColumnProblem : public ImplicitPorousMediaProblem<TypeTag> { typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GridView::Grid Grid; - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; // copy some indices for convenience typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; diff --git a/test/implicit/3p3cni/kuevetteproblem.hh b/test/implicit/3p3cni/kuevetteproblem.hh index d5dbd6e6cc74f39e8a52a4d8632676779f499910..f6ead4d8f7f68abc6faa7e83574254076c8ebde3 100644 --- a/test/implicit/3p3cni/kuevetteproblem.hh +++ b/test/implicit/3p3cni/kuevetteproblem.hh @@ -33,7 +33,7 @@ #include <dumux/material/fluidsystems/h2oairmesitylenefluidsystem.hh> #include <dumux/implicit/3p3cni/3p3cnimodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include "kuevettespatialparams.hh" @@ -117,13 +117,13 @@ SET_SCALAR_PROP(KuevetteProblem, NewtonRelTolerance, 1e-6); * <tt>./test_3p3cni -parameterFile test_3p3cni.input</tt> * */ template <class TypeTag > -class KuevetteProblem : public PorousMediaBoxProblem<TypeTag> +class KuevetteProblem : public ImplicitPorousMediaProblem<TypeTag> { typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GridView::Grid Grid; - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; // copy some indices for convenience typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; diff --git a/test/implicit/co2/heterogeneousproblem.hh b/test/implicit/co2/heterogeneousproblem.hh index abaeaf7b5df2c8464634b2360f62dabaf2eb50eb..58d974c1c36e5f5c0152c949b33b5ac8c7278e22 100644 --- a/test/implicit/co2/heterogeneousproblem.hh +++ b/test/implicit/co2/heterogeneousproblem.hh @@ -35,7 +35,7 @@ #include <dumux/implicit/co2/co2model.hh> #include <dumux/implicit/co2/co2volumevariables.hh> #include <dumux/material/fluidsystems/brineco2fluidsystem.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/implicit/box/intersectiontovertexbc.hh> #include "heterogeneousspatialparameters.hh" @@ -121,9 +121,9 @@ SET_BOOL_PROP(HeterogeneousProblem, VtkAddVelocity, false); * <tt>./test_co2 </tt> */ template <class TypeTag = TTAG(HeterogeneousProblem)> -class HeterogeneousProblem : public PorousMediaBoxProblem<TypeTag> +class HeterogeneousProblem : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; diff --git a/test/implicit/co2ni/heterogeneousproblemni.hh b/test/implicit/co2ni/heterogeneousproblemni.hh index 278978c762ee18c78b905143478b4967bfebc339..1886ffae7f304091cb335defd7a530ce4e70129a 100644 --- a/test/implicit/co2ni/heterogeneousproblemni.hh +++ b/test/implicit/co2ni/heterogeneousproblemni.hh @@ -34,7 +34,7 @@ #include <dumux/implicit/co2ni/co2nimodel.hh> #include <dumux/implicit/co2ni/co2nivolumevariables.hh> #include <dumux/material/fluidsystems/brineco2fluidsystem.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/implicit/box/intersectiontovertexbc.hh> @@ -112,9 +112,9 @@ SET_BOOL_PROP(HeterogeneousProblem, VtkAddVelocity, false); * <tt>./test_co2 </tt> */ template <class TypeTag = TTAG(HeterogeneousProblem)> -class HeterogeneousProblem : public PorousMediaBoxProblem<TypeTag> +class HeterogeneousProblem : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; diff --git a/test/implicit/mpnc/forchheimer1pproblem.hh b/test/implicit/mpnc/forchheimer1pproblem.hh index c0aa59f82409d9f819198da7ba67d1809ac36676..6447fbfd5790e04669d102161e63ee3f317ac414 100644 --- a/test/implicit/mpnc/forchheimer1pproblem.hh +++ b/test/implicit/mpnc/forchheimer1pproblem.hh @@ -32,7 +32,7 @@ #include <dune/grid/io/file/dgfparser/dgfyasp.hh> #include <dumux/implicit/mpnc/mpncmodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/material/fluidsystems/h2oairfluidsystem.hh> #include <dumux/material/constraintsolvers/computefromreferencephase.hh> @@ -132,9 +132,9 @@ SET_BOOL_PROP(Forchheimer1pProblem, VtkAddVelocities, true); */ template <class TypeTag> class Forchheimer1pProblem - : public PorousMediaBoxProblem<TypeTag> + : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; diff --git a/test/implicit/mpnc/forchheimer2pproblem.hh b/test/implicit/mpnc/forchheimer2pproblem.hh index 5061431cafd79d2ee95a396ab8c89f5d94967f34..b2a80e120bb62667fc0ec578e5eed66ada194c0f 100644 --- a/test/implicit/mpnc/forchheimer2pproblem.hh +++ b/test/implicit/mpnc/forchheimer2pproblem.hh @@ -32,7 +32,7 @@ #include <dune/grid/io/file/dgfparser/dgfyasp.hh> #include <dumux/implicit/mpnc/mpncmodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/material/fluidsystems/h2on2fluidsystem.hh> #include <dumux/material/constraintsolvers/computefromreferencephase.hh> @@ -125,9 +125,9 @@ SET_BOOL_PROP(Forchheimer2pProblem, VtkAddVelocities, true); */ template <class TypeTag> class Forchheimer2pProblem - : public PorousMediaBoxProblem<TypeTag> + : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; diff --git a/test/implicit/mpnc/obstacleproblem.hh b/test/implicit/mpnc/obstacleproblem.hh index fea036dc24cffa7b34bca29dda3ae318827b3b29..ba8b58ee6582960626d9e4d4d8e363a0c2fd9b69 100644 --- a/test/implicit/mpnc/obstacleproblem.hh +++ b/test/implicit/mpnc/obstacleproblem.hh @@ -32,7 +32,7 @@ #include <dune/grid/io/file/dgfparser/dgfyasp.hh> #include <dumux/implicit/mpnc/mpncmodel.hh> -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> #include <dumux/material/fluidsystems/h2on2fluidsystem.hh> #include <dumux/material/constraintsolvers/computefromreferencephase.hh> @@ -124,9 +124,9 @@ SET_TYPE_PROP(ObstacleProblem, Scalar, double); */ template <class TypeTag> class ObstacleProblem - : public PorousMediaBoxProblem<TypeTag> + : public ImplicitPorousMediaProblem<TypeTag> { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; diff --git a/tutorial/solutions_coupled/ex2_tutorialproblem_coupled.hh b/tutorial/solutions_coupled/ex2_tutorialproblem_coupled.hh index f6297278a0263ec9c6f5ebc1b9fe3b909a713a66..5826acfff54d7f64411e274bc0ad2041a779bf76 100644 --- a/tutorial/solutions_coupled/ex2_tutorialproblem_coupled.hh +++ b/tutorial/solutions_coupled/ex2_tutorialproblem_coupled.hh @@ -28,7 +28,7 @@ #include <dumux/implicit/2p/2pmodel.hh> // The base prous media box problem -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> // The DUNE grid used #include <dune/grid/alugrid.hh> @@ -83,9 +83,9 @@ SET_BOOL_PROP(Ex2TutorialProblemCoupled, EnableGravity, false); /*@\label{tutori * \brief Tutorial problem for a fully coupled twophase box model. */ template <class TypeTag> -class Ex2TutorialProblemCoupled : public PorousMediaBoxProblem<TypeTag> /*@\label{tutorial-coupled:def-problem}@*/ +class Ex2TutorialProblemCoupled : public ImplicitPorousMediaProblem<TypeTag> /*@\label{tutorial-coupled:def-problem}@*/ { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; diff --git a/tutorial/tutorialproblem_coupled.hh b/tutorial/tutorialproblem_coupled.hh index dfba9e91fb1ddf2cc6537ad47483b3e6b1c34219..220b5f2b8ce441a896a8eba9f45b139dfa311bcc 100644 --- a/tutorial/tutorialproblem_coupled.hh +++ b/tutorial/tutorialproblem_coupled.hh @@ -28,7 +28,7 @@ #include <dumux/implicit/2p/2pmodel.hh> // The base prous media box problem -#include <dumux/implicit/box/porousmediaboxproblem.hh> +#include <dumux/implicit/common/implicitporousmediaproblem.hh> // The DUNE grid used #if HAVE_ALUGRID @@ -92,9 +92,9 @@ SET_BOOL_PROP(TutorialProblemCoupled, ProblemEnableGravity, false); /*@\label{tu * \brief Tutorial problem for a fully coupled twophase box model. */ template <class TypeTag> -class TutorialProblemCoupled : public PorousMediaBoxProblem<TypeTag> /*@\label{tutorial-coupled:def-problem}@*/ +class TutorialProblemCoupled : public ImplicitPorousMediaProblem<TypeTag> /*@\label{tutorial-coupled:def-problem}@*/ { - typedef PorousMediaBoxProblem<TypeTag> ParentType; + typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;