From d5cbefc508d29ee00748e6e49478ef1b19445e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de> Date: Wed, 25 Oct 2023 11:44:53 +0200 Subject: [PATCH] [examples][cahn-hilliard] use chrono parser --- examples/cahn_hilliard/doc/main.md | 9 +++++---- examples/cahn_hilliard/main.cc | 9 +++++---- examples/cahn_hilliard/params.input | 6 +++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/examples/cahn_hilliard/doc/main.md b/examples/cahn_hilliard/doc/main.md index 1d42334b80..1f30c44ce2 100644 --- a/examples/cahn_hilliard/doc/main.md +++ b/examples/cahn_hilliard/doc/main.md @@ -44,6 +44,7 @@ We start in `main.cc` with the necessary header includes: #include <dumux/assembly/fvassembler.hh> #include <dune/grid/yaspgrid.hh> +#include <dumux/io/chrono.hh> #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/grid/gridmanager_yasp.hh> @@ -329,16 +330,16 @@ the time step size from the parameter tree (`params.input`) ```cpp auto timeLoop = std::make_shared<CheckPointTimeLoop<Scalar>>( - getParam<Scalar>("TimeLoop.TStart", 0.0), - getParam<Scalar>("TimeLoop.InitialTimeStepSize"), - getParam<Scalar>("TimeLoop.TEnd") + Chrono::toSeconds(getParam("TimeLoop.TStart", "0")), + Chrono::toSeconds(getParam("TimeLoop.InitialTimeStepSize")), + Chrono::toSeconds(getParam("TimeLoop.TEnd")) ); ``` We set the maximum time step size allowed in the adaptive time stepping scheme. ```cpp - timeLoop->setMaxTimeStepSize(getParam<Scalar>("TimeLoop.MaxTimeStepSize")); + timeLoop->setMaxTimeStepSize(Chrono::toSeconds(getParam("TimeLoop.MaxTimeStepSize"))); ``` Next, we choose the type of assembler, linear solver and PDE solver diff --git a/examples/cahn_hilliard/main.cc b/examples/cahn_hilliard/main.cc index 6ddde40f8b..ba61d24284 100644 --- a/examples/cahn_hilliard/main.cc +++ b/examples/cahn_hilliard/main.cc @@ -40,6 +40,7 @@ #include <dumux/assembly/fvassembler.hh> #include <dune/grid/yaspgrid.hh> +#include <dumux/io/chrono.hh> #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/grid/gridmanager_yasp.hh> @@ -266,13 +267,13 @@ int main(int argc, char** argv) // We instantiate time loop using start and end time as well as // the time step size from the parameter tree (`params.input`) auto timeLoop = std::make_shared<CheckPointTimeLoop<Scalar>>( - getParam<Scalar>("TimeLoop.TStart", 0.0), - getParam<Scalar>("TimeLoop.InitialTimeStepSize"), - getParam<Scalar>("TimeLoop.TEnd") + Chrono::toSeconds(getParam("TimeLoop.TStart", "0")), + Chrono::toSeconds(getParam("TimeLoop.InitialTimeStepSize")), + Chrono::toSeconds(getParam("TimeLoop.TEnd")) ); // We set the maximum time step size allowed in the adaptive time stepping scheme. - timeLoop->setMaxTimeStepSize(getParam<Scalar>("TimeLoop.MaxTimeStepSize")); + timeLoop->setMaxTimeStepSize(Chrono::toSeconds(getParam("TimeLoop.MaxTimeStepSize"))); // Next, we choose the type of assembler, linear solver and PDE solver // and construct instances of these classes. diff --git a/examples/cahn_hilliard/params.input b/examples/cahn_hilliard/params.input index f9d41a960d..05a95c190d 100644 --- a/examples/cahn_hilliard/params.input +++ b/examples/cahn_hilliard/params.input @@ -1,7 +1,7 @@ [TimeLoop] -TEnd = 1.0 -InitialTimeStepSize = 0.0025 -MaxTimeStepSize = 0.01 +TEnd = 1.0s +InitialTimeStepSize = 2.5ms +MaxTimeStepSize = 10ms [Grid] LowerLeft = 0 0 -- GitLab