diff --git a/dumux/common/parameters.hh b/dumux/common/parameters.hh index 597e724d4f14487048ccc7f10671e61403e5b0c0..5f952529e7fa972a941d8dd6f966c02e9bd4e954 100644 --- a/dumux/common/parameters.hh +++ b/dumux/common/parameters.hh @@ -75,7 +75,7 @@ * \endcode */ #define GET_PARAM_FROM_GROUP(TypeTag, ParamType, GroupName, ParamName) \ - ::Dumux::template getParam_UsingDeprecatedMacro<ParamType>(std::string(#GroupName) + "." + std::string(#ParamName)) + ::Dumux::template getParam_UsingDeprecatedMacro<ParamType>(std::string(#GroupName) + "." + std::string(#ParamName), ParamType(GET_PROP_VALUE(TypeTag, GroupName##ParamName))) /*! diff --git a/dumux/common/start.hh b/dumux/common/start.hh index 9d70e83f9e4c8246f4f85555761e810f224fbd37..82b8b82d2a6ec29bcb56fd4677a82e5fcf532c45 100644 --- a/dumux/common/start.hh +++ b/dumux/common/start.hh @@ -29,7 +29,7 @@ #include <dune/common/parallel/mpihelper.hh> #include <dune/grid/io/file/dgfparser/dgfexception.hh> -#include <dumux/common/propertysystem.hh> +#include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> #include <dumux/common/valgrind.hh> #include <dumux/common/dumuxmessage.hh> @@ -41,9 +41,6 @@ namespace Dumux // forward declaration of property tags namespace Properties { -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(GridCreator); -NEW_PROP_TAG(Problem); NEW_PROP_TAG(TimeManager); } @@ -69,7 +66,6 @@ int start_(int argc, using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager); - using ParameterTree = typename GET_PROP(TypeTag, ParameterTree); // initialize MPI, finalize is done automatically on exit const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); @@ -82,43 +78,13 @@ int start_(int argc, // parse the command line arguments and input file //////////////////////////////////////////////////////////// - // if the user just wanted to see the help / usage message show usage and stop program - if(!ParameterParser::parseCommandLineArguments(argc, argv, ParameterTree::tree(), usage)) - { - usage(argv[0], defaultUsageMessage(argv[0])); - return 0; - } - // parse the input file into the parameter tree - // check first if the user provided an input file through the command line, if not use the default - const auto parameterFileName = ParameterTree::tree().hasKey("ParameterFile") ? GET_RUNTIME_PARAM(TypeTag, std::string, ParameterFile) : ""; - ParameterParser::parseInputFile(argc, argv, ParameterTree::tree(), parameterFileName, usage); - - //////////////////////////////////////////////////////////// - // check for some user debugging parameters - //////////////////////////////////////////////////////////// - - bool printProps = false; // per default don't print all properties - if (ParameterTree::tree().hasKey("PrintProperties") || ParameterTree::tree().hasKey("TimeManager.PrintProperties")) - printProps = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, bool, TimeManager, PrintProperties); - - if (printProps && mpiHelper.rank() == 0) - Properties::print<TypeTag>(); - - bool printParams = true; // per default print all properties - if (ParameterTree::tree().hasKey("PrintParameters") || ParameterTree::tree().hasKey("TimeManager.PrintParameters")) - printParams = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, bool, TimeManager, PrintParameters); + Dumux::Parameters::init(argc, argv, usage); ////////////////////////////////////////////////////////////////////// // try to create a grid (from the given grid file or the input file) ///////////////////////////////////////////////////////////////////// - try { GridCreator::makeGrid(); } - catch (...) { - std::string usageMessage = "\n\t -> Creation of the grid failed! <- \n\n"; - usageMessage += defaultUsageMessage(argv[0]); - usage(argv[0], usageMessage); - throw; - } + GridCreator::makeGrid(); GridCreator::loadBalance(); ////////////////////////////////////////////////////////////////////// @@ -126,16 +92,16 @@ int start_(int argc, ///////////////////////////////////////////////////////////////////// // read the initial time step and the end time (mandatory parameters) - auto tEnd = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, TimeManager, TEnd); - auto dt = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, TimeManager, DtInitial); + auto tEnd = getParam<Scalar>("TimeManager.TEnd"); + auto dt = getParam<Scalar>("TimeManager.DtInitial"); // check if we are about to restart a previously interrupted simulation bool restart = false; Scalar restartTime = 0; - if (ParameterTree::tree().hasKey("Restart") || ParameterTree::tree().hasKey("TimeManager.Restart")) + if (haveParam("Restart") || haveParam("TimeManager.Restart")) { restart = true; - restartTime = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, TimeManager, Restart); + restartTime = getParam<Scalar>("TimeManager.Restart"); } // instantiate and run the problem @@ -146,13 +112,8 @@ int start_(int argc, // print dumux end message and maybe the parameters for debugging if (mpiHelper.rank() == 0) - { DumuxMessage::print(/*firstCall=*/false); - if (printParams) - Parameters::print<TypeTag>(); - } - return 0; } @@ -176,7 +137,6 @@ int start(int argc, return start_<TypeTag>(argc, argv, usage); } catch (ParameterException &e) { - Parameters::print<TypeTag>(); std::cerr << std::endl << e << ". Abort!" << std::endl; return 1; } diff --git a/dumux/porousmediumflow/sequential/cellcentered/pressure.hh b/dumux/porousmediumflow/sequential/cellcentered/pressure.hh index 83a8652b4648eb8ecc56d2fb95286d07f37a0025..2f32930ad46d09f3e999520db023bea07282085e 100644 --- a/dumux/porousmediumflow/sequential/cellcentered/pressure.hh +++ b/dumux/porousmediumflow/sequential/cellcentered/pressure.hh @@ -502,7 +502,7 @@ void FVPressure<TypeTag>::solve() { typedef typename GET_PROP_TYPE(TypeTag, LinearSolver) Solver; - int verboseLevelSolver = GET_PARAM_FROM_GROUP(TypeTag, int, LinearSolver, Verbosity); + int verboseLevelSolver = getParam<int>("LinearSolver, Verbosity", 0); if (verboseLevelSolver) std::cout << __FILE__ << ": solve for pressure" << std::endl; @@ -521,7 +521,7 @@ void FVPressure<TypeTag>::solve() // printmatrix(std::cout, A_, "global stiffness matrix", "row", 11, 3); // printvector(std::cout, f_, "right hand side", "row", 10, 1, 3); - Solver solver(problem_); + Solver solver; solver.solve(A_, pressure_, f_); // printvector(std::cout, pressure_, "pressure", "row", 200, 1, 3); diff --git a/dumux/porousmediumflow/sequential/impetproblem.hh b/dumux/porousmediumflow/sequential/impetproblem.hh index 4fbb9b6c3aba4cccfecd0762ad8775d45f4d9524..3a4273039fcec1fca4ffdbf8a39a2e193456f1b0 100644 --- a/dumux/porousmediumflow/sequential/impetproblem.hh +++ b/dumux/porousmediumflow/sequential/impetproblem.hh @@ -132,9 +132,9 @@ public: if (adaptiveGrid) gridAdapt_ = std::make_shared<GridAdaptModel>(asImp_()); - vtkOutputLevel_ = GET_PARAM_FROM_GROUP(TypeTag, int, Vtk, OutputLevel); + vtkOutputLevel_ = getParam<int>("Vtk.OutputLevel", 0); dtVariationRestrictionFactor_ = GET_PARAM_FROM_GROUP(TypeTag, Scalar, Impet, DtVariationRestrictionFactor); - maxTimeStepSize_ = GET_PARAM_FROM_GROUP(TypeTag, Scalar, TimeManager, MaxTimeStepSize); + maxTimeStepSize_ = getParam<Scalar>("TimeManager.MaxTimeStepSize", std::numeric_limits<Scalar>::max()); } /*! diff --git a/dumux/porousmediumflow/sequential/properties.hh b/dumux/porousmediumflow/sequential/properties.hh index 205cdaf30ca53f7efdb8d417a84743490939ce7c..cb193e77c8541027fe867a792fabfdaa06e04f9d 100644 --- a/dumux/porousmediumflow/sequential/properties.hh +++ b/dumux/porousmediumflow/sequential/properties.hh @@ -57,6 +57,11 @@ NEW_PROP_TAG( SolutionTypes); NEW_PROP_TAG( PrimaryVariables); NEW_PROP_TAG( Indices); +// Some properties that have been removed from numeric model +NEW_PROP_TAG( Model ); //!< The type of the mode +NEW_PROP_TAG( TimeManager ); //!< The type of the time manager +NEW_PROP_TAG( DiscretizationMethod ); //!< The type of discretization method + NEW_PROP_TAG( PressureModel ); //!< The type of the discretization of a pressure model NEW_PROP_TAG( TransportModel ); //!< The type of the discretization of a transport model NEW_PROP_TAG( Velocity ); //!< The type velocity reconstruction @@ -77,6 +82,7 @@ NEW_PROP_TAG( MaxIntersections ); //!< Gives maximum number of intersections of #include <dumux/common/timemanager.hh> #include <dumux/common/boundarytypes.hh> #include<dumux/common/boundaryconditions.hh> +#include<dumux/discretization/methods.hh> namespace Dumux { @@ -90,6 +96,11 @@ namespace Properties // Properties ////////////////////////////////////////////////////////////////// +SET_PROP(SequentialModel, DiscretizationMethod) +{ + static const DiscretizationMethods value = DiscretizationMethods::CCTpfa; +}; + //! Use the leaf grid view if not defined otherwise SET_PROP(SequentialModel, GridView) {