Commit 9a62b359 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[1p] port compressible test and dependencies to new type tag structure

parent 0ac85377
......@@ -24,6 +24,7 @@
#define DUMUX_FV_PROBLEM_HH
#include <dune/common/version.hh>
#include <dune/grid/common/gridenums.hh>
#include <dumux/parallel/vertexhandles.hh>
......
......@@ -20,16 +20,16 @@
* \ingroup Properties
* \file
*
* \brief Collects a list of all used properties
* \brief Collects a list of properties used by the core of Dumux.
*/
namespace Dumux
{
namespace Properties
{
/////////////////////////////////////////////
///////////////////////////////////////
// Basic properties of numeric models:
/////////////////////////////////////////////
///////////////////////////////////////
NEW_PROP_TAG(Scalar); //! Property to specify the type of scalar values.
NEW_PROP_TAG(ModelParameterGroup); //! Property which defines the group that is queried for parameters by default
NEW_PROP_TAG(ModelDefaultParameters); //! Property which defines the group that is queried for parameters by default
......@@ -62,40 +62,40 @@ NEW_PROP_TAG(LocalResidual);
/////////////////////////////////////////////
// Properties used by finite volume schemes:
/////////////////////////////////////////////
NEW_PROP_TAG(ElementBoundaryTypes); //! Stores the boundary types on an element
NEW_PROP_TAG(ElementSolutionVector); //! A vector of primary variables within an element
NEW_PROP_TAG(AssemblyMap); //! Connectivity map (transposed) used for assembling the Jacobian matrix entries
NEW_PROP_TAG(ElementBoundaryTypes); //! Stores the boundary types on an element
NEW_PROP_TAG(ElementSolutionVector); //! A vector of primary variables within an element
NEW_PROP_TAG(AssemblyMap); //! Connectivity map (transposed) used for assembling the Jacobian matrix entries
NEW_PROP_TAG(SubControlVolume); //! The type of the sub control volume
NEW_PROP_TAG(SubControlVolumeFace); //! The type of the sub control volume face
NEW_PROP_TAG(FVElementGeometry); //! The type of the local finite volume geometry (iterators over scvs, scvfs)
NEW_PROP_TAG(FVGridGeometry); //! The type of the global finite volume geometry
NEW_PROP_TAG(EnableFVGridGeometryCache); //! specifies if geometric data is saved (faster, but more memory consuming)
NEW_PROP_TAG(SubControlVolume); //! The type of the sub control volume
NEW_PROP_TAG(SubControlVolumeFace); //! The type of the sub control volume face
NEW_PROP_TAG(FVElementGeometry); //! The type of the local finite volume geometry (iterators over scvs, scvfs)
NEW_PROP_TAG(FVGridGeometry); //! The type of the global finite volume geometry
NEW_PROP_TAG(EnableFVGridGeometryCache); //! specifies if geometric data is saved (faster, but more memory consuming)
NEW_PROP_TAG(VolumeVariables); //! The secondary variables within a sub-control volume
NEW_PROP_TAG(ElementVolumeVariables); //! The type for a local (element/stencil) container for the volume variables
NEW_PROP_TAG(GlobalVolumeVariables); //! The type for a global container for the volume variables
NEW_PROP_TAG(EnableGlobalVolumeVariablesCache); //! If disabled, the volume variables are not stored (reduces memory, but is slower)
NEW_PROP_TAG(FluxVariables); //! Container storing the different types of flux variables
NEW_PROP_TAG(FluxVariablesCache); //! Stores data associated with flux vars
NEW_PROP_TAG(ElementFluxVariablesCache); //! A local vector of flux variable caches per element
NEW_PROP_TAG(GlobalFluxVariablesCache); //! The global vector of flux variable containers
NEW_PROP_TAG(EnableGlobalFluxVariablesCache); //! specifies if data on flux vars should be saved (faster, but more memory consuming)
NEW_PROP_TAG(GridVariables); //! The grid variables object managing variable data on the grid (volvars/fluxvars cache)
NEW_PROP_TAG(VolumeVariables); //! The secondary variables within a sub-control volume
NEW_PROP_TAG(ElementVolumeVariables); //! The type for a local (element/stencil) container for the volume variables
NEW_PROP_TAG(GlobalVolumeVariables); //! The type for a global container for the volume variables
NEW_PROP_TAG(EnableGlobalVolumeVariablesCache); //! If disabled, the volume variables are not stored (reduces memory, but is slower)
NEW_PROP_TAG(FluxVariables); //! Container storing the different types of flux variables
NEW_PROP_TAG(FluxVariablesCache); //! Stores data associated with flux vars
NEW_PROP_TAG(ElementFluxVariablesCache); //! A local vector of flux variable caches per element
NEW_PROP_TAG(GlobalFluxVariablesCache); //! The global vector of flux variable containers
NEW_PROP_TAG(EnableGlobalFluxVariablesCache); //! specifies if data on flux vars should be saved (faster, but more memory consuming)
NEW_PROP_TAG(GridVariables); //! The grid variables object managing variable data on the grid (volvars/fluxvars cache)
////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Additional properties used by the cell-centered mpfa schemes:
/////////////////////////////////////////////////////////////////////////////////////////////////////////
NEW_PROP_TAG(MpfaMethod); //! Specifies the mpfa method to be used
NEW_PROP_TAG(MpfaHelper); //! A Helper class depending on the mpfa method and grid dimension
NEW_PROP_TAG(PrimaryInteractionVolume); //! The primary interaction volume type
NEW_PROP_TAG(SecondaryInteractionVolume); //! The secondary interaction volume type used e.g. on the boundaries
/////////////////////////////////////////////////////////////////
NEW_PROP_TAG(MpfaMethod); //! Specifies the mpfa method to be used
NEW_PROP_TAG(MpfaHelper); //! A Helper class depending on the mpfa method and grid dimension
NEW_PROP_TAG(PrimaryInteractionVolume); //! The primary interaction volume type
NEW_PROP_TAG(SecondaryInteractionVolume); //! The secondary interaction volume type used e.g. on the boundaries
////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
// Properties used by models involving flow in porous media:
////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
NEW_PROP_TAG(EnergyLocalResidual); //! The local residual of the energy equation
NEW_PROP_TAG(EnableAdvection); //! specifies if advection is considered in the model
NEW_PROP_TAG(AdvectionType); //! The type for the calculation the advective fluxes
......
......@@ -24,6 +24,8 @@
#define DUMUX_DISCRETIZATION_BASE_FV_GRID_GEOMETRY_HH
#include <dune/common/version.hh>
#include <dune/grid/common/mcmgmapper.hh>
#include <dumux/common/boundingboxtree.hh>
namespace Dumux
......
......@@ -23,6 +23,8 @@
#ifndef DUMUX_DISCRETIZATION_BOX_ELEMENT_VOLUMEVARIABLES_HH
#define DUMUX_DISCRETIZATION_BOX_ELEMENT_VOLUMEVARIABLES_HH
#include <dumux/discretization/methods.hh>
namespace Dumux
{
......@@ -50,7 +52,7 @@ class BoxElementVolumeVariables<TypeTag,/*enableGlobalVolVarCache*/true>
static const int dim = GridView::dimension;
using Element = typename GridView::template Codim<0>::Entity;
enum{ isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) };
static constexpr bool isBox = GET_PROP_VALUE(TypeTag, DiscretizationMethod) == DiscretizationMethods::Box;
public:
//! Constructor
......
......@@ -37,16 +37,9 @@
#include <dune/grid/io/file/vtk/function.hh>
#include <dune/grid/io/file/vtk/vtkwriter.hh>
#include <dune/grid/io/file/vtk/vtksequencewriter.hh>
#include <dumux/implicit/properties.hh>
#include <dumux/io/vtknestedfunction.hh>
namespace Properties
{
NEW_PROP_TAG(VtkAddVelocity);
NEW_PROP_TAG(VtkAddProcessRank);
NEW_PROP_TAG(FluidSystem);
NEW_PROP_TAG(NumPhases);
}
#include <dumux/discretization/methods.hh>
#include <dumux/io/vtknestedfunction.hh>
namespace Dumux
{
......@@ -204,7 +197,6 @@ class VtkOutputModule
using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
using ElementMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper);
using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper);
using Implementation = typename GET_PROP_TYPE(TypeTag, VtkOutputModule);
using VelocityOutput = typename GET_PROP_TYPE(TypeTag, VelocityOutput);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables);
......@@ -218,7 +210,7 @@ class VtkOutputModule
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
static constexpr int numPhases = GET_PROP_VALUE(TypeTag, NumPhases);
static constexpr bool isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox);
static constexpr bool isBox = GET_PROP_VALUE(TypeTag, DiscretizationMethod) == DiscretizationMethods::Box;
static constexpr int dofCodim = isBox ? dim : 0;
struct VolVarScalarDataInfo { std::function<Scalar(const VolumeVariables&)> get; std::string name; };
......@@ -316,7 +308,7 @@ public:
|| addProcessRank)
{
const auto numCells = gridGeom_.gridView().size(0);
const auto numDofs = asImp_().numDofs_();
const auto numDofs = numDofs_();
// get fields for all volume variables
if (!volVarScalarDataInfo_.empty())
......@@ -473,14 +465,6 @@ private:
return sol_[dofIdxGlobal][pvIdx];
}
//! Returns the implementation of the output module (i.e. static polymorphism)
Implementation &asImp_()
{ return *static_cast<Implementation *>(this); }
//! \copydoc asImp_()
const Implementation &asImp_() const
{ return *static_cast<const Implementation *>(this); }
const Problem& problem_;
const FVGridGeometry& gridGeom_;
const GridVariables& gridVariables_;
......
......@@ -49,7 +49,6 @@ template <class TypeTag>
class NewtonController
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Implementation = typename GET_PROP_TYPE(TypeTag, NewtonController);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Communicator = typename GridView::CollectiveCommunication;
using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
......@@ -137,11 +136,11 @@ public:
* \param uCurrentIter The solution of the current Newton iteration
*/
template<class SolutionVector>
bool newtonProceed(const SolutionVector &uCurrentIter)
bool newtonProceed(const SolutionVector &uCurrentIter, bool converged)
{
if (numSteps_ < 2)
return true; // we always do at least two iterations
else if (asImp_().newtonConverged()) {
else if (converged) {
return false; // we are below the desired tolerance
}
else if (numSteps_ >= maxSteps_) {
......@@ -510,15 +509,6 @@ public:
protected:
// returns the actual implementation for the controller we do
// it this way in order to allow "poor man's virtual methods",
// i.e. methods of subclasses which can be called by the base
// class.
Implementation &asImp_()
{ return *static_cast<Implementation*>(this); }
const Implementation &asImp_() const
{ return *static_cast<const Implementation*>(this); }
void initParams_()
{
const std::string group = GET_PROP_VALUE(TypeTag, ModelParameterGroup);
......
......@@ -100,7 +100,7 @@ public:
// execute the method as long as the controller thinks
// that we should do another iteration
while (controller_->newtonProceed(uCurrentIter))
while (controller_->newtonProceed(uCurrentIter, controller_->newtonConverged()))
{
// notify the controller that we're about to start
// a new timestep
......
......@@ -41,7 +41,6 @@ class PriVarSwitchNewtonController : public NewtonController<TypeTag>
{
using ParentType = NewtonController<TypeTag>;
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Implementation = typename GET_PROP_TYPE(TypeTag, NewtonController);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Communicator = typename GridView::CollectiveCommunication;
using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
......
......@@ -58,7 +58,7 @@ class ImplicitVelocityOutput
static const int dim = GridView::dimension;
static const int dimWorld = GridView::dimensionworld;
static const bool isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox);
static const bool isBox = GET_PROP_VALUE(TypeTag, DiscretizationMethod) == DiscretizationMethods::Box;
static const int dofCodim = isBox ? dim : 0;
using Vertex = typename GridView::template Codim<dim>::Entity;
......@@ -111,7 +111,7 @@ public:
* Specialization for the box method.
*/
template<class T = TypeTag>
typename std::enable_if<GET_PROP_VALUE(T, ImplicitIsBox), ElementSolutionVector>::type
typename std::enable_if<GET_PROP_VALUE(T, DiscretizationMethod) == DiscretizationMethods::Box, ElementSolutionVector>::type
elementSolution(const Element& element, const SolutionVector& sol) const
{
auto numVert = element.subEntities(dofCodim);
......@@ -126,7 +126,7 @@ public:
* Specialization for cell-centered methods.
*/
template<class T = TypeTag>
typename std::enable_if<!GET_PROP_VALUE(T, ImplicitIsBox), ElementSolutionVector>::type
typename std::enable_if<GET_PROP_VALUE(T, DiscretizationMethod) != DiscretizationMethods::Box, ElementSolutionVector>::type
elementSolution(const Element& element, const SolutionVector& sol) const
{ return ElementSolutionVector({ sol[fvGridGeometry_.elementMapper().index(element)] }); }
......@@ -145,13 +145,13 @@ public:
// following lines, that call will only be compiled if cell-centered
// actually is used.
template <class T = TypeTag>
typename std::enable_if<!GET_PROP_VALUE(T, ImplicitIsBox), BoundaryTypes>::type
typename std::enable_if<GET_PROP_VALUE(T, DiscretizationMethod) != DiscretizationMethods::Box, BoundaryTypes>::type
problemBoundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const
{ return problem_.boundaryTypes(element, scvf); }
//! we should never call this method for box models
template <class T = TypeTag>
typename std::enable_if<GET_PROP_VALUE(T, ImplicitIsBox), BoundaryTypes>::type
typename std::enable_if<GET_PROP_VALUE(T, DiscretizationMethod) == DiscretizationMethods::Box, BoundaryTypes>::type
problemBoundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const
{ return BoundaryTypes(); }
......
......@@ -26,6 +26,8 @@
#ifndef DUMUX_POROUSMEDIUM_FLOW_PROPERTIES_HH
#define DUMUX_POROUSMEDIUM_FLOW_PROPERTIES_HH
#include <dumux/io/vtkoutputmodule.hh>
#include <dumux/porousmediumflow/implicit/fluxvariables.hh>
#include <dumux/porousmediumflow/implicit/fluxvariablescache.hh>
#include <dumux/porousmediumflow/nonisothermal/implicit/localresidual.hh>
......
......@@ -23,13 +23,15 @@
#ifndef DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH
#define DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/components/h2o.hh>
#include <dumux/material/components/tabulatedcomponent.hh>
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/implicit/cellcentered/tpfa/properties.hh>
#include <dumux/implicit/cellcentered/mpfa/properties.hh>
#include <dumux/implicit/box/properties.hh>
#include <dumux/discretization/cellcentered/tpfa/properties.hh>
#include <dumux/discretization/cellcentered/mpfa/properties.hh>
#include <dumux/discretization/box/properties.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/porousmediumflow/1p/implicit/model.hh>
#include "spatialparams.hh"
......
......@@ -34,6 +34,8 @@
#include <dune/grid/io/file/vtk.hh>
#include <dune/istl/io.hh>
#include <dumux/discretization/methods.hh>
#include <dumux/common/propertysystem.hh>
#include <dumux/common/parameters.hh>
#include <dumux/common/valgrind.hh>
......@@ -41,8 +43,8 @@
#include <dumux/common/defaultusagemessage.hh>
#include <dumux/common/parameterparser.hh>
#include <dumux/linear/seqsolverbackend.hh>
#include <dumux/nonlinear/newtoncontroller.hh>
#include <dumux/linear/seqsolverbackend.hh>
#include <dumux/nonlinear/newtonmethod.hh>
#include <dumux/assembly/fvassembler.hh>
......@@ -94,7 +96,7 @@ int main(int argc, char** argv) try
auto problem = std::make_shared<Problem>(fvGridGeometry);
// the solution vector
static constexpr bool isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox);
static constexpr bool isBox = GET_PROP_VALUE(TypeTag, DiscretizationMethod) == DiscretizationMethods::Box;
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
static constexpr int dofCodim = isBox ? GridView::dimension : 0;
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
......@@ -133,7 +135,7 @@ int main(int argc, char** argv) try
auto linearSolver = std::make_shared<LinearSolver>();
// the non-linear solver
using NewtonController = Dumux::NewtonController<TypeTag>;
using NewtonController = NewtonController<TypeTag>;
auto newtonController = std::make_shared<NewtonController>(leafGridView.comm(), timeLoop);
NewtonMethod<TypeTag, NewtonController, Assembler, LinearSolver> nonLinearSolver(newtonController, assembler, linearSolver);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment