From 8deb4e77b9f0d120408dab0b72a28f2e33f917ab Mon Sep 17 00:00:00 2001 From: Ned Coltman <edward.coltman@iws.uni-stuttgart.de> Date: Thu, 30 Mar 2023 18:55:36 +0200 Subject: [PATCH] [exercises][ff-pm] Replace "Stokes" and "Darcy" with "Freeflow" and "PorousMedium" names --- exercises/exercise-coupling-ff-pm/README.md | 28 ++-- .../interface/freeflowsubproblem.hh | 6 +- .../exercise-coupling-ff-pm/interface/main.cc | 134 ++++++++-------- .../interface/params.input | 12 +- .../interface/porousmediumsubproblem.hh | 6 +- .../interface/properties.hh | 32 ++-- .../models/freeflowsubproblem.hh | 6 +- .../exercise-coupling-ff-pm/models/main.cc | 145 +++++++++--------- .../models/params.input | 12 +- .../models/porousmediumsubproblem.hh | 6 +- .../models/properties.hh | 42 ++--- .../turbulence/freeflowsubproblem.hh | 2 +- .../turbulence/main.cc | 139 ++++++++--------- .../turbulence/params.input | 12 +- .../turbulence/porousmediumsubproblem.hh | 6 +- .../turbulence/properties.hh | 44 +++--- .../interface/freeflowsubproblem.hh | 33 ++-- .../exercise-coupling-ff-pm/interface/main.cc | 131 ++++++++-------- .../interface/params.input | 12 +- .../interface/porousmediumsubproblem.hh | 29 ++-- .../interface/properties.hh | 32 ++-- .../models/freeflowsubproblem.hh | 64 ++++---- .../exercise-coupling-ff-pm/models/main.cc | 136 ++++++++-------- .../models/params.input | 8 +- .../models/porousmediumsubproblem.hh | 24 ++- .../models/properties.hh | 48 +++--- .../turbulence/freeflowsubproblem.hh | 30 ++-- .../turbulence/main.cc | 144 ++++++++--------- .../turbulence/params.input | 12 +- .../turbulence/porousmediumsubproblem.hh | 8 +- .../turbulence/properties.hh | 44 +++--- 31 files changed, 678 insertions(+), 709 deletions(-) diff --git a/exercises/exercise-coupling-ff-pm/README.md b/exercises/exercise-coupling-ff-pm/README.md index bfe67f02..0823903a 100644 --- a/exercises/exercise-coupling-ff-pm/README.md +++ b/exercises/exercise-coupling-ff-pm/README.md @@ -22,7 +22,7 @@ The problem-related files for this exercise are: * The __input files__: `interface/params.input`, `models/parmas.input`, `turbulence/params.input`, * The __spatial parameters files__: `1pspatialparams.hh`, `2pspatialparams.hh` -In the main file, `TypeTags` for both submodels are defined. +In the main file, `TypeTags` for both submodels are defined, `FreeflowTypeTag` and `PorousMediumTypeTag`. These `TypeTags` collect all of the properties associated with each subproblem. The same applies for types such as `GridManager`, `FVGridGeometry`, `Problem`, etc... Since we use a monolithic coupling scheme, there is only one `Assembler` and one `NewtonSolver`. @@ -41,7 +41,7 @@ cell center variables (all other variables), therefore in some cases either the or the `stokesFaceIdx` is used respectively, while for the porous medium all variables can be accessed with `darcyIdx`. __Task__: -Take a closer look at the Stokes/Darcy coupling files before moving to the next part of the exercise: +Take a closer look at the listed files before moving to the next part of the exercise: ### 1. Changing the interface @@ -139,7 +139,7 @@ at the position where the coupling boundary conditions are set in `interface/fre To check if the simulation behaves as expected, we can compare the velocity profile $`v_x(y)`$ with the analytical solution provided by [Beavers and Joseph (1967)](https://doi.org/10.1017/S0022112067001375). For doing so, we uncomment the following line in `main.cc` in the subfolder `interface`. ```cpp -stokesVtkWriter.addField(stokesProblem->getAnalyticalVelocityX(), "analyticalV_x"); +freeflowVtkWriter.addField(freeflowProblem->getAnalyticalVelocityX(), "analyticalV_x"); ``` After re-compiling and re-running the executable, we should be able to see also @@ -150,13 +150,13 @@ __Task C: Change the shape of interface__ Now we want to include a non-flat interface between the two domains. We use `dune-subgrid` to construct two grids for the two domains from one common host grid. To do so, open `main.cc` in the subfolder `interface` again and search for `TODO: dumux-course-task 1.C`. Comment out the first code block and uncomment the second. This will instantiate a host grid and define two helper lambda functions that are used to choose elements from to host grid for the respective sub grid. In the given case, the domain is split in two haves, separated by a sinusoidal interface. ```cpp -auto elementSelectorStokes = [&](const auto& element) +auto elementSelectorFreeflow = [&](const auto& element) { double interface = params.amplitude * std::sin(( element.geometry().center()[0] -params.offset) / params.scaling * 2.0 * M_PI) + params.baseline; return element.geometry().center()[1] > interface; }; -auto elementSelectorDarcy = [&](const auto& element) +auto elementSelectorPorousMedium = [&](const auto& element) { double interface = params.amplitude * std::sin(( element.geometry().center()[0] - params.offset) / params.scaling * 2.0 * M_PI) + params.baseline; return element.geometry().center()[1] < interface; @@ -230,7 +230,7 @@ liquid saturation as primary variables (p_g-S_l -> `p1s0`) or vice versa. ``` template<class TypeTag> -struct Formulation<TypeTag, TTag::DarcyOnePNC> +struct Formulation<TypeTag, TTag::PorousMediumOnePNC> { static constexpr auto value = TwoPFormulation::p1s0; }; ``` in the properties file. @@ -328,7 +328,7 @@ and in problem file: The includes for the NavierStokesNC model and the NavierStokesProblem are no longer needed and can be removed. Make sure your free flow problem inherits from the correct parent type: -* Change the entry in the `StokesZeroEq` definition accordingly (non-isothermal zero equation model, ZeroEqNCNI) in the properties file, +* Change the entry in the `FreeflowModel` definition accordingly (non-isothermal zero equation model, ZeroEqNCNI) in the properties file, * Adapt the inheritance of the problem class in problem file. Take a look into the two headers included above to see how the correct TypeTag and the Problem class the inherit from are called. @@ -346,7 +346,7 @@ In addition, especially for the zero-equation models, any element in the free-fl e.g. this defines the wall distance which is needed to calculate the eddy viscosity. To get all these interactions, you have to call ```cpp - stokesProblem->updateStaticWallProperties(); + freeflowProblem->updateStaticWallProperties(); ``` in `main.cc`. However, there is also a solution-dependent component of these interactions, e.g. for a correct @@ -354,7 +354,7 @@ damping of the eddy viscosity toward the wall, the velocity gradient at the wall cells is needed. These dynamic interactions are to be updated by calling ```cpp -stokesProblem->updateDynamicWallProperties(stokesSol); +freeflowProblem->updateDynamicWallProperties(freeflowSol); ``` in the time loop (after `// Update dynamic wall properties`). @@ -393,11 +393,11 @@ __Task D__: For the grid convergence study, run various simulations with the following grading parameters: ```c++ -* [Stokes.Grid] Grading1 = 1.2, [Darcy.Grid] Grading1 = -1.2 -* [Stokes.Grid] Grading1 = 1.3, [Darcy.Grid] Grading1 = -1.3 -* [Stokes.Grid] Grading1 = 1.4, [Darcy.Grid] Grading1 = -1.4 -* [Stokes.Grid] Grading1 = 1.5, [Darcy.Grid] Grading1 = -1.5 -* [Stokes.Grid] Grading1 = 1.6, [Darcy.Grid] Grading1 = -1.6 +* [Freeflow.Grid] Grading1 = 1.2, [PorousMedium.Grid] Grading1 = -1.2 +* [Freeflow.Grid] Grading1 = 1.3, [PorousMedium.Grid] Grading1 = -1.3 +* [Freeflow.Grid] Grading1 = 1.4, [PorousMedium.Grid] Grading1 = -1.4 +* [Freeflow.Grid] Grading1 = 1.5, [PorousMedium.Grid] Grading1 = -1.5 +* [Freeflow.Grid] Grading1 = 1.6, [PorousMedium.Grid] Grading1 = -1.6 ``` By changing the parameter `Problem.Name` for each grading factor, you avoid losing the `.vtu` and `.pvd` files of the previous simulation runs. diff --git a/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh index 3de81a16..0f7d590f 100644 --- a/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh @@ -20,8 +20,8 @@ * \file * \brief The free flow sub problem */ -#ifndef DUMUX_STOKES_SUBPROBLEM_HH -#define DUMUX_STOKES_SUBPROBLEM_HH +#ifndef DUMUX_FREEFLOW_SUBPROBLEM_HH +#define DUMUX_FREEFLOW_SUBPROBLEM_HH #include <dumux/freeflow/navierstokes/staggered/problem.hh> #include <dumux/freeflow/navierstokes/boundarytypes.hh> @@ -62,7 +62,7 @@ class FreeFlowSubProblem : public NavierStokesStaggeredProblem<TypeTag> public: FreeFlowSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, std::shared_ptr<CouplingManager> couplingManager) - : ParentType(fvGridGeometry, "Stokes"), + : ParentType(fvGridGeometry, "Freeflow"), eps_(1e-6), couplingManager_(couplingManager) { diff --git a/exercises/exercise-coupling-ff-pm/interface/main.cc b/exercises/exercise-coupling-ff-pm/interface/main.cc index 5cba8d6b..c7cce2fd 100644 --- a/exercises/exercise-coupling-ff-pm/interface/main.cc +++ b/exercises/exercise-coupling-ff-pm/interface/main.cc @@ -61,25 +61,25 @@ int main(int argc, char** argv) Parameters::init(argc, argv); // Define the sub problem type tags - using StokesTypeTag = Properties::TTag::StokesOneP; - using DarcyTypeTag = Properties::TTag::DarcyOneP; + using FreeflowTypeTag = Properties::TTag::FreeflowOneP; + using PorousMediumTypeTag = Properties::TTag::PorousMediumFlowOneP; //TODO: dumux-course-task 1.C // ******************** comment-out this section for the last exercise **************** // // create two individual grids (from the given grid file or the input file) // for both sub-domains - using DarcyGridManager = Dumux::GridManager<GetPropType<DarcyTypeTag, Properties::Grid>>; - DarcyGridManager darcyGridManager; - darcyGridManager.init("Darcy"); // pass parameter group + using PorousMediumGridManager = Dumux::GridManager<GetPropType<PorousMediumTypeTag, Properties::Grid>>; + PorousMediumGridManager porousMediumGridManager; + porousMediumGridManager.init("PorousMedium"); // pass parameter group - using StokesGridManager = Dumux::GridManager<GetPropType<StokesTypeTag, Properties::Grid>>; - StokesGridManager stokesGridManager; - stokesGridManager.init("Stokes"); // pass parameter group + using FreeflowGridManager = Dumux::GridManager<GetPropType<FreeflowTypeTag, Properties::Grid>>; + FreeflowGridManager freeflowGridManager; + freeflowGridManager.init("Freeflow"); // pass parameter group // we compute on the leaf grid view - const auto& darcyGridView = darcyGridManager.grid().leafGridView(); - const auto& stokesGridView = stokesGridManager.grid().leafGridView(); + const auto& porousMediumGridView = porousMediumGridManager.grid().leafGridView(); + const auto& freeflowGridView = freeflowGridManager.grid().leafGridView(); // ************************************************************************************ // @@ -104,13 +104,13 @@ int main(int argc, char** argv) // // Params params; // -// auto elementSelectorStokes = [&](const auto& element) +// auto elementSelectorFreeflow = [&](const auto& element) // { // double interface = params.amplitude * std::sin(( element.geometry().center()[0] -params.offset) / params.scaling * 2.0 * M_PI) + params.baseline; // return element.geometry().center()[1] > interface; // }; // -// auto elementSelectorDarcy = [&](const auto& element) +// auto elementSelectorPorousMedium = [&](const auto& element) // { // double interface = params.amplitude * std::sin(( element.geometry().center()[0] - params.offset) / params.scaling * 2.0 * M_PI) + params.baseline; // return element.geometry().center()[1] < interface; @@ -118,92 +118,96 @@ int main(int argc, char** argv) // // using SubGrid = Dune::SubGrid<dim, HostGrid>; // -// Dumux::GridManager<SubGrid> subGridManagerStokes; -// Dumux::GridManager<SubGrid> subGridManagerDarcy; +// Dumux::GridManager<SubGrid> subGridManagerFreeflow; +// Dumux::GridManager<SubGrid> subGridManagerPorousMedium; // // // initialize subgrids -// subGridManagerStokes.init(hostGrid, elementSelectorStokes, "Stokes"); -// subGridManagerDarcy.init(hostGrid, elementSelectorDarcy, "Darcy"); +// subGridManagerFreeflow.init(hostGrid, elementSelectorFreeflow, "Freeflow"); +// subGridManagerPorousMedium.init(hostGrid, elementSelectorPorousMedium, "PorousMedium"); // // // we compute on the leaf grid view -// const auto& darcyGridView = subGridManagerDarcy.grid().leafGridView(); -// const auto& stokesGridView = subGridManagerStokes.grid().leafGridView(); +// const auto& porousMediumGridView = subGridManagerPorousMedium.grid().leafGridView(); +// const auto& freeflowGridView = subGridManagerFreeflow.grid().leafGridView(); // ************************************************************************************ // // create the finite volume grid geometry - using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; - auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; - auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); + using FreeflowFVGridGeometry = GetPropType<FreeflowTypeTag, Properties::GridGeometry>; + auto freeflowFvGridGeometry = std::make_shared<FreeflowFVGridGeometry>(freeflowGridView); + using PorousMediumFVGridGeometry = GetPropType<PorousMediumTypeTag, Properties::GridGeometry>; + auto porousMediumFvGridGeometry = std::make_shared<PorousMediumFVGridGeometry>(porousMediumGridView); - using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; + using Traits = StaggeredMultiDomainTraits<FreeflowTypeTag, FreeflowTypeTag, PorousMediumTypeTag>; // the coupling manager using CouplingManager = StokesDarcyCouplingManager<Traits>; - auto couplingManager = std::make_shared<CouplingManager>(stokesFvGridGeometry, darcyFvGridGeometry); + auto couplingManager = std::make_shared<CouplingManager>(freeflowFvGridGeometry, porousMediumFvGridGeometry); // the indices - constexpr auto stokesCellCenterIdx = CouplingManager::stokesCellCenterIdx; - constexpr auto stokesFaceIdx = CouplingManager::stokesFaceIdx; - constexpr auto darcyIdx = CouplingManager::darcyIdx; + constexpr auto freeflowCellCenterIdx = CouplingManager::stokesCellCenterIdx; + constexpr auto freeflowFaceIdx = CouplingManager::stokesFaceIdx; + constexpr auto porousMediumIdx = CouplingManager::darcyIdx; // the problem (initial and boundary conditions) - using StokesProblem = GetPropType<StokesTypeTag, Properties::Problem>; - auto stokesProblem = std::make_shared<StokesProblem>(stokesFvGridGeometry, couplingManager); - using DarcyProblem = GetPropType<DarcyTypeTag, Properties::Problem>; - auto darcyProblem = std::make_shared<DarcyProblem>(darcyFvGridGeometry, couplingManager); + using FreeflowProblem = GetPropType<FreeflowTypeTag, Properties::Problem>; + auto freeflowProblem = std::make_shared<FreeflowProblem>(freeflowFvGridGeometry, couplingManager); + using PorousMediumProblem = GetPropType<PorousMediumTypeTag, Properties::Problem>; + auto porousMediumProblem = std::make_shared<PorousMediumProblem>(porousMediumFvGridGeometry, couplingManager); // the solution vector Traits::SolutionVector sol; - sol[stokesCellCenterIdx].resize(stokesFvGridGeometry->numCellCenterDofs()); - sol[stokesFaceIdx].resize(stokesFvGridGeometry->numFaceDofs()); - sol[darcyIdx].resize(darcyFvGridGeometry->numDofs()); + sol[freeflowCellCenterIdx].resize(freeflowFvGridGeometry->numCellCenterDofs()); + sol[freeflowFaceIdx].resize(freeflowFvGridGeometry->numFaceDofs()); + sol[porousMediumIdx].resize(porousMediumFvGridGeometry->numDofs()); - auto stokesSol = partial(sol, stokesFaceIdx, stokesCellCenterIdx); + auto freeflowSol = partial(sol, freeflowFaceIdx, freeflowCellCenterIdx); - stokesProblem->applyInitialSolution(stokesSol); - darcyProblem->applyInitialSolution(sol[darcyIdx]); + freeflowProblem->applyInitialSolution(freeflowSol); + porousMediumProblem->applyInitialSolution(sol[porousMediumIdx]); - couplingManager->init(stokesProblem, darcyProblem, sol); + couplingManager->init(freeflowProblem, porousMediumProblem, sol); // the grid variables - using StokesGridVariables = GetPropType<StokesTypeTag, Properties::GridVariables>; - auto stokesGridVariables = std::make_shared<StokesGridVariables>(stokesProblem, stokesFvGridGeometry); - stokesGridVariables->init(stokesSol); - using DarcyGridVariables = GetPropType<DarcyTypeTag, Properties::GridVariables>; - auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); - darcyGridVariables->init(sol[darcyIdx]); + using FreeflowGridVariables = GetPropType<FreeflowTypeTag, Properties::GridVariables>; + auto freeflowGridVariables = std::make_shared<FreeflowGridVariables>(freeflowProblem, freeflowFvGridGeometry); + freeflowGridVariables->init(freeflowSol); + using PorousMediumGridVariables = GetPropType<PorousMediumTypeTag, Properties::GridVariables>; + auto porousMediumGridVariables = std::make_shared<PorousMediumGridVariables>(porousMediumProblem, porousMediumFvGridGeometry); + porousMediumGridVariables->init(sol[porousMediumIdx]); - // initialize the vtk output module - const auto stokesName = getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); - const auto darcyName = getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); + // intialize the vtk output module + const auto freeflowName = getParam<std::string>("Problem.Name") + "_" + freeflowProblem->name(); + const auto porousMediumName = getParam<std::string>("Problem.Name") + "_" + porousMediumProblem->name(); - StaggeredVtkOutputModule<StokesGridVariables, decltype(stokesSol)> stokesVtkWriter(*stokesGridVariables, stokesSol, stokesName); - GetPropType<StokesTypeTag, Properties::IOFields>::initOutputModule(stokesVtkWriter); + + StaggeredVtkOutputModule<FreeflowGridVariables, decltype(freeflowSol)> freeflowVtkWriter(*freeflowGridVariables, freeflowSol, freeflowName); + GetPropType<FreeflowTypeTag, Properties::IOFields>::initOutputModule(freeflowVtkWriter); //TODO: dumux-course-task 1.B //****** uncomment the add analytical solution of v_x *****// - // stokesVtkWriter.addField(stokesProblem->getAnalyticalVelocityX(), "analyticalV_x"); + // freeflowVtkWriter.addField(freeflowProblem->getAnalyticalVelocityX(), "analyticalV_x"); + freeflowVtkWriter.write(0.0); - stokesVtkWriter.write(0.0); + using PorousMediumSolutionVector = GetPropType<PorousMediumTypeTag, Properties::SolutionVector>; + VtkOutputModule<PorousMediumGridVariables, PorousMediumSolutionVector> porousMediumVtkWriter(*porousMediumGridVariables, + sol[porousMediumIdx], + porousMediumName); - VtkOutputModule<DarcyGridVariables, GetPropType<DarcyTypeTag, Properties::SolutionVector>> darcyVtkWriter(*darcyGridVariables, sol[darcyIdx], darcyName); - using DarcyVelocityOutput = GetPropType<DarcyTypeTag, Properties::VelocityOutput>; - darcyVtkWriter.addVelocityOutput(std::make_shared<DarcyVelocityOutput>(*darcyGridVariables)); - GetPropType<DarcyTypeTag, Properties::IOFields>::initOutputModule(darcyVtkWriter); - darcyVtkWriter.write(0.0); + using PorousMediumVelocityOutput = GetPropType<PorousMediumTypeTag, Properties::VelocityOutput>; + porousMediumVtkWriter.addVelocityOutput(std::make_shared<PorousMediumVelocityOutput>(*porousMediumGridVariables)); + GetPropType<PorousMediumTypeTag, Properties::IOFields>::initOutputModule(porousMediumVtkWriter); + porousMediumVtkWriter.write(0.0); // the assembler for a stationary problem using Assembler = MultiDomainFVAssembler<Traits, CouplingManager, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(std::make_tuple(stokesProblem, stokesProblem, darcyProblem), - std::make_tuple(stokesFvGridGeometry->faceFVGridGeometryPtr(), - stokesFvGridGeometry->cellCenterFVGridGeometryPtr(), - darcyFvGridGeometry), - std::make_tuple(stokesGridVariables->faceGridVariablesPtr(), - stokesGridVariables->cellCenterGridVariablesPtr(), - darcyGridVariables), + auto assembler = std::make_shared<Assembler>(std::make_tuple(freeflowProblem, freeflowProblem, porousMediumProblem), + std::make_tuple(freeflowFvGridGeometry->faceFVGridGeometryPtr(), + freeflowFvGridGeometry->cellCenterFVGridGeometryPtr(), + porousMediumFvGridGeometry), + std::make_tuple(freeflowGridVariables->faceGridVariablesPtr(), + freeflowGridVariables->cellCenterGridVariablesPtr(), + porousMediumGridVariables), couplingManager); // the linear solver @@ -218,8 +222,8 @@ int main(int argc, char** argv) nonLinearSolver.solve(sol); // write vtk output - stokesVtkWriter.write(1.0); - darcyVtkWriter.write(1.0); + freeflowVtkWriter.write(1.0); + porousMediumVtkWriter.write(1.0); Parameters::print(); diff --git a/exercises/exercise-coupling-ff-pm/interface/params.input b/exercises/exercise-coupling-ff-pm/interface/params.input index 669bae28..eab4c116 100644 --- a/exercises/exercise-coupling-ff-pm/interface/params.input +++ b/exercises/exercise-coupling-ff-pm/interface/params.input @@ -9,7 +9,7 @@ Amplitude = 0.04 # [m] Offset = 0.5 # [m] Scaling = 0.2 #[m] -[Stokes.Grid] +[Freeflow.Grid] Verbosity = true Positions0 = 0.0 1.0 Positions1 = 1.0 2.0 @@ -17,7 +17,7 @@ Cells0 = 20 Cells1 = 100 Grading1 = 1 -[Darcy.Grid] +[PorousMedium.Grid] Verbosity = true Positions0 = 0.0 1.0 Positions1 = 0.0 1.0 @@ -25,13 +25,13 @@ Cells0 = 20 Cells1 = 20 Grading1 = 1 -[Stokes.Problem] -Name = stokes +[Freeflow.Problem] +Name = freeflow PressureDifference = 1e-9 EnableInertiaTerms = false -[Darcy.Problem] -Name = darcy +[PorousMedium.Problem] +Name = porousmedium [SpatialParams] Permeability = 1e-6 # m^2 diff --git a/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh index dca93c17..68967766 100644 --- a/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh @@ -21,8 +21,8 @@ * * \brief The porous medium flow sub problem */ -#ifndef DUMUX_DARCY_SUBPROBLEM_HH -#define DUMUX_DARCY_SUBPROBLEM_HH +#ifndef DUMUX_POROUSMEDIUMFLOW_SUBPROBLEM_HH +#define DUMUX_POROUSMEDIUMFLOW_SUBPROBLEM_HH #include <dumux/porousmediumflow/problem.hh> #include <dumux/common/properties.hh> @@ -61,7 +61,7 @@ class PorousMediumSubProblem : public PorousMediumFlowProblem<TypeTag> public: PorousMediumSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, std::shared_ptr<CouplingManager> couplingManager) - : ParentType(fvGridGeometry, "Darcy"), + : ParentType(fvGridGeometry, "PorousMedium"), eps_(1e-7), couplingManager_(couplingManager) {} diff --git a/exercises/exercise-coupling-ff-pm/interface/properties.hh b/exercises/exercise-coupling-ff-pm/interface/properties.hh index b1b82bbd..3f5d388d 100644 --- a/exercises/exercise-coupling-ff-pm/interface/properties.hh +++ b/exercises/exercise-coupling-ff-pm/interface/properties.hh @@ -52,39 +52,39 @@ namespace Dumux::Properties { // Create new type tags namespace TTag { -struct DarcyOneP { using InheritsFrom = std::tuple<OneP, CCTpfaModel>; }; -struct StokesOneP { using InheritsFrom = std::tuple<NavierStokes, StaggeredFreeFlowModel>; }; +struct FreeflowOneP { using InheritsFrom = std::tuple<NavierStokes, StaggeredFreeFlowModel>; }; +struct PorousMediumFlowOneP { using InheritsFrom = std::tuple<OneP, CCTpfaModel>; }; } // end namespace TTag // Set the coupling manager template<class TypeTag> -struct CouplingManager<TypeTag, TTag::StokesOneP> +struct CouplingManager<TypeTag, TTag::FreeflowOneP> { - using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::DarcyOneP>; + using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::PorousMediumFlowOneP>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; template<class TypeTag> -struct CouplingManager<TypeTag, TTag::DarcyOneP> +struct CouplingManager<TypeTag, TTag::PorousMediumFlowOneP> { - using Traits = StaggeredMultiDomainTraits<Properties::TTag::StokesOneP, Properties::TTag::StokesOneP, TypeTag>; + using Traits = StaggeredMultiDomainTraits<Properties::TTag::FreeflowOneP, Properties::TTag::FreeflowOneP, TypeTag>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; // Set the problem property template<class TypeTag> -struct Problem<TypeTag, TTag::DarcyOneP> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; +struct Problem<TypeTag, TTag::PorousMediumFlowOneP> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; template<class TypeTag> -struct Problem<TypeTag, TTag::StokesOneP> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; +struct Problem<TypeTag, TTag::FreeflowOneP> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; // the fluid system template<class TypeTag> -struct FluidSystem<TypeTag, TTag::DarcyOneP> +struct FluidSystem<TypeTag, TTag::PorousMediumFlowOneP> { using Scalar = GetPropType<TypeTag, Properties::Scalar>; using type = FluidSystems::OnePLiquid<Scalar, Dumux::Components::SimpleH2O<Scalar> > ; }; template<class TypeTag> -struct FluidSystem<TypeTag, TTag::StokesOneP> +struct FluidSystem<TypeTag, TTag::FreeflowOneP> { using Scalar = GetPropType<TypeTag, Properties::Scalar>; using type = FluidSystems::OnePLiquid<Scalar, Dumux::Components::SimpleH2O<Scalar> > ; @@ -92,7 +92,7 @@ struct FluidSystem<TypeTag, TTag::StokesOneP> // Set the grid type template<class TypeTag> -struct Grid<TypeTag, TTag::DarcyOneP> +struct Grid<TypeTag, TTag::PorousMediumFlowOneP> { static constexpr auto dim = 2; using Scalar = GetPropType<TypeTag, Properties::Scalar>; @@ -107,7 +107,7 @@ struct Grid<TypeTag, TTag::DarcyOneP> // using type = Dune::SubGrid<dim, HostGrid>; }; template<class TypeTag> -struct Grid<TypeTag, TTag::StokesOneP> +struct Grid<TypeTag, TTag::FreeflowOneP> { static constexpr auto dim = 2; using Scalar = GetPropType<TypeTag, Properties::Scalar>; @@ -123,16 +123,16 @@ struct Grid<TypeTag, TTag::StokesOneP> }; template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyOneP> { +struct SpatialParams<TypeTag, TTag::PorousMediumFlowOneP> { using type = OnePSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; }; template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; +struct EnableGridGeometryCache<TypeTag, TTag::FreeflowOneP> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; +struct EnableGridFluxVariablesCache<TypeTag, TTag::FreeflowOneP> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; +struct EnableGridVolumeVariablesCache<TypeTag, TTag::FreeflowOneP> { static constexpr bool value = true; }; } //end namespace Dumux::Properties diff --git a/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh index b53c16a0..227e276a 100644 --- a/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh @@ -21,8 +21,8 @@ * \ingroup NavierStokesTests * \brief A simple Stokes test problem for the staggered grid (Navier-)Stokes model. */ -#ifndef DUMUX_STOKES1P2C_SUBPROBLEM_HH -#define DUMUX_STOKES1P2C_SUBPROBLEM_HH +#ifndef DUMUX_FREEFLOW1P2C_SUBPROBLEM_HH +#define DUMUX_FREEFLOW1P2C_SUBPROBLEM_HH #include <dumux/common/properties.hh> #include <dumux/common/boundarytypes.hh> @@ -71,7 +71,7 @@ class FreeFlowSubProblem : public NavierStokesStaggeredProblem<TypeTag> public: FreeFlowSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, std::shared_ptr<CouplingManager> couplingManager) - : ParentType(fvGridGeometry, "Stokes"), + : ParentType(fvGridGeometry, "Freeflow"), eps_(1e-6), couplingManager_(couplingManager) { diff --git a/exercises/exercise-coupling-ff-pm/models/main.cc b/exercises/exercise-coupling-ff-pm/models/main.cc index 2fe38c8e..f8b7045a 100644 --- a/exercises/exercise-coupling-ff-pm/models/main.cc +++ b/exercises/exercise-coupling-ff-pm/models/main.cc @@ -19,7 +19,7 @@ /*! * \file * - * \brief A test problem for the coupled Stokes/Darcy problem (1p) + * \brief A test problem for the coupled Freeflow/PorousMedium problem (1p) */ #include <config.h> @@ -61,51 +61,51 @@ int main(int argc, char** argv) Parameters::init(argc, argv); // Define the sub problem type tags - using StokesTypeTag = Properties::TTag::StokesNC; - using DarcyTypeTag = Properties::TTag::DarcyOnePNC; + using FreeflowTypeTag = Properties::TTag::FreeflowNC; + using PorousMediumTypeTag = Properties::TTag::PorousMediumOnePNC; // try to create a grid (from the given grid file or the input file) // for both sub-domains - using DarcyGridManager = Dumux::GridManager<GetPropType<DarcyTypeTag, Properties::Grid>>; - DarcyGridManager darcyGridManager; - darcyGridManager.init("Darcy"); // pass parameter group + using PorousMediumGridManager = Dumux::GridManager<GetPropType<PorousMediumTypeTag, Properties::Grid>>; + PorousMediumGridManager porousMediumGridManager; + porousMediumGridManager.init("PorousMedium"); // pass parameter group - using StokesGridManager = Dumux::GridManager<GetPropType<StokesTypeTag, Properties::Grid>>; - StokesGridManager stokesGridManager; - stokesGridManager.init("Stokes"); // pass parameter group + using FreeflowGridManager = Dumux::GridManager<GetPropType<FreeflowTypeTag, Properties::Grid>>; + FreeflowGridManager freeflowGridManager; + freeflowGridManager.init("Freeflow"); // pass parameter group // we compute on the leaf grid view - const auto& darcyGridView = darcyGridManager.grid().leafGridView(); - const auto& stokesGridView = stokesGridManager.grid().leafGridView(); + const auto& porousMediumGridView = porousMediumGridManager.grid().leafGridView(); + const auto& freeflowGridView = freeflowGridManager.grid().leafGridView(); // create the finite volume grid geometry - using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; - auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; - auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); + using FreeflowFVGridGeometry = GetPropType<FreeflowTypeTag, Properties::GridGeometry>; + auto freeflowFvGridGeometry = std::make_shared<FreeflowFVGridGeometry>(freeflowGridView); + using PorousMediumFVGridGeometry = GetPropType<PorousMediumTypeTag, Properties::GridGeometry>; + auto porousMediumFvGridGeometry = std::make_shared<PorousMediumFVGridGeometry>(porousMediumGridView); - using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; + using Traits = StaggeredMultiDomainTraits<FreeflowTypeTag, FreeflowTypeTag, PorousMediumTypeTag>; // the coupling manager using CouplingManager = StokesDarcyCouplingManager<Traits>; - auto couplingManager = std::make_shared<CouplingManager>(stokesFvGridGeometry, darcyFvGridGeometry); + auto couplingManager = std::make_shared<CouplingManager>(freeflowFvGridGeometry, porousMediumFvGridGeometry); // the indices - constexpr auto stokesCellCenterIdx = CouplingManager::stokesCellCenterIdx; - constexpr auto stokesFaceIdx = CouplingManager::stokesFaceIdx; - constexpr auto darcyIdx = CouplingManager::darcyIdx; + constexpr auto freeflowCellCenterIdx = CouplingManager::stokesCellCenterIdx; + constexpr auto freeflowFaceIdx = CouplingManager::stokesFaceIdx; + constexpr auto porousMediumIdx = CouplingManager::darcyIdx; // the problem (initial and boundary conditions) - using StokesProblem = GetPropType<StokesTypeTag, Properties::Problem>; - auto stokesProblem = std::make_shared<StokesProblem>(stokesFvGridGeometry, couplingManager); - using DarcyProblem = GetPropType<DarcyTypeTag, Properties::Problem>; - auto darcyProblem = std::make_shared<DarcyProblem>(darcyFvGridGeometry, couplingManager); + using FreeflowProblem = GetPropType<FreeflowTypeTag, Properties::Problem>; + auto freeflowProblem = std::make_shared<FreeflowProblem>(freeflowFvGridGeometry, couplingManager); + using PorousMediumProblem = GetPropType<PorousMediumTypeTag, Properties::Problem>; + auto porousMediumProblem = std::make_shared<PorousMediumProblem>(porousMediumFvGridGeometry, couplingManager); // initialize the fluidsystem (tabulation) - GetPropType<StokesTypeTag, Properties::FluidSystem>::init(); + GetPropType<FreeflowTypeTag, Properties::FluidSystem>::init(); // get some time loop parameters - using Scalar = GetPropType<StokesTypeTag, Properties::Scalar>; + using Scalar = GetPropType<FreeflowTypeTag, Properties::Scalar>; const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); @@ -113,58 +113,59 @@ int main(int argc, char** argv) // instantiate time loop auto timeLoop = std::make_shared<CheckPointTimeLoop<Scalar>>(0, dt, tEnd); timeLoop->setMaxTimeStepSize(maxDt); - stokesProblem->setTimeLoop(timeLoop); - darcyProblem->setTimeLoop(timeLoop); + freeflowProblem->setTimeLoop(timeLoop); + porousMediumProblem->setTimeLoop(timeLoop); // the solution vector Traits::SolutionVector sol; - sol[stokesCellCenterIdx].resize(stokesFvGridGeometry->numCellCenterDofs()); - sol[stokesFaceIdx].resize(stokesFvGridGeometry->numFaceDofs()); - sol[darcyIdx].resize(darcyFvGridGeometry->numDofs()); + sol[freeflowCellCenterIdx].resize(freeflowFvGridGeometry->numCellCenterDofs()); + sol[freeflowFaceIdx].resize(freeflowFvGridGeometry->numFaceDofs()); + sol[porousMediumIdx].resize(porousMediumFvGridGeometry->numDofs()); - auto stokesSol = partial(sol, stokesFaceIdx, stokesCellCenterIdx); + auto freeflowSol = partial(sol, freeflowFaceIdx, freeflowCellCenterIdx); - stokesProblem->applyInitialSolution(stokesSol); - darcyProblem->applyInitialSolution(sol[darcyIdx]); + freeflowProblem->applyInitialSolution(freeflowSol); + porousMediumProblem->applyInitialSolution(sol[porousMediumIdx]); auto solOld = sol; - couplingManager->init(stokesProblem, darcyProblem, sol); + couplingManager->init(freeflowProblem, porousMediumProblem, sol); // the grid variables - using StokesGridVariables = GetPropType<StokesTypeTag, Properties::GridVariables>; - auto stokesGridVariables = std::make_shared<StokesGridVariables>(stokesProblem, stokesFvGridGeometry); - stokesGridVariables->init(stokesSol); - using DarcyGridVariables = GetPropType<DarcyTypeTag, Properties::GridVariables>; - auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); - darcyGridVariables->init(sol[darcyIdx]); - - // initialize the vtk output module - const auto stokesName = getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); - const auto darcyName = getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); - - StaggeredVtkOutputModule<StokesGridVariables, decltype(stokesSol)> stokesVtkWriter(*stokesGridVariables, stokesSol, stokesName); - GetPropType<StokesTypeTag, Properties::IOFields>::initOutputModule(stokesVtkWriter); - stokesVtkWriter.write(0.0); - - VtkOutputModule<DarcyGridVariables, GetPropType<DarcyTypeTag, Properties::SolutionVector>> darcyVtkWriter(*darcyGridVariables, sol[darcyIdx], darcyName); - using DarcyVelocityOutput = GetPropType<DarcyTypeTag, Properties::VelocityOutput>; - darcyVtkWriter.addVelocityOutput(std::make_shared<DarcyVelocityOutput>(*darcyGridVariables)); - GetPropType<DarcyTypeTag, Properties::IOFields>::initOutputModule(darcyVtkWriter); - darcyVtkWriter.write(0.0); - - // initialize the subproblems - darcyProblem->init(sol[darcyIdx], *darcyGridVariables); + using FreeflowGridVariables = GetPropType<FreeflowTypeTag, Properties::GridVariables>; + auto freeflowGridVariables = std::make_shared<FreeflowGridVariables>(freeflowProblem, freeflowFvGridGeometry); + freeflowGridVariables->init(freeflowSol); + using PorousMediumGridVariables = GetPropType<PorousMediumTypeTag, Properties::GridVariables>; + auto porousMediumGridVariables = std::make_shared<PorousMediumGridVariables>(porousMediumProblem, porousMediumFvGridGeometry); + porousMediumGridVariables->init(sol[porousMediumIdx]); + + // intialize the vtk output module + const auto freeflowName = getParam<std::string>("Problem.Name") + "_" + freeflowProblem->name(); + const auto porousMediumName = getParam<std::string>("Problem.Name") + "_" + porousMediumProblem->name(); + + StaggeredVtkOutputModule<FreeflowGridVariables, decltype(freeflowSol)> freeflowVtkWriter(*freeflowGridVariables, freeflowSol, freeflowName); + GetPropType<FreeflowTypeTag, Properties::IOFields>::initOutputModule(freeflowVtkWriter); + freeflowVtkWriter.write(0.0); + + VtkOutputModule<PorousMediumGridVariables, GetPropType<PorousMediumTypeTag, Properties::SolutionVector>> porousMediumVtkWriter(*porousMediumGridVariables, + sol[porousMediumIdx], porousMediumName); + using PorousMediumVelocityOutput = GetPropType<PorousMediumTypeTag, Properties::VelocityOutput>; + porousMediumVtkWriter.addVelocityOutput(std::make_shared<PorousMediumVelocityOutput>(*porousMediumGridVariables)); + GetPropType<PorousMediumTypeTag, Properties::IOFields>::initOutputModule(porousMediumVtkWriter); + porousMediumVtkWriter.write(0.0); + + // intialize the subproblems + porousMediumProblem->init(sol[porousMediumIdx], *porousMediumGridVariables); // the assembler with time loop for instationary problem using Assembler = MultiDomainFVAssembler<Traits, CouplingManager, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(std::make_tuple(stokesProblem, stokesProblem, darcyProblem), - std::make_tuple(stokesFvGridGeometry->faceFVGridGeometryPtr(), - stokesFvGridGeometry->cellCenterFVGridGeometryPtr(), - darcyFvGridGeometry), - std::make_tuple(stokesGridVariables->faceGridVariablesPtr(), - stokesGridVariables->cellCenterGridVariablesPtr(), - darcyGridVariables), + auto assembler = std::make_shared<Assembler>(std::make_tuple(freeflowProblem, freeflowProblem, porousMediumProblem), + std::make_tuple(freeflowFvGridGeometry->faceFVGridGeometryPtr(), + freeflowFvGridGeometry->cellCenterFVGridGeometryPtr(), + porousMediumFvGridGeometry), + std::make_tuple(freeflowGridVariables->faceGridVariablesPtr(), + freeflowGridVariables->cellCenterGridVariablesPtr(), + porousMediumGridVariables), couplingManager, timeLoop, solOld); @@ -186,20 +187,20 @@ int main(int argc, char** argv) // make the new solution the old solution solOld = sol; - stokesGridVariables->advanceTimeStep(); - darcyGridVariables->advanceTimeStep(); + freeflowGridVariables->advanceTimeStep(); + porousMediumGridVariables->advanceTimeStep(); // advance to the time loop to the next step timeLoop->advanceTimeStep(); // call the postTimeStep routine for output - darcyProblem->postTimeStep(sol[darcyIdx], *darcyGridVariables); + porousMediumProblem->postTimeStep(sol[porousMediumIdx], *porousMediumGridVariables); // write vtk output if (timeLoop->isCheckPoint() || timeLoop->finished() || episodeLength < 0.0) { - stokesVtkWriter.write(timeLoop->time()); - darcyVtkWriter.write(timeLoop->time()); + freeflowVtkWriter.write(timeLoop->time()); + porousMediumVtkWriter.write(timeLoop->time()); } // report statistics of this time step @@ -210,8 +211,8 @@ int main(int argc, char** argv) } while (!timeLoop->finished()); - timeLoop->finalize(stokesGridView.comm()); - timeLoop->finalize(darcyGridView.comm()); + timeLoop->finalize(freeflowGridView.comm()); + timeLoop->finalize(porousMediumGridView.comm()); Parameters::print(); diff --git a/exercises/exercise-coupling-ff-pm/models/params.input b/exercises/exercise-coupling-ff-pm/models/params.input index 152a908f..99413f34 100644 --- a/exercises/exercise-coupling-ff-pm/models/params.input +++ b/exercises/exercise-coupling-ff-pm/models/params.input @@ -3,25 +3,25 @@ DtInitial = 1 # s EpisodeLength = -360 # s # 0.25 days TEnd = 256000 # s # 2 days -[Stokes.Grid] +[Freeflow.Grid] LowerLeft = 0 1 UpperRight = 1 2 Cells = 16 16 -[Darcy.Grid] +[PorousMedium.Grid] UpperRight = 1 1 Cells = 16 16 -[Stokes.Problem] -Name = stokes +[Freeflow.Problem] +Name = freeflow EnableGravity = true EnableInertiaTerms = true MoleFraction = 0.0 # - Pressure = 1e5 # Pa Velocity = 1 # m/s -[Darcy.Problem] -Name = darcy +[PorousMedium.Problem] +Name = porousmedium EnableGravity = true Saturation = 0.1 # - MoleFraction = 0.1 # - diff --git a/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh index 911b0246..75eef1e1 100644 --- a/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh @@ -77,7 +77,7 @@ class PorousMediumSubProblem : public PorousMediumFlowProblem<TypeTag> public: PorousMediumSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, std::shared_ptr<CouplingManager> couplingManager) - : ParentType(fvGridGeometry, "Darcy"), + : ParentType(fvGridGeometry, "PorousMedium"), eps_(1e-7), couplingManager_(couplingManager) { @@ -287,14 +287,14 @@ public: */ PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const { - static const Scalar stokesPressure = getParamFromGroup<Scalar>("Stokes", "Problem.Pressure"); + static const Scalar freeflowPressure = getParamFromGroup<Scalar>("Freeflow", "Problem.Pressure"); PrimaryVariables values(0.0); // TODO: dumux-course-task 2.A // Declare here which phases are present. - values[Indices::pressureIdx] = stokesPressure; + values[Indices::pressureIdx] = freeflowPressure; values[transportCompIdx] = moleFraction_; return values; } diff --git a/exercises/exercise-coupling-ff-pm/models/properties.hh b/exercises/exercise-coupling-ff-pm/models/properties.hh index 72b63dab..d3313c73 100644 --- a/exercises/exercise-coupling-ff-pm/models/properties.hh +++ b/exercises/exercise-coupling-ff-pm/models/properties.hh @@ -57,39 +57,39 @@ namespace Dumux::Properties { namespace TTag { // TODO: dumux-course-task 2.A // Change to property of the `FluidSystem` such that `H2OAir` is used directly. -struct DarcyOnePNC { using InheritsFrom = std::tuple<OnePNC, CCTpfaModel>; }; -struct StokesNC { using InheritsFrom = std::tuple<NavierStokesNC, StaggeredFreeFlowModel>; }; +struct PorousMediumOnePNC { using InheritsFrom = std::tuple<OnePNC, CCTpfaModel>; }; +struct FreeflowNC { using InheritsFrom = std::tuple<NavierStokesNC, StaggeredFreeFlowModel>; }; } // end namespace TTag // Set the coupling manager template<class TypeTag> -struct CouplingManager<TypeTag, TTag::StokesNC> +struct CouplingManager<TypeTag, TTag::FreeflowNC> { - using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::DarcyOnePNC>; + using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::PorousMediumOnePNC>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; template<class TypeTag> -struct CouplingManager<TypeTag, TTag::DarcyOnePNC> +struct CouplingManager<TypeTag, TTag::PorousMediumOnePNC> { - using Traits = StaggeredMultiDomainTraits<Properties::TTag::StokesNC, Properties::TTag::StokesNC, TypeTag>; + using Traits = StaggeredMultiDomainTraits<Properties::TTag::FreeflowNC, Properties::TTag::FreeflowNC, TypeTag>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; // Set the problem property template<class TypeTag> -struct Problem<TypeTag, TTag::DarcyOnePNC> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; +struct Problem<TypeTag, TTag::PorousMediumOnePNC> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; template<class TypeTag> -struct Problem<TypeTag, TTag::StokesNC> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; +struct Problem<TypeTag, TTag::FreeflowNC> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; // The fluid system template<class TypeTag> -struct FluidSystem<TypeTag, TTag::DarcyOnePNC> +struct FluidSystem<TypeTag, TTag::PorousMediumOnePNC> { using H2OAir = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; using type = FluidSystems::OnePAdapter<H2OAir, H2OAir::gasPhaseIdx>; }; template<class TypeTag> -struct FluidSystem<TypeTag, TTag::StokesNC> +struct FluidSystem<TypeTag, TTag::FreeflowNC> { using H2OAir = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; using type = FluidSystems::OnePAdapter<H2OAir, H2OAir::gasPhaseIdx>; @@ -97,25 +97,25 @@ struct FluidSystem<TypeTag, TTag::StokesNC> // Use moles template<class TypeTag> -struct UseMoles<TypeTag, TTag::DarcyOnePNC> { static constexpr bool value = true; }; +struct UseMoles<TypeTag, TTag::PorousMediumOnePNC> { static constexpr bool value = true; }; template<class TypeTag> -struct UseMoles<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; +struct UseMoles<TypeTag, TTag::FreeflowNC> { static constexpr bool value = true; }; // Do not replace one equation with a total mass balance template<class TypeTag> -struct ReplaceCompEqIdx<TypeTag, TTag::DarcyOnePNC> { static constexpr int value = 3; }; +struct ReplaceCompEqIdx<TypeTag, TTag::PorousMediumOnePNC> { static constexpr int value = 3; }; template<class TypeTag> -struct ReplaceCompEqIdx<TypeTag, TTag::StokesNC> { static constexpr int value = 3; }; +struct ReplaceCompEqIdx<TypeTag, TTag::FreeflowNC> { static constexpr int value = 3; }; // Set the grid type template<class TypeTag> -struct Grid<TypeTag, TTag::DarcyOnePNC> { using type = Dune::YaspGrid<2>; }; +struct Grid<TypeTag, TTag::PorousMediumOnePNC> { using type = Dune::YaspGrid<2>; }; template<class TypeTag> -struct Grid<TypeTag, TTag::StokesNC> { using type = Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; +struct Grid<TypeTag, TTag::FreeflowNC> { using type = Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; //! Use a model with constant tortuosity for the effective diffusivity template<class TypeTag> -struct EffectiveDiffusivityModel<TypeTag, TTag::DarcyOnePNC> +struct EffectiveDiffusivityModel<TypeTag, TTag::PorousMediumOnePNC> { using type = DiffusivityConstantTortuosity<GetPropType<TypeTag, Properties::Scalar>>; }; // TODO: dumux-course-task 2.A @@ -125,16 +125,16 @@ struct EffectiveDiffusivityModel<TypeTag, TTag::DarcyOnePNC> template<class TypeTag> // TODO: dumux-course-task 2.A // Adapt the spatial params here. -struct SpatialParams<TypeTag, TTag::DarcyOnePNC> { +struct SpatialParams<TypeTag, TTag::PorousMediumOnePNC> { using type = OnePSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; }; template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; +struct EnableGridGeometryCache<TypeTag, TTag::FreeflowNC> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; +struct EnableGridFluxVariablesCache<TypeTag, TTag::FreeflowNC> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; +struct EnableGridVolumeVariablesCache<TypeTag, TTag::FreeflowNC> { static constexpr bool value = true; }; } // end namespace Dumux::Properties diff --git a/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh index 30761bbc..289141a6 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh @@ -77,7 +77,7 @@ class FreeFlowSubProblem : public NavierStokesStaggeredProblem<TypeTag> public: FreeFlowSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, std::shared_ptr<CouplingManager> couplingManager) - : ParentType(fvGridGeometry, "Stokes"), + : ParentType(fvGridGeometry, "Freeflow"), eps_(1e-6), couplingManager_(couplingManager) { diff --git a/exercises/exercise-coupling-ff-pm/turbulence/main.cc b/exercises/exercise-coupling-ff-pm/turbulence/main.cc index 769e1f4f..cfe3ffed 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/main.cc +++ b/exercises/exercise-coupling-ff-pm/turbulence/main.cc @@ -62,51 +62,51 @@ int main(int argc, char** argv) Parameters::init(argc, argv); // Define the sub problem type tags - using StokesTypeTag = Properties::TTag::StokesZeroEq; - using DarcyTypeTag = Properties::TTag::DarcyTwoPTwoCNI; + using FreeflowTypeTag = Properties::TTag::FreeflowModel; + using PorousMediumTypeTag = Properties::TTag::PorousMediumFlowModel; // try to create a grid (from the given grid file or the input file) // for both sub-domains - using DarcyGridManager = Dumux::GridManager<GetPropType<DarcyTypeTag, Properties::Grid>>; - DarcyGridManager darcyGridManager; - darcyGridManager.init("Darcy"); // pass parameter group + using PorousMediumGridManager = Dumux::GridManager<GetPropType<PorousMediumTypeTag, Properties::Grid>>; + PorousMediumGridManager porousMediumGridManager; + porousMediumGridManager.init("PorousMedium"); // pass parameter group - using StokesGridManager = Dumux::GridManager<GetPropType<StokesTypeTag, Properties::Grid>>; - StokesGridManager stokesGridManager; - stokesGridManager.init("Stokes"); // pass parameter group + using FreeflowGridManager = Dumux::GridManager<GetPropType<FreeflowTypeTag, Properties::Grid>>; + FreeflowGridManager freeflowGridManager; + freeflowGridManager.init("Freeflow"); // pass parameter group // we compute on the leaf grid view - const auto& darcyGridView = darcyGridManager.grid().leafGridView(); - const auto& stokesGridView = stokesGridManager.grid().leafGridView(); + const auto& porousMediumGridView = porousMediumGridManager.grid().leafGridView(); + const auto& freeflowGridView = freeflowGridManager.grid().leafGridView(); // create the finite volume grid geometry - using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; - auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; - auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); + using FreeflowFVGridGeometry = GetPropType<FreeflowTypeTag, Properties::GridGeometry>; + auto freeflowFvGridGeometry = std::make_shared<FreeflowFVGridGeometry>(freeflowGridView); + using PorousMediumFVGridGeometry = GetPropType<PorousMediumTypeTag, Properties::GridGeometry>; + auto porousMediumFvGridGeometry = std::make_shared<PorousMediumFVGridGeometry>(porousMediumGridView); - using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; + using Traits = StaggeredMultiDomainTraits<FreeflowTypeTag, FreeflowTypeTag, PorousMediumTypeTag>; // the coupling manager using CouplingManager = StokesDarcyCouplingManager<Traits>; - auto couplingManager = std::make_shared<CouplingManager>(stokesFvGridGeometry, darcyFvGridGeometry); + auto couplingManager = std::make_shared<CouplingManager>(freeflowFvGridGeometry, porousMediumFvGridGeometry); // the indices - constexpr auto stokesCellCenterIdx = CouplingManager::stokesCellCenterIdx; - constexpr auto stokesFaceIdx = CouplingManager::stokesFaceIdx; - constexpr auto darcyIdx = CouplingManager::darcyIdx; + constexpr auto freeflowCellCenterIdx = CouplingManager::stokesCellCenterIdx; + constexpr auto freeflowFaceIdx = CouplingManager::stokesFaceIdx; + constexpr auto porousMediumIdx = CouplingManager::darcyIdx; // the problem (initial and boundary conditions) - using StokesProblem = GetPropType<StokesTypeTag, Properties::Problem>; - auto stokesProblem = std::make_shared<StokesProblem>(stokesFvGridGeometry, couplingManager); - using DarcyProblem = GetPropType<DarcyTypeTag, Properties::Problem>; - auto darcyProblem = std::make_shared<DarcyProblem>(darcyFvGridGeometry, couplingManager); + using FreeflowProblem = GetPropType<FreeflowTypeTag, Properties::Problem>; + auto freeflowProblem = std::make_shared<FreeflowProblem>(freeflowFvGridGeometry, couplingManager); + using PorousMediumProblem = GetPropType<PorousMediumTypeTag, Properties::Problem>; + auto porousMediumProblem = std::make_shared<PorousMediumProblem>(porousMediumFvGridGeometry, couplingManager); // initialize the fluidsystem (tabulation) - GetPropType<StokesTypeTag, Properties::FluidSystem>::init(); + GetPropType<FreeflowTypeTag, Properties::FluidSystem>::init(); // get some time loop parameters - using Scalar = GetPropType<StokesTypeTag, Properties::Scalar>; + using Scalar = GetPropType<FreeflowTypeTag, Properties::Scalar>; const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); @@ -116,23 +116,23 @@ int main(int argc, char** argv) timeLoop->setMaxTimeStepSize(maxDt); // set timeloop for the subproblems, needed for boundary value variations - stokesProblem->setTimeLoop(timeLoop); - darcyProblem->setTimeLoop(timeLoop); + freeflowProblem->setTimeLoop(timeLoop); + porousMediumProblem->setTimeLoop(timeLoop); // the solution vector Traits::SolutionVector sol; - sol[stokesCellCenterIdx].resize(stokesFvGridGeometry->numCellCenterDofs()); - sol[stokesFaceIdx].resize(stokesFvGridGeometry->numFaceDofs()); - sol[darcyIdx].resize(darcyFvGridGeometry->numDofs()); + sol[freeflowCellCenterIdx].resize(freeflowFvGridGeometry->numCellCenterDofs()); + sol[freeflowFaceIdx].resize(freeflowFvGridGeometry->numFaceDofs()); + sol[porousMediumIdx].resize(porousMediumFvGridGeometry->numDofs()); - auto stokesSol = partial(sol, stokesFaceIdx, stokesCellCenterIdx); + auto freeflowSol = partial(sol, freeflowFaceIdx, freeflowCellCenterIdx); - stokesProblem->applyInitialSolution(stokesSol); - darcyProblem->applyInitialSolution(sol[darcyIdx]); + freeflowProblem->applyInitialSolution(freeflowSol); + porousMediumProblem->applyInitialSolution(sol[porousMediumIdx]); auto solOld = sol; - couplingManager->init(stokesProblem, darcyProblem, sol); + couplingManager->init(freeflowProblem, porousMediumProblem, sol); // TODO: dumux-course-task 3.A // Update static wall properties @@ -141,36 +141,37 @@ int main(int argc, char** argv) // Update dynamic wall properties // the grid variables - using StokesGridVariables = GetPropType<StokesTypeTag, Properties::GridVariables>; - auto stokesGridVariables = std::make_shared<StokesGridVariables>(stokesProblem, stokesFvGridGeometry); - stokesGridVariables->init(stokesSol); - using DarcyGridVariables = GetPropType<DarcyTypeTag, Properties::GridVariables>; - auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); - darcyGridVariables->init(sol[darcyIdx]); - - // initialize the vtk output module - const auto stokesName = getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); - const auto darcyName = getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); - - StaggeredVtkOutputModule<StokesGridVariables, decltype(stokesSol)> stokesVtkWriter(*stokesGridVariables, stokesSol, stokesName); - GetPropType<StokesTypeTag, Properties::IOFields>::initOutputModule(stokesVtkWriter); - stokesVtkWriter.write(0.0); - - VtkOutputModule<DarcyGridVariables, GetPropType<DarcyTypeTag, Properties::SolutionVector>> darcyVtkWriter(*darcyGridVariables, sol[darcyIdx], darcyName); - using DarcyVelocityOutput = GetPropType<DarcyTypeTag, Properties::VelocityOutput>; - darcyVtkWriter.addVelocityOutput(std::make_shared<DarcyVelocityOutput>(*darcyGridVariables)); - GetPropType<DarcyTypeTag, Properties::IOFields>::initOutputModule(darcyVtkWriter); - darcyVtkWriter.write(0.0); + using FreeflowGridVariables = GetPropType<FreeflowTypeTag, Properties::GridVariables>; + auto freeflowGridVariables = std::make_shared<FreeflowGridVariables>(freeflowProblem, freeflowFvGridGeometry); + freeflowGridVariables->init(freeflowSol); + using PorousMediumGridVariables = GetPropType<PorousMediumTypeTag, Properties::GridVariables>; + auto porousMediumGridVariables = std::make_shared<PorousMediumGridVariables>(porousMediumProblem, porousMediumFvGridGeometry); + porousMediumGridVariables->init(sol[porousMediumIdx]); + + // intialize the vtk output module + const auto freeflowName = getParam<std::string>("Problem.Name") + "_" + freeflowProblem->name(); + const auto porousMediumName = getParam<std::string>("Problem.Name") + "_" + porousMediumProblem->name(); + + StaggeredVtkOutputModule<FreeflowGridVariables, decltype(freeflowSol)> freeflowVtkWriter(*freeflowGridVariables, freeflowSol, freeflowName); + GetPropType<FreeflowTypeTag, Properties::IOFields>::initOutputModule(freeflowVtkWriter); + freeflowVtkWriter.write(0.0); + + using PorousMediumSolutionVector = GetPropType<PorousMediumTypeTag, Properties::SolutionVector>; + VtkOutputModule<PorousMediumGridVariables, PorousMediumSolutionVector> porousMediumVtkWriter(*porousMediumGridVariables, sol[porousMediumIdx], porousMediumName); + using PorousMediumVelocityOutput = GetPropType<PorousMediumTypeTag, Properties::VelocityOutput>; + porousMediumVtkWriter.addVelocityOutput(std::make_shared<PorousMediumVelocityOutput>(*porousMediumGridVariables)); + GetPropType<PorousMediumTypeTag, Properties::IOFields>::initOutputModule(porousMediumVtkWriter); + porousMediumVtkWriter.write(0.0); // the assembler with time loop for instationary problem using Assembler = MultiDomainFVAssembler<Traits, CouplingManager, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(std::make_tuple(stokesProblem, stokesProblem, darcyProblem), - std::make_tuple(stokesFvGridGeometry->faceFVGridGeometryPtr(), - stokesFvGridGeometry->cellCenterFVGridGeometryPtr(), - darcyFvGridGeometry), - std::make_tuple(stokesGridVariables->faceGridVariablesPtr(), - stokesGridVariables->cellCenterGridVariablesPtr(), - darcyGridVariables), + auto assembler = std::make_shared<Assembler>(std::make_tuple(freeflowProblem, freeflowProblem, porousMediumProblem), + std::make_tuple(freeflowFvGridGeometry->faceFVGridGeometryPtr(), + freeflowFvGridGeometry->cellCenterFVGridGeometryPtr(), + porousMediumFvGridGeometry), + std::make_tuple(freeflowGridVariables->faceGridVariablesPtr(), + freeflowGridVariables->cellCenterGridVariablesPtr(), + porousMediumGridVariables), couplingManager, timeLoop, solOld); @@ -194,19 +195,19 @@ int main(int argc, char** argv) // TODO: dumux-course-task 3.A // Update dynamic wall properties - // post time step treatment of Darcy problem - darcyProblem->postTimeStep(sol[darcyIdx], *darcyGridVariables, timeLoop->timeStepSize()); + // post time step treatment of PorousMedium problem + porousMediumProblem->postTimeStep(sol[porousMediumIdx], *porousMediumGridVariables, timeLoop->timeStepSize()); // advance grid variables to the next time step - stokesGridVariables->advanceTimeStep(); - darcyGridVariables->advanceTimeStep(); + freeflowGridVariables->advanceTimeStep(); + porousMediumGridVariables->advanceTimeStep(); // advance to the time loop to the next step timeLoop->advanceTimeStep(); // write vtk output - stokesVtkWriter.write(timeLoop->time()); - darcyVtkWriter.write(timeLoop->time()); + freeflowVtkWriter.write(timeLoop->time()); + porousMediumVtkWriter.write(timeLoop->time()); // report statistics of this time step timeLoop->reportTimeStep(); @@ -216,8 +217,8 @@ int main(int argc, char** argv) } while (!timeLoop->finished()); - timeLoop->finalize(stokesGridView.comm()); - timeLoop->finalize(darcyGridView.comm()); + timeLoop->finalize(freeflowGridView.comm()); + timeLoop->finalize(porousMediumGridView.comm()); Parameters::print(); diff --git a/exercises/exercise-coupling-ff-pm/turbulence/params.input b/exercises/exercise-coupling-ff-pm/turbulence/params.input index 7f0d58a8..b64b0558 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/params.input +++ b/exercises/exercise-coupling-ff-pm/turbulence/params.input @@ -3,7 +3,7 @@ DtInitial = 1e-1 # [s] MaxTimeStepSize = 43200 # [s] (12 hours) TEnd = 864000 # [s] (6 days) -[Stokes.Grid] +[Freeflow.Grid] Positions0 = 0.0 0.25 Positions1 = 0.25 0.5 Grading0 = 1.0 @@ -12,7 +12,7 @@ Cells0 = 15 Cells1 = 20 Verbosity = true -[Darcy.Grid] +[PorousMedium.Grid] Positions0 = 0.0 0.25 Positions1 = 0.0 0.25 Cells0 = 15 @@ -21,16 +21,16 @@ Grading0 = 1.0 Grading1 = 1.0 Verbosity = true -[Stokes.Problem] -Name = stokes +[Freeflow.Problem] +Name = freeflow RefVelocity = 3.5 # [m/s] RefPressure = 1e5 # [Pa] refMoleFrac = 0 # [-] RefTemperature = 298.15 # [K] EnableInertiaTerms = true -[Darcy.Problem] -Name = darcy +[PorousMedium.Problem] +Name = porousmedium Pressure = 1e5 Saturation = 0.5 # initial Sw Temperature = 298.15 # [K] diff --git a/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh index 99c26cd7..bc2bd75a 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh @@ -21,8 +21,8 @@ * * \brief The porous medium sub problem */ -#ifndef DUMUX_DARCY2P2C_SUBPROBLEM_HH -#define DUMUX_DARCY2P2C_SUBPROBLEM_HH +#ifndef DUMUX_POROUSMEDIUMFLOW2P2C_SUBPROBLEM_HH +#define DUMUX_POROUSMEDIUMFLOW2P2C_SUBPROBLEM_HH #include <dumux/porousmediumflow/problem.hh> #include <dumux/common/boundarytypes.hh> @@ -78,7 +78,7 @@ class PorousMediumSubProblem : public PorousMediumFlowProblem<TypeTag> public: PorousMediumSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, std::shared_ptr<CouplingManager> couplingManager) - : ParentType(fvGridGeometry, "Darcy"), + : ParentType(fvGridGeometry, "PorousMedium"), eps_(1e-7), couplingManager_(couplingManager) { diff --git a/exercises/exercise-coupling-ff-pm/turbulence/properties.hh b/exercises/exercise-coupling-ff-pm/turbulence/properties.hh index 3d86bc5d..14bc29ff 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/properties.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/properties.hh @@ -51,43 +51,43 @@ namespace Dumux::Properties { // Create new type tags namespace TTag { -struct DarcyTwoPTwoCNI { using InheritsFrom = std::tuple<TwoPTwoCNI, CCTpfaModel>; }; +struct PorousMediumFlowModel { using InheritsFrom = std::tuple<TwoPTwoCNI, CCTpfaModel>; }; // TODO: dumux-course-task 3.A -// Change the entry in the `StokesZeroEq` definition accordingly. -struct StokesZeroEq { using InheritsFrom = std::tuple<NavierStokesNCNI, StaggeredFreeFlowModel>; }; +// Change the entry in the `FreeflowModel` definition accordingly. +struct FreeflowModel { using InheritsFrom = std::tuple<NavierStokesNCNI, StaggeredFreeFlowModel>; }; } // end namespace TTag // Set the coupling manager template<class TypeTag> -struct CouplingManager<TypeTag, TTag::StokesZeroEq> +struct CouplingManager<TypeTag, TTag::FreeflowModel> { - using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::DarcyTwoPTwoCNI>; + using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::PorousMediumFlowModel>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; template<class TypeTag> -struct CouplingManager<TypeTag, TTag::DarcyTwoPTwoCNI> +struct CouplingManager<TypeTag, TTag::PorousMediumFlowModel> { - using Traits = StaggeredMultiDomainTraits<Properties::TTag::StokesZeroEq, Properties::TTag::StokesZeroEq, TypeTag>; + using Traits = StaggeredMultiDomainTraits<Properties::TTag::FreeflowModel, Properties::TTag::FreeflowModel, TypeTag>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; // Set the problem property template<class TypeTag> -struct Problem<TypeTag, TTag::DarcyTwoPTwoCNI> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; +struct Problem<TypeTag, TTag::PorousMediumFlowModel> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; template<class TypeTag> -struct Problem<TypeTag, TTag::StokesZeroEq> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; +struct Problem<TypeTag, TTag::FreeflowModel> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; // Set the grid type template<class TypeTag> -struct Grid<TypeTag, TTag::DarcyTwoPTwoCNI> { using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; +struct Grid<TypeTag, TTag::PorousMediumFlowModel> { using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; template<class TypeTag> -struct Grid<TypeTag, TTag::StokesZeroEq> { using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; +struct Grid<TypeTag, TTag::FreeflowModel> { using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; // the fluid system template<class TypeTag> -struct FluidSystem<TypeTag, TTag::DarcyTwoPTwoCNI> { using type = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; }; +struct FluidSystem<TypeTag, TTag::PorousMediumFlowModel> { using type = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; }; template<class TypeTag> -struct FluidSystem<TypeTag, TTag::StokesZeroEq> +struct FluidSystem<TypeTag, TTag::FreeflowModel> { using H2OAir = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; static constexpr auto phaseIdx = H2OAir::gasPhaseIdx; // simulate the air phase @@ -96,32 +96,32 @@ struct FluidSystem<TypeTag, TTag::StokesZeroEq> // Use formulation based on mole fractions template<class TypeTag> -struct UseMoles<TypeTag, TTag::DarcyTwoPTwoCNI> { static constexpr bool value = true; }; +struct UseMoles<TypeTag, TTag::PorousMediumFlowModel> { static constexpr bool value = true; }; template<class TypeTag> -struct UseMoles<TypeTag, TTag::StokesZeroEq> { static constexpr bool value = true; }; +struct UseMoles<TypeTag, TTag::FreeflowModel> { static constexpr bool value = true; }; // The gas component balance (air) is replaced by the total mass balance template<class TypeTag> -struct ReplaceCompEqIdx<TypeTag, TTag::DarcyTwoPTwoCNI> { static constexpr int value = 3; }; +struct ReplaceCompEqIdx<TypeTag, TTag::PorousMediumFlowModel> { static constexpr int value = 3; }; template<class TypeTag> -struct ReplaceCompEqIdx<TypeTag, TTag::StokesZeroEq> { static constexpr int value = 3; }; +struct ReplaceCompEqIdx<TypeTag, TTag::FreeflowModel> { static constexpr int value = 3; }; //! Set the default formulation to pw-Sn: This can be over written in the problem. template<class TypeTag> -struct Formulation<TypeTag, TTag::DarcyTwoPTwoCNI> +struct Formulation<TypeTag, TTag::PorousMediumFlowModel> { static constexpr auto value = TwoPFormulation::p1s0; }; template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyTwoPTwoCNI> +struct SpatialParams<TypeTag, TTag::PorousMediumFlowModel> { using type = TwoPSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; }; template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::StokesZeroEq> { static constexpr bool value = true; }; +struct EnableGridGeometryCache<TypeTag, TTag::FreeflowModel> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::StokesZeroEq> { static constexpr bool value = true; }; +struct EnableGridFluxVariablesCache<TypeTag, TTag::FreeflowModel> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::StokesZeroEq> { static constexpr bool value = true; }; +struct EnableGridVolumeVariablesCache<TypeTag, TTag::FreeflowModel> { static constexpr bool value = true; }; } // end namespace Dumux::Properties diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh index 2438cada..45317a45 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh @@ -20,8 +20,8 @@ * \file * \brief The free flow sub problem */ -#ifndef DUMUX_STOKES_SUBPROBLEM_HH -#define DUMUX_STOKES_SUBPROBLEM_HH +#ifndef DUMUX_FREEFLOW_INTERFACE_SUBPROBLEM_HH +#define DUMUX_FREEFLOW_INTERFACE_SUBPROBLEM_HH #include <dumux/common/properties.hh> #include <dumux/common/boundarytypes.hh> @@ -62,21 +62,11 @@ class FreeFlowSubProblem : public NavierStokesStaggeredProblem<TypeTag> public: FreeFlowSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, std::shared_ptr<CouplingManager> couplingManager) - : ParentType(fvGridGeometry, "Stokes"), eps_(1e-6), couplingManager_(couplingManager) + : ParentType(fvGridGeometry, "Freeflow"), eps_(1e-6), couplingManager_(couplingManager) { deltaP_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.PressureDifference"); } - - /*! - * \brief Return the sources within the domain. - * - * \param globalPos The global position - */ - NumEqVector sourceAtPos(const GlobalPosition &globalPos) const - { return NumEqVector(0.0); } - - /*! * \brief Specifies which kind of boundary condition should be * used for which equation on a given boundary segment. @@ -191,8 +181,15 @@ public: const CouplingManager& couplingManager() const { return *couplingManager_; } + /*! + * \brief Return the sources within the domain. + * + * \param globalPos The global position + */ + NumEqVector sourceAtPos(const GlobalPosition &globalPos) const + { return NumEqVector(0.0); } - /*! + /*! * \brief Evaluate the initial value for a control volume. * * \param globalPos The global position @@ -217,17 +214,13 @@ public: * \brief Returns the intrinsic permeability of required as input parameter for the Beavers-Joseph-Saffman boundary condition */ Scalar permeability(const Element& element, const SubControlVolumeFace& scvf) const - { - return couplingManager().couplingData().darcyPermeability(element, scvf); - } + { return couplingManager().couplingData().darcyPermeability(element, scvf); } /*! * \brief Returns the alpha value required as input parameter for the Beavers-Joseph-Saffman boundary condition */ Scalar alphaBJ(const SubControlVolumeFace& scvf) const - { - return couplingManager().problem(CouplingManager::darcyIdx).spatialParams().beaversJosephCoeffAtPos(scvf.center()); - } + { return couplingManager().problem(CouplingManager::darcyIdx).spatialParams().beaversJosephCoeffAtPos(scvf.center()); } /*! * \brief calculate the analytical velocity in x direction based on Beavers & Joseph (1967) diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/main.cc b/exercises/solution/exercise-coupling-ff-pm/interface/main.cc index 73426d92..b4db7eb1 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/main.cc +++ b/exercises/solution/exercise-coupling-ff-pm/interface/main.cc @@ -60,23 +60,23 @@ int main(int argc, char** argv) Parameters::init(argc, argv); // Define the sub problem type tags - using StokesTypeTag = Properties::TTag::StokesOneP; - using DarcyTypeTag = Properties::TTag::DarcyOneP; + using FreeflowTypeTag = Properties::TTag::FreeflowOneP; + using PorousMediumTypeTag = Properties::TTag::PorousMediumOneP; #if EXNUMBER < 3 // try to create a grid (from the given grid file or the input file) // for both sub-domains - using DarcyGridManager = Dumux::GridManager<GetPropType<DarcyTypeTag, Properties::Grid>>; - DarcyGridManager darcyGridManager; - darcyGridManager.init("Darcy"); // pass parameter group + using PorousMediumGridManager = Dumux::GridManager<GetPropType<PorousMediumTypeTag, Properties::Grid>>; + PorousMediumGridManager porousMediumGridManager; + porousMediumGridManager.init("PorousMedium"); // pass parameter group - using StokesGridManager = Dumux::GridManager<GetPropType<StokesTypeTag, Properties::Grid>>; - StokesGridManager stokesGridManager; - stokesGridManager.init("Stokes"); // pass parameter group + using FreeflowGridManager = Dumux::GridManager<GetPropType<FreeflowTypeTag, Properties::Grid>>; + FreeflowGridManager freeflowGridManager; + freeflowGridManager.init("Freeflow"); // pass parameter group // we compute on the leaf grid view - const auto& darcyGridView = darcyGridManager.grid().leafGridView(); - const auto& stokesGridView = stokesGridManager.grid().leafGridView(); + const auto& porousMediumGridView = porousMediumGridManager.grid().leafGridView(); + const auto& freeflowGridView = freeflowGridManager.grid().leafGridView(); #else // use dune-subgrid to create the individual grids static constexpr int dim = 2; @@ -96,13 +96,13 @@ int main(int argc, char** argv) Params params; - auto elementSelectorStokes = [&](const auto& element) + auto elementSelectorFreeflow = [&](const auto& element) { double interface = params.amplitude * std::sin(( element.geometry().center()[0] -params.offset) / params.scaling * 2.0 * M_PI) + params.baseline; return element.geometry().center()[1] > interface; }; - auto elementSelectorDarcy = [&](const auto& element) + auto elementSelectorPorousMedium = [&](const auto& element) { double interface = params.amplitude * std::sin(( element.geometry().center()[0] - params.offset) / params.scaling * 2.0 * M_PI) + params.baseline; return element.geometry().center()[1] < interface; @@ -110,91 +110,92 @@ int main(int argc, char** argv) using SubGrid = Dune::SubGrid<dim, HostGrid>; - Dumux::GridManager<SubGrid> subGridManagerStokes; - Dumux::GridManager<SubGrid> subGridManagerDarcy; + Dumux::GridManager<SubGrid> subGridManagerFreeflow; + Dumux::GridManager<SubGrid> subGridManagerPorousMedium; // initialize subgrids - subGridManagerStokes.init(hostGrid, elementSelectorStokes, "Stokes"); - subGridManagerDarcy.init(hostGrid, elementSelectorDarcy, "Darcy"); + subGridManagerFreeflow.init(hostGrid, elementSelectorFreeflow, "Freeflow"); + subGridManagerPorousMedium.init(hostGrid, elementSelectorPorousMedium, "PorousMedium"); // we compute on the leaf grid view - const auto& darcyGridView = subGridManagerDarcy.grid().leafGridView(); - const auto& stokesGridView = subGridManagerStokes.grid().leafGridView(); + const auto& porousMediumGridView = subGridManagerPorousMedium.grid().leafGridView(); + const auto& freeflowGridView = subGridManagerFreeflow.grid().leafGridView(); #endif // create the finite volume grid geometry - using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; - auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; - auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); + using FreeflowFVGridGeometry = GetPropType<FreeflowTypeTag, Properties::GridGeometry>; + auto freeflowFvGridGeometry = std::make_shared<FreeflowFVGridGeometry>(freeflowGridView); + using PorousMediumFVGridGeometry = GetPropType<PorousMediumTypeTag, Properties::GridGeometry>; + auto porousMediumFvGridGeometry = std::make_shared<PorousMediumFVGridGeometry>(porousMediumGridView); - using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; + using Traits = StaggeredMultiDomainTraits<FreeflowTypeTag, FreeflowTypeTag, PorousMediumTypeTag>; // the coupling manager using CouplingManager = StokesDarcyCouplingManager<Traits>; - auto couplingManager = std::make_shared<CouplingManager>(stokesFvGridGeometry, darcyFvGridGeometry); + auto couplingManager = std::make_shared<CouplingManager>(freeflowFvGridGeometry, porousMediumFvGridGeometry); // the indices - constexpr auto stokesCellCenterIdx = CouplingManager::stokesCellCenterIdx; - constexpr auto stokesFaceIdx = CouplingManager::stokesFaceIdx; - constexpr auto darcyIdx = CouplingManager::darcyIdx; + constexpr auto freeflowCellCenterIdx = CouplingManager::stokesCellCenterIdx; + constexpr auto freeflowFaceIdx = CouplingManager::stokesFaceIdx; + constexpr auto porousMediumIdx = CouplingManager::darcyIdx; // the problem (initial and boundary conditions) - using StokesProblem = GetPropType<StokesTypeTag, Properties::Problem>; - auto stokesProblem = std::make_shared<StokesProblem>(stokesFvGridGeometry, couplingManager); - using DarcyProblem = GetPropType<DarcyTypeTag, Properties::Problem>; - auto darcyProblem = std::make_shared<DarcyProblem>(darcyFvGridGeometry, couplingManager); + using FreeflowProblem = GetPropType<FreeflowTypeTag, Properties::Problem>; + auto freeflowProblem = std::make_shared<FreeflowProblem>(freeflowFvGridGeometry, couplingManager); + using PorousMediumProblem = GetPropType<PorousMediumTypeTag, Properties::Problem>; + auto porousMediumProblem = std::make_shared<PorousMediumProblem>(porousMediumFvGridGeometry, couplingManager); // the solution vector Traits::SolutionVector sol; - sol[stokesCellCenterIdx].resize(stokesFvGridGeometry->numCellCenterDofs()); - sol[stokesFaceIdx].resize(stokesFvGridGeometry->numFaceDofs()); - sol[darcyIdx].resize(darcyFvGridGeometry->numDofs()); + sol[freeflowCellCenterIdx].resize(freeflowFvGridGeometry->numCellCenterDofs()); + sol[freeflowFaceIdx].resize(freeflowFvGridGeometry->numFaceDofs()); + sol[porousMediumIdx].resize(porousMediumFvGridGeometry->numDofs()); - auto stokesSol = partial(sol, stokesFaceIdx, stokesCellCenterIdx); + auto freeflowSol = partial(sol, freeflowFaceIdx, freeflowCellCenterIdx); - stokesProblem->applyInitialSolution(stokesSol); - darcyProblem->applyInitialSolution(sol[darcyIdx]); + freeflowProblem->applyInitialSolution(freeflowSol); + porousMediumProblem->applyInitialSolution(sol[porousMediumIdx]); - couplingManager->init(stokesProblem, darcyProblem, sol); + couplingManager->init(freeflowProblem, porousMediumProblem, sol); // the grid variables - using StokesGridVariables = GetPropType<StokesTypeTag, Properties::GridVariables>; - auto stokesGridVariables = std::make_shared<StokesGridVariables>(stokesProblem, stokesFvGridGeometry); - stokesGridVariables->init(stokesSol); - using DarcyGridVariables = GetPropType<DarcyTypeTag, Properties::GridVariables>; - auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); - darcyGridVariables->init(sol[darcyIdx]); + using FreeflowGridVariables = GetPropType<FreeflowTypeTag, Properties::GridVariables>; + auto freeflowGridVariables = std::make_shared<FreeflowGridVariables>(freeflowProblem, freeflowFvGridGeometry); + freeflowGridVariables->init(freeflowSol); + using PorousMediumGridVariables = GetPropType<PorousMediumTypeTag, Properties::GridVariables>; + auto porousMediumGridVariables = std::make_shared<PorousMediumGridVariables>(porousMediumProblem, porousMediumFvGridGeometry); + porousMediumGridVariables->init(sol[porousMediumIdx]); - // initialize the vtk output module - const auto stokesName = getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); - const auto darcyName = getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); - StaggeredVtkOutputModule<StokesGridVariables, decltype(stokesSol)> stokesVtkWriter(*stokesGridVariables, stokesSol, stokesName); - GetPropType<StokesTypeTag, Properties::IOFields>::initOutputModule(stokesVtkWriter); + // intialize the vtk output module + const auto freeflowName = getParam<std::string>("Problem.Name") + "_" + freeflowProblem->name(); + const auto porousMediumName = getParam<std::string>("Problem.Name") + "_" + porousMediumProblem->name(); + + StaggeredVtkOutputModule<FreeflowGridVariables, decltype(freeflowSol)> freeflowVtkWriter(*freeflowGridVariables, freeflowSol, freeflowName); + GetPropType<FreeflowTypeTag, Properties::IOFields>::initOutputModule(freeflowVtkWriter); #if EXNUMBER >= 2 - stokesVtkWriter.addField(stokesProblem->getAnalyticalVelocityX(), "analyticalV_x"); + freeflowVtkWriter.addField(freeflowProblem->getAnalyticalVelocityX(), "analyticalV_x"); #endif - stokesVtkWriter.write(0.0); + freeflowVtkWriter.write(0.0); - VtkOutputModule<DarcyGridVariables, GetPropType<DarcyTypeTag, Properties::SolutionVector>> darcyVtkWriter(*darcyGridVariables, sol[darcyIdx], darcyName); - using DarcyVelocityOutput = GetPropType<DarcyTypeTag, Properties::VelocityOutput>; - darcyVtkWriter.addVelocityOutput(std::make_shared<DarcyVelocityOutput>(*darcyGridVariables)); - GetPropType<DarcyTypeTag, Properties::IOFields>::initOutputModule(darcyVtkWriter); - darcyVtkWriter.write(0.0); + VtkOutputModule<PorousMediumGridVariables, GetPropType<PorousMediumTypeTag, Properties::SolutionVector>> porousMediumVtkWriter(*porousMediumGridVariables, sol[porousMediumIdx], porousMediumName); + using PorousMediumVelocityOutput = GetPropType<PorousMediumTypeTag, Properties::VelocityOutput>; + porousMediumVtkWriter.addVelocityOutput(std::make_shared<PorousMediumVelocityOutput>(*porousMediumGridVariables)); + GetPropType<PorousMediumTypeTag, Properties::IOFields>::initOutputModule(porousMediumVtkWriter); + porousMediumVtkWriter.write(0.0); // the assembler for a stationary problem using Assembler = MultiDomainFVAssembler<Traits, CouplingManager, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(std::make_tuple(stokesProblem, stokesProblem, darcyProblem), - std::make_tuple(stokesFvGridGeometry->faceFVGridGeometryPtr(), - stokesFvGridGeometry->cellCenterFVGridGeometryPtr(), - darcyFvGridGeometry), - std::make_tuple(stokesGridVariables->faceGridVariablesPtr(), - stokesGridVariables->cellCenterGridVariablesPtr(), - darcyGridVariables), + auto assembler = std::make_shared<Assembler>(std::make_tuple(freeflowProblem, freeflowProblem, porousMediumProblem), + std::make_tuple(freeflowFvGridGeometry->faceFVGridGeometryPtr(), + freeflowFvGridGeometry->cellCenterFVGridGeometryPtr(), + porousMediumFvGridGeometry), + std::make_tuple(freeflowGridVariables->faceGridVariablesPtr(), + freeflowGridVariables->cellCenterGridVariablesPtr(), + porousMediumGridVariables), couplingManager); // the linear solver @@ -209,8 +210,8 @@ int main(int argc, char** argv) nonLinearSolver.solve(sol); // write vtk output - stokesVtkWriter.write(1.0); - darcyVtkWriter.write(1.0); + freeflowVtkWriter.write(1.0); + porousMediumVtkWriter.write(1.0); Parameters::print(); diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/params.input b/exercises/solution/exercise-coupling-ff-pm/interface/params.input index 6935e994..2f1dc08b 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/params.input +++ b/exercises/solution/exercise-coupling-ff-pm/interface/params.input @@ -1,5 +1,5 @@ - # for dune-subgrid - [Grid] +# for dune-subgrid +[Grid] Positions0 = 0 1 Positions1 = 0 0.2 0.3 0.65 Cells0 = 100 @@ -9,7 +9,7 @@ Amplitude = 0.04 # [m] Offset = 0.5 # [m] Scaling = 0.2 #[m] -[Stokes.Grid] +[Freeflow.Grid] Verbosity = true Positions0 = 0.0 1.0 Positions1 = 1.0 2.0 @@ -17,7 +17,7 @@ Cells0 = 20 Cells1 = 100 Grading1 = 1 -[Darcy.Grid] +[PorousMedium.Grid] Verbosity = true Positions0 = 0.0 1.0 Positions1 = 0.0 1.0 @@ -25,12 +25,12 @@ Cells0 = 20 Cells1 = 20 Grading1 = 1 -[Stokes.Problem] +[Freeflow.Problem] Name = stokes PressureDifference = 1e-9 EnableInertiaTerms = false -[Darcy.Problem] +[PorousMedium.Problem] Name = darcy [SpatialParams] diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh index 173c5c9d..85e1978c 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh @@ -21,8 +21,8 @@ * * \brief The porous medium flow sub problem */ -#ifndef DUMUX_DARCY_SUBPROBLEM_HH -#define DUMUX_DARCY_SUBPROBLEM_HH +#ifndef DUMUX_POROUSMEDIUMFLOW_INTERFACE_SUBPROBLEM_HH +#define DUMUX_POROUSMEDIUMFLOW_INTERFACE_SUBPROBLEM_HH #include <dumux/porousmediumflow/problem.hh> #include <dumux/common/properties.hh> @@ -61,17 +61,16 @@ class PorousMediumSubProblem : public PorousMediumFlowProblem<TypeTag> public: PorousMediumSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, std::shared_ptr<CouplingManager> couplingManager) - : ParentType(fvGridGeometry, "Darcy"), eps_(1e-7), couplingManager_(couplingManager) + : ParentType(fvGridGeometry, "PorousMedium"), eps_(1e-7), couplingManager_(couplingManager) {} - /*! - * \brief Specifies which kind of boundary condition should be - * used for which equation on a given boundary control volume. - * - * \param element The element - * \param scvf The boundary sub control volume face - */ + * \brief Specifies which kind of boundary condition should be + * used for which equation on a given boundary control volume. + * + * \param element The element + * \param scvf The boundary sub control volume face + */ BoundaryTypes boundaryTypes(const Element &element, const SubControlVolumeFace &scvf) const { BoundaryTypes values; @@ -88,7 +87,7 @@ public: return values; } - /*! + /*! * \brief Evaluate the boundary conditions for a Dirichlet control volume. * * \param element The element for which the Dirichlet boundary condition is set @@ -145,8 +144,6 @@ public: const SubControlVolume &scv) const { return NumEqVector(0.0); } - // \} - /*! * \brief Evaluate the initial value for a control volume. * @@ -156,11 +153,7 @@ public: * variables. */ PrimaryVariables initial(const Element &element) const - { - return PrimaryVariables(0.0); - } - - // \} + { return PrimaryVariables(0.0);} //! Set the coupling manager void setCouplingManager(std::shared_ptr<CouplingManager> cm) diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/properties.hh b/exercises/solution/exercise-coupling-ff-pm/interface/properties.hh index 642c815f..f8a8587c 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/properties.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/properties.hh @@ -52,33 +52,33 @@ namespace Dumux::Properties { // Create new type tags namespace TTag { -struct DarcyOneP { using InheritsFrom = std::tuple<OneP, CCTpfaModel>; }; -struct StokesOneP { using InheritsFrom = std::tuple<NavierStokes, StaggeredFreeFlowModel>; }; +struct FreeflowOneP { using InheritsFrom = std::tuple<NavierStokes, StaggeredFreeFlowModel>; }; +struct PorousMediumOneP { using InheritsFrom = std::tuple<OneP, CCTpfaModel>; }; } // end namespace TTag // Set the coupling manager template<class TypeTag> -struct CouplingManager<TypeTag, TTag::StokesOneP> +struct CouplingManager<TypeTag, TTag::FreeflowOneP> { - using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::DarcyOneP>; + using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::PorousMediumOneP>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; template<class TypeTag> -struct CouplingManager<TypeTag, TTag::DarcyOneP> +struct CouplingManager<TypeTag, TTag::PorousMediumOneP> { - using Traits = StaggeredMultiDomainTraits<Properties::TTag::StokesOneP, Properties::TTag::StokesOneP, TypeTag>; + using Traits = StaggeredMultiDomainTraits<Properties::TTag::FreeflowOneP, Properties::TTag::FreeflowOneP, TypeTag>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; // Set the problem property template<class TypeTag> -struct Problem<TypeTag, TTag::DarcyOneP> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; +struct Problem<TypeTag, TTag::PorousMediumOneP> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; template<class TypeTag> -struct Problem<TypeTag, TTag::StokesOneP> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; +struct Problem<TypeTag, TTag::FreeflowOneP> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; // Set the grid type template<class TypeTag> -struct Grid<TypeTag, TTag::DarcyOneP> +struct Grid<TypeTag, TTag::PorousMediumOneP> { static constexpr auto dim = 2; using Scalar = GetPropType<TypeTag, Properties::Scalar>; @@ -92,7 +92,7 @@ struct Grid<TypeTag, TTag::DarcyOneP> #endif }; template<class TypeTag> -struct Grid<TypeTag, TTag::StokesOneP> +struct Grid<TypeTag, TTag::FreeflowOneP> { static constexpr auto dim = 2; using Scalar = GetPropType<TypeTag, Properties::Scalar>; @@ -108,29 +108,29 @@ struct Grid<TypeTag, TTag::StokesOneP> // the fluid system template<class TypeTag> -struct FluidSystem<TypeTag, TTag::DarcyOneP> +struct FluidSystem<TypeTag, TTag::PorousMediumOneP> { using Scalar = GetPropType<TypeTag, Properties::Scalar>; using type = FluidSystems::OnePLiquid<Scalar, Dumux::Components::SimpleH2O<Scalar> > ; }; template<class TypeTag> -struct FluidSystem<TypeTag, TTag::StokesOneP> +struct FluidSystem<TypeTag, TTag::FreeflowOneP> { using Scalar = GetPropType<TypeTag, Properties::Scalar>; using type = FluidSystems::OnePLiquid<Scalar, Dumux::Components::SimpleH2O<Scalar> > ; }; template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyOneP> { +struct SpatialParams<TypeTag, TTag::PorousMediumOneP> { using type = OnePSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; }; template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; +struct EnableGridGeometryCache<TypeTag, TTag::FreeflowOneP> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; +struct EnableGridFluxVariablesCache<TypeTag, TTag::FreeflowOneP> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; +struct EnableGridVolumeVariablesCache<TypeTag, TTag::FreeflowOneP> { static constexpr bool value = true; }; } // end namespace Dumux::Properties diff --git a/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh index fca50485..d8ae90cd 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh @@ -21,8 +21,8 @@ * \ingroup NavierStokesTests * \brief A simple Stokes test problem for the staggered grid (Navier-)Stokes model. */ -#ifndef DUMUX_STOKES1P2C_SUBPROBLEM_HH -#define DUMUX_STOKES1P2C_SUBPROBLEM_HH +#ifndef DUMUX_FREEFLOW_MODEL_SUBPROBLEM_HH +#define DUMUX_FREEFLOW_MODEL_SUBPROBLEM_HH #include <dumux/common/properties.hh> #include <dumux/common/boundarytypes.hh> @@ -73,23 +73,13 @@ class FreeFlowSubProblem : public NavierStokesStaggeredProblem<TypeTag> public: FreeFlowSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, std::shared_ptr<CouplingManager> couplingManager) - : ParentType(fvGridGeometry, "Stokes"), eps_(1e-6), couplingManager_(couplingManager) + : ParentType(fvGridGeometry, "Freeflow"), eps_(1e-6), couplingManager_(couplingManager) { velocity_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.Velocity"); pressure_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.Pressure"); moleFraction_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.MoleFraction"); } - - /*! - * \brief Return the sources within the domain. - * - * \param globalPos The global position - */ - NumEqVector sourceAtPos(const GlobalPosition &globalPos) const - { return NumEqVector(0.0); } - - /*! * \brief Specifies which kind of boundary condition should be * used for which equation on a given boundary segment. @@ -176,25 +166,11 @@ public: return values; } - - /*! - * \brief Set the coupling manager - */ - void setCouplingManager(std::shared_ptr<CouplingManager> cm) - { couplingManager_ = cm; } - /*! - * \brief Get the coupling manager + * \brief Evaluate the initial value for a control volume. + * + * \param globalPos The global position */ - const CouplingManager& couplingManager() const - { return *couplingManager_; } - - - /*! - * \brief Evaluate the initial value for a control volume. - * - * \param globalPos The global position - */ PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const { PrimaryVariables values(0.0); @@ -219,6 +195,14 @@ public: return values; } + /*! + * \brief Return the sources within the domain. + * + * \param globalPos The global position + */ + NumEqVector sourceAtPos(const GlobalPosition &globalPos) const + { return NumEqVector(0.0); } + void setTimeLoop(TimeLoopPtr timeLoop) { timeLoop_ = timeLoop; } @@ -226,19 +210,25 @@ public: * \brief Returns the intrinsic permeability of required as input parameter for the Beavers-Joseph-Saffman boundary condition */ Scalar permeability(const Element& element, const SubControlVolumeFace& scvf) const - { - return couplingManager().couplingData().darcyPermeability(element, scvf); - } + { return couplingManager().couplingData().darcyPermeability(element, scvf); } /*! * \brief Returns the alpha value required as input parameter for the Beavers-Joseph-Saffman boundary condition */ Scalar alphaBJ(const SubControlVolumeFace& scvf) const - { - return couplingManager().problem(CouplingManager::darcyIdx).spatialParams().beaversJosephCoeffAtPos(scvf.center()); - } + { return couplingManager().problem(CouplingManager::darcyIdx).spatialParams().beaversJosephCoeffAtPos(scvf.center()); } - // \} + /*! + * \brief Set the coupling manager + */ + void setCouplingManager(std::shared_ptr<CouplingManager> cm) + { couplingManager_ = cm; } + + /*! + * \brief Get the coupling manager + */ + const CouplingManager& couplingManager() const + { return *couplingManager_; } private: bool onLeftBoundary_(const GlobalPosition &globalPos) const diff --git a/exercises/solution/exercise-coupling-ff-pm/models/main.cc b/exercises/solution/exercise-coupling-ff-pm/models/main.cc index f1d4b67a..27d231d9 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/main.cc +++ b/exercises/solution/exercise-coupling-ff-pm/models/main.cc @@ -64,51 +64,51 @@ int main(int argc, char** argv) Parameters::init(argc, argv); // Define the sub problem type tags - using StokesTypeTag = Properties::TTag::StokesNC; - using DarcyTypeTag = Properties::TTag::DarcyOnePNC; + using FreeflowTypeTag = Properties::TTag::FreeflowNC; + using PorousMediumTypeTag = Properties::TTag::PorousMediumOnePNC; // try to create a grid (from the given grid file or the input file) // for both sub-domains - using DarcyGridManager = Dumux::GridManager<GetPropType<DarcyTypeTag, Properties::Grid>>; - DarcyGridManager darcyGridManager; - darcyGridManager.init("Darcy"); // pass parameter group + using PorousMediumGridManager = Dumux::GridManager<GetPropType<PorousMediumTypeTag, Properties::Grid>>; + PorousMediumGridManager porousMediumGridManager; + porousMediumGridManager.init("PorousMedium"); // pass parameter group - using StokesGridManager = Dumux::GridManager<GetPropType<StokesTypeTag, Properties::Grid>>; - StokesGridManager stokesGridManager; - stokesGridManager.init("Stokes"); // pass parameter group + using FreeflowGridManager = Dumux::GridManager<GetPropType<FreeflowTypeTag, Properties::Grid>>; + FreeflowGridManager freeflowGridManager; + freeflowGridManager.init("Freeflow"); // pass parameter group // we compute on the leaf grid view - const auto& darcyGridView = darcyGridManager.grid().leafGridView(); - const auto& stokesGridView = stokesGridManager.grid().leafGridView(); + const auto& porousMediumGridView = porousMediumGridManager.grid().leafGridView(); + const auto& freeflowGridView = freeflowGridManager.grid().leafGridView(); // create the finite volume grid geometry - using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; - auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; - auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); + using FreeflowFVGridGeometry = GetPropType<FreeflowTypeTag, Properties::GridGeometry>; + auto freeflowFvGridGeometry = std::make_shared<FreeflowFVGridGeometry>(freeflowGridView); + using PorousMediumFVGridGeometry = GetPropType<PorousMediumTypeTag, Properties::GridGeometry>; + auto porousMediumFvGridGeometry = std::make_shared<PorousMediumFVGridGeometry>(porousMediumGridView); - using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; + using Traits = StaggeredMultiDomainTraits<FreeflowTypeTag, FreeflowTypeTag, PorousMediumTypeTag>; // the coupling manager using CouplingManager = StokesDarcyCouplingManager<Traits>; - auto couplingManager = std::make_shared<CouplingManager>(stokesFvGridGeometry, darcyFvGridGeometry); + auto couplingManager = std::make_shared<CouplingManager>(freeflowFvGridGeometry, porousMediumFvGridGeometry); // the indices - constexpr auto stokesCellCenterIdx = CouplingManager::stokesCellCenterIdx; - constexpr auto stokesFaceIdx = CouplingManager::stokesFaceIdx; - constexpr auto darcyIdx = CouplingManager::darcyIdx; + constexpr auto freeflowCellCenterIdx = CouplingManager::stokesCellCenterIdx; + constexpr auto freeflowFaceIdx = CouplingManager::stokesFaceIdx; + constexpr auto porousMediumIdx = CouplingManager::darcyIdx; // the problem (initial and boundary conditions) - using StokesProblem = GetPropType<StokesTypeTag, Properties::Problem>; - auto stokesProblem = std::make_shared<StokesProblem>(stokesFvGridGeometry, couplingManager); - using DarcyProblem = GetPropType<DarcyTypeTag, Properties::Problem>; - auto darcyProblem = std::make_shared<DarcyProblem>(darcyFvGridGeometry, couplingManager); + using FreeflowProblem = GetPropType<FreeflowTypeTag, Properties::Problem>; + auto freeflowProblem = std::make_shared<FreeflowProblem>(freeflowFvGridGeometry, couplingManager); + using PorousMediumProblem = GetPropType<PorousMediumTypeTag, Properties::Problem>; + auto porousMediumProblem = std::make_shared<PorousMediumProblem>(porousMediumFvGridGeometry, couplingManager); // initialize the fluidsystem (tabulation) - GetPropType<StokesTypeTag, Properties::FluidSystem>::init(); + GetPropType<FreeflowTypeTag, Properties::FluidSystem>::init(); // get some time loop parameters - using Scalar = GetPropType<StokesTypeTag, Properties::Scalar>; + using Scalar = GetPropType<FreeflowTypeTag, Properties::Scalar>; const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); @@ -116,64 +116,64 @@ int main(int argc, char** argv) // instantiate time loop auto timeLoop = std::make_shared<CheckPointTimeLoop<Scalar>>(0, dt, tEnd); timeLoop->setMaxTimeStepSize(maxDt); - stokesProblem->setTimeLoop(timeLoop); - darcyProblem->setTimeLoop(timeLoop); + freeflowProblem->setTimeLoop(timeLoop); + porousMediumProblem->setTimeLoop(timeLoop); // the solution vector Traits::SolutionVector sol; - sol[stokesCellCenterIdx].resize(stokesFvGridGeometry->numCellCenterDofs()); - sol[stokesFaceIdx].resize(stokesFvGridGeometry->numFaceDofs()); - sol[darcyIdx].resize(darcyFvGridGeometry->numDofs()); + sol[freeflowCellCenterIdx].resize(freeflowFvGridGeometry->numCellCenterDofs()); + sol[freeflowFaceIdx].resize(freeflowFvGridGeometry->numFaceDofs()); + sol[porousMediumIdx].resize(porousMediumFvGridGeometry->numDofs()); - auto stokesSol = partial(sol, stokesFaceIdx, stokesCellCenterIdx); + auto freeflowSol = partial(sol, freeflowFaceIdx, freeflowCellCenterIdx); - stokesProblem->applyInitialSolution(stokesSol); - darcyProblem->applyInitialSolution(sol[darcyIdx]); + freeflowProblem->applyInitialSolution(freeflowSol); + porousMediumProblem->applyInitialSolution(sol[porousMediumIdx]); auto solOld = sol; - couplingManager->init(stokesProblem, darcyProblem, sol); + couplingManager->init(freeflowProblem, porousMediumProblem, sol); // the grid variables - using StokesGridVariables = GetPropType<StokesTypeTag, Properties::GridVariables>; - auto stokesGridVariables = std::make_shared<StokesGridVariables>(stokesProblem, stokesFvGridGeometry); - stokesGridVariables->init(stokesSol); - using DarcyGridVariables = GetPropType<DarcyTypeTag, Properties::GridVariables>; - auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); - darcyGridVariables->init(sol[darcyIdx]); + using FreeflowGridVariables = GetPropType<FreeflowTypeTag, Properties::GridVariables>; + auto freeflowGridVariables = std::make_shared<FreeflowGridVariables>(freeflowProblem, freeflowFvGridGeometry); + freeflowGridVariables->init(freeflowSol); + using PorousMediumGridVariables = GetPropType<PorousMediumTypeTag, Properties::GridVariables>; + auto porousMediumGridVariables = std::make_shared<PorousMediumGridVariables>(porousMediumProblem, porousMediumFvGridGeometry); + porousMediumGridVariables->init(sol[porousMediumIdx]); // initialize the vtk output module #if EXNUMBER >= 1 const std::array<std::string, 3> part = {"a", "b", "c"}; - const auto stokesName = "sol_" + part[EXNUMBER-1] + "_" + getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); - const auto darcyName = "sol_" + part[EXNUMBER-1] + "_" + getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); + const auto freeflowName = "sol_" + part[EXNUMBER-1] + "_" + getParam<std::string>("Problem.Name") + "_" + freeflowProblem->name(); + const auto porousMediumName = "sol_" + part[EXNUMBER-1] + "_" + getParam<std::string>("Problem.Name") + "_" + porousMediumProblem->name(); #else - const auto stokesName = "orig_" + getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); - const auto darcyName = "orig_" + getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); + const auto freeflowName = "orig_" + getParam<std::string>("Problem.Name") + "_" + freeflowProblem->name(); + const auto porousMediumName = "orig_" + getParam<std::string>("Problem.Name") + "_" + porousMediumProblem->name(); #endif - StaggeredVtkOutputModule<StokesGridVariables, decltype(stokesSol)> stokesVtkWriter(*stokesGridVariables, stokesSol, stokesName); - GetPropType<StokesTypeTag, Properties::IOFields>::initOutputModule(stokesVtkWriter); - stokesVtkWriter.write(0); + StaggeredVtkOutputModule<FreeflowGridVariables, decltype(freeflowSol)> freeflowVtkWriter(*freeflowGridVariables, freeflowSol, freeflowName); + GetPropType<FreeflowTypeTag, Properties::IOFields>::initOutputModule(freeflowVtkWriter); + freeflowVtkWriter.write(0); - VtkOutputModule<DarcyGridVariables, GetPropType<DarcyTypeTag, Properties::SolutionVector>> darcyVtkWriter(*darcyGridVariables, sol[darcyIdx], darcyName); - using DarcyVelocityOutput = GetPropType<DarcyTypeTag, Properties::VelocityOutput>; - darcyVtkWriter.addVelocityOutput(std::make_shared<DarcyVelocityOutput>(*darcyGridVariables)); - GetPropType<DarcyTypeTag, Properties::IOFields>::initOutputModule(darcyVtkWriter); - darcyVtkWriter.write(0.0); + VtkOutputModule<PorousMediumGridVariables, GetPropType<PorousMediumTypeTag, Properties::SolutionVector>> porousMediumVtkWriter(*porousMediumGridVariables, sol[porousMediumIdx], porousMediumName); + using PorousMediumVelocityOutput = GetPropType<PorousMediumTypeTag, Properties::VelocityOutput>; + porousMediumVtkWriter.addVelocityOutput(std::make_shared<PorousMediumVelocityOutput>(*porousMediumGridVariables)); + GetPropType<PorousMediumTypeTag, Properties::IOFields>::initOutputModule(porousMediumVtkWriter); + porousMediumVtkWriter.write(0.0); - // initialize the subproblems - darcyProblem->init(sol[darcyIdx], *darcyGridVariables); + // intialize the subproblems + porousMediumProblem->init(sol[porousMediumIdx], *porousMediumGridVariables); // the assembler with time loop for instationary problem using Assembler = MultiDomainFVAssembler<Traits, CouplingManager, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(std::make_tuple(stokesProblem, stokesProblem, darcyProblem), - std::make_tuple(stokesFvGridGeometry->faceFVGridGeometryPtr(), - stokesFvGridGeometry->cellCenterFVGridGeometryPtr(), - darcyFvGridGeometry), - std::make_tuple(stokesGridVariables->faceGridVariablesPtr(), - stokesGridVariables->cellCenterGridVariablesPtr(), - darcyGridVariables), + auto assembler = std::make_shared<Assembler>(std::make_tuple(freeflowProblem, freeflowProblem, porousMediumProblem), + std::make_tuple(freeflowFvGridGeometry->faceFVGridGeometryPtr(), + freeflowFvGridGeometry->cellCenterFVGridGeometryPtr(), + porousMediumFvGridGeometry), + std::make_tuple(freeflowGridVariables->faceGridVariablesPtr(), + freeflowGridVariables->cellCenterGridVariablesPtr(), + porousMediumGridVariables), couplingManager, timeLoop, solOld); @@ -195,20 +195,20 @@ int main(int argc, char** argv) // make the new solution the old solution solOld = sol; - stokesGridVariables->advanceTimeStep(); - darcyGridVariables->advanceTimeStep(); + freeflowGridVariables->advanceTimeStep(); + porousMediumGridVariables->advanceTimeStep(); // advance to the time loop to the next step timeLoop->advanceTimeStep(); // call the postTimeStep routine for output - darcyProblem->postTimeStep(sol[darcyIdx], *darcyGridVariables); + porousMediumProblem->postTimeStep(sol[porousMediumIdx], *porousMediumGridVariables); // write vtk output if (timeLoop->isCheckPoint() || timeLoop->finished() || episodeLength < 0.0) { - stokesVtkWriter.write(timeLoop->time()); - darcyVtkWriter.write(timeLoop->time()); + freeflowVtkWriter.write(timeLoop->time()); + porousMediumVtkWriter.write(timeLoop->time()); } // report statistics of this time step @@ -219,8 +219,8 @@ int main(int argc, char** argv) } while (!timeLoop->finished()); - timeLoop->finalize(stokesGridView.comm()); - timeLoop->finalize(darcyGridView.comm()); + timeLoop->finalize(freeflowGridView.comm()); + timeLoop->finalize(porousMediumGridView.comm()); Parameters::print(); diff --git a/exercises/solution/exercise-coupling-ff-pm/models/params.input b/exercises/solution/exercise-coupling-ff-pm/models/params.input index d2c30bd9..cd8c1c12 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/params.input +++ b/exercises/solution/exercise-coupling-ff-pm/models/params.input @@ -3,16 +3,16 @@ DtInitial = 100 # s EpisodeLength = -360 # s # 0.25 days TEnd = 256000 # s # 2 days -[Stokes.Grid] +[Freeflow.Grid] LowerLeft = 0 1 UpperRight = 1 2 Cells = 16 16 -[Darcy.Grid] +[PorousMedium.Grid] UpperRight = 1 1 Cells = 16 16 -[Stokes.Problem] +[Freeflow.Problem] Name = stokes EnableGravity = true EnableInertiaTerms = true @@ -20,7 +20,7 @@ MoleFraction = 0.0 # - Pressure = 1e5 # Pa Velocity = 1 # m/s -[Darcy.Problem] +[PorousMedium.Problem] Name = darcy EnableGravity = true Saturation = 0.1 # - diff --git a/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh index e49f63bb..56542c60 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh @@ -21,8 +21,8 @@ * * \brief A simple Darcy test problem (cell-centered finite volume method). */ -#ifndef DUMUX_DARCY_SUBPROBLEM_HH -#define DUMUX_DARCY_SUBPROBLEM_HH +#ifndef DUMUX_POROUSMEDIUMFLOW_SUBPROBLEM_HH +#define DUMUX_POROUSMEDIUMFLOW_SUBPROBLEM_HH #include <dumux/common/properties.hh> #include <dumux/common/boundarytypes.hh> @@ -82,7 +82,7 @@ class PorousMediumSubProblem : public PorousMediumFlowProblem<TypeTag> public: PorousMediumSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, std::shared_ptr<CouplingManager> couplingManager) - : ParentType(fvGridGeometry, "Darcy"), eps_(1e-7), couplingManager_(couplingManager) + : ParentType(fvGridGeometry, "PorousMedium"), eps_(1e-7), couplingManager_(couplingManager) { #if EXNUMBER >= 3 saturation_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.Saturation"); @@ -239,14 +239,13 @@ public: } } - /*! - * \brief Specifies which kind of boundary condition should be - * used for which equation on a given boundary control volume. - * - * \param element The element - * \param scvf The boundary sub control volume face - */ + * \brief Specifies which kind of boundary condition should be + * used for which equation on a given boundary control volume. + * + * \param element The element + * \param scvf The boundary sub control volume face + */ BoundaryTypes boundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const { BoundaryTypes values; @@ -299,7 +298,6 @@ public: const SubControlVolume& scv) const { return NumEqVector(0.0); } - /*! * \brief Evaluate the initial value for a control volume. * @@ -310,7 +308,7 @@ public: */ PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const { - static const Scalar stokesPressure = getParamFromGroup<Scalar>("Stokes", "Problem.Pressure"); + static const Scalar stokesPressure = getParamFromGroup<Scalar>("Freeflow", "Problem.Pressure"); PrimaryVariables values(0.0); #if EXNUMBER >= 3 @@ -326,8 +324,6 @@ public: return values; } - // \} - //! Set the coupling manager void setCouplingManager(std::shared_ptr<CouplingManager> cm) { couplingManager_ = cm; } diff --git a/exercises/solution/exercise-coupling-ff-pm/models/properties.hh b/exercises/solution/exercise-coupling-ff-pm/models/properties.hh index aa66bfb1..ca809580 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/properties.hh +++ b/exercises/solution/exercise-coupling-ff-pm/models/properties.hh @@ -57,49 +57,49 @@ namespace Dumux::Properties { // Create new type tags namespace TTag { -struct StokesNC { using InheritsFrom = std::tuple<NavierStokesNC, StaggeredFreeFlowModel>; }; +struct FreeflowNC { using InheritsFrom = std::tuple<NavierStokesNC, StaggeredFreeFlowModel>; }; #if EXNUMBER >= 1 -struct DarcyOnePNC { using InheritsFrom = std::tuple<TwoPNC, CCTpfaModel>; }; +struct PorousMediumOnePNC { using InheritsFrom = std::tuple<TwoPNC, CCTpfaModel>; }; #else -struct DarcyOnePNC { using InheritsFrom = std::tuple<OnePNC, CCTpfaModel>; }; +struct PorousMediumOnePNC { using InheritsFrom = std::tuple<OnePNC, CCTpfaModel>; }; #endif } // end namespace TTag // Set the coupling manager template<class TypeTag> -struct CouplingManager<TypeTag, TTag::StokesNC> +struct CouplingManager<TypeTag, TTag::FreeflowNC> { - using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::DarcyOnePNC>; + using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::PorousMediumOnePNC>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; template<class TypeTag> -struct CouplingManager<TypeTag, TTag::DarcyOnePNC> +struct CouplingManager<TypeTag, TTag::PorousMediumOnePNC> { - using Traits = StaggeredMultiDomainTraits<Properties::TTag::StokesNC, Properties::TTag::StokesNC, TypeTag>; + using Traits = StaggeredMultiDomainTraits<Properties::TTag::FreeflowNC, Properties::TTag::FreeflowNC, TypeTag>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; // Set the problem property template<class TypeTag> -struct Problem<TypeTag, TTag::StokesNC> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; +struct Problem<TypeTag, TTag::FreeflowNC> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; template<class TypeTag> -struct Problem<TypeTag, TTag::DarcyOnePNC> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; +struct Problem<TypeTag, TTag::PorousMediumOnePNC> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; // Set the grid type template<class TypeTag> -struct Grid<TypeTag, TTag::StokesNC> { using type = Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; +struct Grid<TypeTag, TTag::FreeflowNC> { using type = Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; template<class TypeTag> -struct Grid<TypeTag, TTag::DarcyOnePNC> { using type = Dune::YaspGrid<2>; }; +struct Grid<TypeTag, TTag::PorousMediumOnePNC> { using type = Dune::YaspGrid<2>; }; // The fluid system template<class TypeTag> -struct FluidSystem<TypeTag, TTag::StokesNC> +struct FluidSystem<TypeTag, TTag::FreeflowNC> { using H2OAir = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; using type = FluidSystems::OnePAdapter<H2OAir, H2OAir::gasPhaseIdx>; }; template<class TypeTag> -struct FluidSystem<TypeTag, TTag::DarcyOnePNC> +struct FluidSystem<TypeTag, TTag::PorousMediumOnePNC> { using H2OAir = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; #if EXNUMBER == 0 @@ -111,47 +111,47 @@ struct FluidSystem<TypeTag, TTag::DarcyOnePNC> // Do not replace one equation with a total mass balance template<class TypeTag> -struct ReplaceCompEqIdx<TypeTag, TTag::StokesNC> { static constexpr int value = 3; }; +struct ReplaceCompEqIdx<TypeTag, TTag::FreeflowNC> { static constexpr int value = 3; }; template<class TypeTag> -struct ReplaceCompEqIdx<TypeTag, TTag::DarcyOnePNC> { static constexpr int value = 3; }; +struct ReplaceCompEqIdx<TypeTag, TTag::PorousMediumOnePNC> { static constexpr int value = 3; }; // Use formulation based on mass fractions template<class TypeTag> -struct UseMoles<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; +struct UseMoles<TypeTag, TTag::FreeflowNC> { static constexpr bool value = true; }; template<class TypeTag> -struct UseMoles<TypeTag, TTag::DarcyOnePNC> { static constexpr bool value = true; }; +struct UseMoles<TypeTag, TTag::PorousMediumOnePNC> { static constexpr bool value = true; }; #if EXNUMBER >= 1 //! Set the default formulation to pw-Sn: This can be over written in the problem. template<class TypeTag> -struct Formulation<TypeTag, TTag::DarcyOnePNC> +struct Formulation<TypeTag, TTag::PorousMediumOnePNC> { static constexpr auto value = TwoPFormulation::p1s0; }; #endif // Set the spatial parameters type #if EXNUMBER >= 1 template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyOnePNC> { +struct SpatialParams<TypeTag, TTag::PorousMediumOnePNC> { using type = TwoPSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; }; #else template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyOnePNC> { +struct SpatialParams<TypeTag, TTag::PorousMediumOnePNC> { using type = OnePSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; }; #endif //! Use a model with constant tortuosity for the effective diffusivity template<class TypeTag> -struct EffectiveDiffusivityModel<TypeTag, TTag::DarcyOnePNC> +struct EffectiveDiffusivityModel<TypeTag, TTag::PorousMediumOnePNC> { using type = DiffusivityConstantTortuosity<GetPropType<TypeTag, Properties::Scalar>>; }; template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; +struct EnableGridGeometryCache<TypeTag, TTag::FreeflowNC> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; +struct EnableGridFluxVariablesCache<TypeTag, TTag::FreeflowNC> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; +struct EnableGridVolumeVariablesCache<TypeTag, TTag::FreeflowNC> { static constexpr bool value = true; }; } //end namespace Dumux::Properties diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh index 6257675c..41fae5c3 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh @@ -20,8 +20,8 @@ * \file * \brief The free-flow sub problem */ -#ifndef DUMUX_FREEFLOW1P2C_SUBPROBLEM_HH -#define DUMUX_FREEFLOW1P2C_SUBPROBLEM_HH +#ifndef DUMUX_FREEFLOW_TURBULENCE_SUBPROBLEM_HH +#define DUMUX_FREEFLOW_TURBULENCE_SUBPROBLEM_HH #if EXNUMBER >= 1 #include <dumux/freeflow/rans/problem.hh> @@ -100,15 +100,6 @@ public: getParamFromGroup<std::string>(this->paramGroup(), "Problem.InterfaceDiffusionCoefficientAvg")); } - /*! - * \brief Return the sources within the domain. - * - * \param globalPos The global position - */ - NumEqVector sourceAtPos(const GlobalPosition &globalPos) const - { return NumEqVector(0.0); } - - /*! * \brief Specifies which kind of boundary condition should be * used for which equation on a given boundary segment. @@ -223,6 +214,14 @@ public: return values; } + /*! + * \brief Return the sources within the domain. + * + * \param globalPos The global position + */ + NumEqVector sourceAtPos(const GlobalPosition &globalPos) const + { return NumEqVector(0.0); } + /*! * \brief Evaluate the initial value for a control volume. * @@ -268,7 +267,6 @@ public: const Scalar refTemperature() const { return refTemperature_; } - void setTimeLoop(TimeLoopPtr timeLoop) { timeLoop_ = timeLoop; } @@ -276,17 +274,13 @@ public: * \brief Returns the intrinsic permeability of required as input parameter for the Beavers-Joseph-Saffman boundary condition */ Scalar permeability(const Element& element, const SubControlVolumeFace& scvf) const - { - return couplingManager().problem(CouplingManager::darcyIdx).spatialParams().permeabilityAtPos(scvf.center()); - } + { return couplingManager().problem(CouplingManager::darcyIdx).spatialParams().permeabilityAtPos(scvf.center()); } /*! * \brief Returns the alpha value required as input parameter for the Beavers-Joseph-Saffman boundary condition */ Scalar alphaBJ(const SubControlVolumeFace& scvf) const - { - return couplingManager().problem(CouplingManager::darcyIdx).spatialParams().beaversJosephCoeffAtPos(scvf.center()); - } + { return couplingManager().problem(CouplingManager::darcyIdx).spatialParams().beaversJosephCoeffAtPos(scvf.center()); } /*! * \brief Set the coupling manager diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc b/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc index c8974ad8..ad0470ad 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc @@ -62,51 +62,51 @@ int main(int argc, char** argv) Parameters::init(argc, argv); // Define the sub problem type tags - using StokesTypeTag = Properties::TTag::StokesZeroEq; - using DarcyTypeTag = Properties::TTag::DarcyTwoPTwoCNI; + using FreeflowTypeTag = Properties::TTag::FreeflowModel; + using PorousMediumTypeTag = Properties::TTag::PorousMediumModel; // try to create a grid (from the given grid file or the input file) // for both sub-domains - using DarcyGridManager = Dumux::GridManager<GetPropType<DarcyTypeTag, Properties::Grid>>; - DarcyGridManager darcyGridManager; - darcyGridManager.init("Darcy"); // pass parameter group + using PorousMediumGridManager = Dumux::GridManager<GetPropType<PorousMediumTypeTag, Properties::Grid>>; + PorousMediumGridManager porousMediumGridManager; + porousMediumGridManager.init("PorousMedium"); // pass parameter group - using StokesGridManager = Dumux::GridManager<GetPropType<StokesTypeTag, Properties::Grid>>; - StokesGridManager stokesGridManager; - stokesGridManager.init("Stokes"); // pass parameter group + using FreeflowGridManager = Dumux::GridManager<GetPropType<FreeflowTypeTag, Properties::Grid>>; + FreeflowGridManager freeflowGridManager; + freeflowGridManager.init("Freeflow"); // pass parameter group // we compute on the leaf grid view - const auto& darcyGridView = darcyGridManager.grid().leafGridView(); - const auto& stokesGridView = stokesGridManager.grid().leafGridView(); + const auto& porousMediumGridView = porousMediumGridManager.grid().leafGridView(); + const auto& freeflowGridView = freeflowGridManager.grid().leafGridView(); // create the finite volume grid geometry - using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; - auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; - auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); + using FreeflowFVGridGeometry = GetPropType<FreeflowTypeTag, Properties::GridGeometry>; + auto freeflowFvGridGeometry = std::make_shared<FreeflowFVGridGeometry>(freeflowGridView); + using PorousMediumFVGridGeometry = GetPropType<PorousMediumTypeTag, Properties::GridGeometry>; + auto porousMediumFvGridGeometry = std::make_shared<PorousMediumFVGridGeometry>(porousMediumGridView); - using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; + using Traits = StaggeredMultiDomainTraits<FreeflowTypeTag, FreeflowTypeTag, PorousMediumTypeTag>; // the coupling manager using CouplingManager = StokesDarcyCouplingManager<Traits>; - auto couplingManager = std::make_shared<CouplingManager>(stokesFvGridGeometry, darcyFvGridGeometry); + auto couplingManager = std::make_shared<CouplingManager>(freeflowFvGridGeometry, porousMediumFvGridGeometry); // the indices - constexpr auto stokesCellCenterIdx = CouplingManager::stokesCellCenterIdx; - constexpr auto stokesFaceIdx = CouplingManager::stokesFaceIdx; - constexpr auto darcyIdx = CouplingManager::darcyIdx; + constexpr auto freeflowCellCenterIdx = CouplingManager::stokesCellCenterIdx; + constexpr auto freeflowFaceIdx = CouplingManager::stokesFaceIdx; + constexpr auto porousMediumIdx = CouplingManager::darcyIdx; // the problem (initial and boundary conditions) - using StokesProblem = GetPropType<StokesTypeTag, Properties::Problem>; - auto stokesProblem = std::make_shared<StokesProblem>(stokesFvGridGeometry, couplingManager); - using DarcyProblem = GetPropType<DarcyTypeTag, Properties::Problem>; - auto darcyProblem = std::make_shared<DarcyProblem>(darcyFvGridGeometry, couplingManager); + using FreeflowProblem = GetPropType<FreeflowTypeTag, Properties::Problem>; + auto freeflowProblem = std::make_shared<FreeflowProblem>(freeflowFvGridGeometry, couplingManager); + using PorousMediumProblem = GetPropType<PorousMediumTypeTag, Properties::Problem>; + auto porousMediumProblem = std::make_shared<PorousMediumProblem>(porousMediumFvGridGeometry, couplingManager); // initialize the fluidsystem (tabulation) - GetPropType<StokesTypeTag, Properties::FluidSystem>::init(); + GetPropType<FreeflowTypeTag, Properties::FluidSystem>::init(); // get some time loop parameters - using Scalar = GetPropType<StokesTypeTag, Properties::Scalar>; + using Scalar = GetPropType<FreeflowTypeTag, Properties::Scalar>; const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); @@ -116,61 +116,61 @@ int main(int argc, char** argv) timeLoop->setMaxTimeStepSize(maxDt); // set timeloop for the subproblems, needed for boundary value variations - stokesProblem->setTimeLoop(timeLoop); - darcyProblem->setTimeLoop(timeLoop); + freeflowProblem->setTimeLoop(timeLoop); + porousMediumProblem->setTimeLoop(timeLoop); // the solution vector Traits::SolutionVector sol; - sol[stokesCellCenterIdx].resize(stokesFvGridGeometry->numCellCenterDofs()); - sol[stokesFaceIdx].resize(stokesFvGridGeometry->numFaceDofs()); - sol[darcyIdx].resize(darcyFvGridGeometry->numDofs()); + sol[freeflowCellCenterIdx].resize(freeflowFvGridGeometry->numCellCenterDofs()); + sol[freeflowFaceIdx].resize(freeflowFvGridGeometry->numFaceDofs()); + sol[porousMediumIdx].resize(porousMediumFvGridGeometry->numDofs()); - auto stokesSol = partial(sol, stokesFaceIdx, stokesCellCenterIdx); + auto freeflowSol = partial(sol, freeflowFaceIdx, freeflowCellCenterIdx); - stokesProblem->applyInitialSolution(stokesSol); - darcyProblem->applyInitialSolution(sol[darcyIdx]); + freeflowProblem->applyInitialSolution(freeflowSol); + porousMediumProblem->applyInitialSolution(sol[porousMediumIdx]); auto solOld = sol; - couplingManager->init(stokesProblem, darcyProblem, sol); + couplingManager->init(freeflowProblem, porousMediumProblem, sol); // TODO: update static wall properties // TODO: update dynamic wall properties #if EXNUMBER >= 1 - stokesProblem->updateStaticWallProperties(); - stokesProblem->updateDynamicWallProperties(stokesSol); + freeflowProblem->updateStaticWallProperties(); + freeflowProblem->updateDynamicWallProperties(freeflowSol); #endif // the grid variables - using StokesGridVariables = GetPropType<StokesTypeTag, Properties::GridVariables>; - auto stokesGridVariables = std::make_shared<StokesGridVariables>(stokesProblem, stokesFvGridGeometry); - stokesGridVariables->init(stokesSol); - using DarcyGridVariables = GetPropType<DarcyTypeTag, Properties::GridVariables>; - auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); - darcyGridVariables->init(sol[darcyIdx]); - - // initialize the vtk output module - const auto stokesName = getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); - const auto darcyName = getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); - - StaggeredVtkOutputModule<StokesGridVariables, decltype(stokesSol)> stokesVtkWriter(*stokesGridVariables, stokesSol, stokesName); - GetPropType<StokesTypeTag, Properties::IOFields>::initOutputModule(stokesVtkWriter); - stokesVtkWriter.write(0.0); - - VtkOutputModule<DarcyGridVariables, GetPropType<DarcyTypeTag, Properties::SolutionVector>> darcyVtkWriter(*darcyGridVariables, sol[darcyIdx], darcyName); - using DarcyVelocityOutput = GetPropType<DarcyTypeTag, Properties::VelocityOutput>; - darcyVtkWriter.addVelocityOutput(std::make_shared<DarcyVelocityOutput>(*darcyGridVariables)); - GetPropType<DarcyTypeTag, Properties::IOFields>::initOutputModule(darcyVtkWriter); - darcyVtkWriter.write(0.0); + using FreeflowGridVariables = GetPropType<FreeflowTypeTag, Properties::GridVariables>; + auto freeflowGridVariables = std::make_shared<FreeflowGridVariables>(freeflowProblem, freeflowFvGridGeometry); + freeflowGridVariables->init(freeflowSol); + using PorousMediumGridVariables = GetPropType<PorousMediumTypeTag, Properties::GridVariables>; + auto porousMediumGridVariables = std::make_shared<PorousMediumGridVariables>(porousMediumProblem, porousMediumFvGridGeometry); + porousMediumGridVariables->init(sol[porousMediumIdx]); + + // intialize the vtk output module + const auto freeflowName = getParam<std::string>("Problem.Name") + "_" + freeflowProblem->name(); + const auto porousMediumName = getParam<std::string>("Problem.Name") + "_" + porousMediumProblem->name(); + + StaggeredVtkOutputModule<FreeflowGridVariables, decltype(freeflowSol)> freeflowVtkWriter(*freeflowGridVariables, freeflowSol, freeflowName); + GetPropType<FreeflowTypeTag, Properties::IOFields>::initOutputModule(freeflowVtkWriter); + freeflowVtkWriter.write(0.0); + + VtkOutputModule<PorousMediumGridVariables, GetPropType<PorousMediumTypeTag, Properties::SolutionVector>> porousMediumVtkWriter(*porousMediumGridVariables, sol[porousMediumIdx], porousMediumName); + using PorousMediumVelocityOutput = GetPropType<PorousMediumTypeTag, Properties::VelocityOutput>; + porousMediumVtkWriter.addVelocityOutput(std::make_shared<PorousMediumVelocityOutput>(*porousMediumGridVariables)); + GetPropType<PorousMediumTypeTag, Properties::IOFields>::initOutputModule(porousMediumVtkWriter); + porousMediumVtkWriter.write(0.0); // the assembler with time loop for instationary problem using Assembler = MultiDomainFVAssembler<Traits, CouplingManager, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(std::make_tuple(stokesProblem, stokesProblem, darcyProblem), - std::make_tuple(stokesFvGridGeometry->faceFVGridGeometryPtr(), - stokesFvGridGeometry->cellCenterFVGridGeometryPtr(), - darcyFvGridGeometry), - std::make_tuple(stokesGridVariables->faceGridVariablesPtr(), - stokesGridVariables->cellCenterGridVariablesPtr(), - darcyGridVariables), + auto assembler = std::make_shared<Assembler>(std::make_tuple(freeflowProblem, freeflowProblem, porousMediumProblem), + std::make_tuple(freeflowFvGridGeometry->faceFVGridGeometryPtr(), + freeflowFvGridGeometry->cellCenterFVGridGeometryPtr(), + porousMediumFvGridGeometry), + std::make_tuple(freeflowGridVariables->faceGridVariablesPtr(), + freeflowGridVariables->cellCenterGridVariablesPtr(), + porousMediumGridVariables), couplingManager, timeLoop, solOld); @@ -193,22 +193,22 @@ int main(int argc, char** argv) #if EXNUMBER >= 1 // TODO: update dynamic wall properties - stokesProblem->updateDynamicWallProperties(stokesSol); + freeflowProblem->updateDynamicWallProperties(freeflowSol); #endif - // post time step treatment of Darcy problem - darcyProblem->postTimeStep(sol[darcyIdx], *darcyGridVariables, timeLoop->timeStepSize()); + // post time step treatment of PorousMedium problem + porousMediumProblem->postTimeStep(sol[porousMediumIdx], *porousMediumGridVariables, timeLoop->timeStepSize()); // advance grid variables to the next time step - stokesGridVariables->advanceTimeStep(); - darcyGridVariables->advanceTimeStep(); + freeflowGridVariables->advanceTimeStep(); + porousMediumGridVariables->advanceTimeStep(); // advance to the time loop to the next step timeLoop->advanceTimeStep(); // write vtk output - stokesVtkWriter.write(timeLoop->time()); - darcyVtkWriter.write(timeLoop->time()); + freeflowVtkWriter.write(timeLoop->time()); + porousMediumVtkWriter.write(timeLoop->time()); // report statistics of this time step timeLoop->reportTimeStep(); @@ -218,8 +218,8 @@ int main(int argc, char** argv) } while (!timeLoop->finished()); - timeLoop->finalize(stokesGridView.comm()); - timeLoop->finalize(darcyGridView.comm()); + timeLoop->finalize(freeflowGridView.comm()); + timeLoop->finalize(porousMediumGridView.comm()); Parameters::print(); diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/params.input b/exercises/solution/exercise-coupling-ff-pm/turbulence/params.input index 5ab29c8c..0769cc10 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/params.input +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/params.input @@ -3,7 +3,7 @@ DtInitial = 1e-1 # [s] MaxTimeStepSize = 43200 # [s] (12 hours) TEnd = 864000 # [s] (6 days) -[Stokes.Grid] +[Freeflow.Grid] Positions0 = 0.0 0.25 Positions1 = 0.25 0.5 Grading0 = 1.0 @@ -12,7 +12,7 @@ Cells0 = 15 Cells1 = 20 Verbosity = true -[Darcy.Grid] +[PorousMedium.Grid] Positions0 = 0.0 0.25 Positions1 = 0.0 0.25 Cells0 = 15 @@ -21,16 +21,16 @@ Grading0 = 1.0 Grading1 = 1.0 Verbosity = true -[Stokes.Problem] -Name = stokes +[Freeflow.Problem] +Name = freeflow RefVelocity = 3.5 # [m/s] RefPressure = 1e5 # [Pa] refMoleFrac = 0 # [-] RefTemperature = 298.15 # [K] EnableInertiaTerms = true -[Darcy.Problem] -Name = darcy +[PorousMedium.Problem] +Name = porousmedium Pressure = 1e5 Saturation = 0.5 # initial Sw Temperature = 298.15 # [K] diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh index 5aa968b3..f7fd1fd8 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh @@ -21,8 +21,8 @@ * * \brief The porous medium sub problem */ -#ifndef DUMUX_DARCY2P2C_SUBPROBLEM_HH -#define DUMUX_DARCY2P2C_SUBPROBLEM_HH +#ifndef DUMUX_POROUSMEDIUMFLOW2P2C_SUBPROBLEM_HH +#define DUMUX_POROUSMEDIUMFLOW2P2C_SUBPROBLEM_HH #include <dumux/common/properties.hh> #include <dumux/common/boundarytypes.hh> @@ -209,8 +209,6 @@ public: const SubControlVolume &scv) const { return NumEqVector(0.0); } - // \} - /*! * \brief Evaluate the initial value for a control volume. * @@ -229,8 +227,6 @@ public: return values; } - // \} - /*! * \brief Set the coupling manager */ diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/properties.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/properties.hh index d0108365..5389371e 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/properties.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/properties.hh @@ -54,78 +54,78 @@ namespace Dumux::Properties { // Create new type tags namespace TTag { -struct DarcyTwoPTwoCNI { using InheritsFrom = std::tuple<TwoPTwoCNI, CCTpfaModel>; }; +struct PorousMediumModel { using InheritsFrom = std::tuple<TwoPTwoCNI, CCTpfaModel>; }; #if EXNUMBER >= 1 -struct StokesZeroEq { using InheritsFrom = std::tuple<ZeroEqNCNI, StaggeredFreeFlowModel>; }; +struct FreeflowModel { using InheritsFrom = std::tuple<ZeroEqNCNI, StaggeredFreeFlowModel>; }; #else -struct StokesZeroEq { using InheritsFrom = std::tuple<NavierStokesNCNI, StaggeredFreeFlowModel>; }; +struct FreeflowModel { using InheritsFrom = std::tuple<NavierStokesNCNI, StaggeredFreeFlowModel>; }; #endif } // end namespace TTag // Set the coupling manager template<class TypeTag> -struct CouplingManager<TypeTag, TTag::StokesZeroEq> +struct CouplingManager<TypeTag, TTag::FreeflowModel> { - using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::DarcyTwoPTwoCNI>; + using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::PorousMediumModel>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; template<class TypeTag> -struct CouplingManager<TypeTag, TTag::DarcyTwoPTwoCNI> +struct CouplingManager<TypeTag, TTag::PorousMediumModel> { - using Traits = StaggeredMultiDomainTraits<Properties::TTag::StokesZeroEq, Properties::TTag::StokesZeroEq, TypeTag>; + using Traits = StaggeredMultiDomainTraits<Properties::TTag::FreeflowModel, Properties::TTag::FreeflowModel, TypeTag>; using type = Dumux::StokesDarcyCouplingManager<Traits>; }; // Set the problem property template<class TypeTag> -struct Problem<TypeTag, TTag::StokesZeroEq> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; +struct Problem<TypeTag, TTag::FreeflowModel> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; template<class TypeTag> -struct Problem<TypeTag, TTag::DarcyTwoPTwoCNI> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; +struct Problem<TypeTag, TTag::PorousMediumModel> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; // Set the grid type template<class TypeTag> -struct Grid<TypeTag, TTag::StokesZeroEq> { using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; +struct Grid<TypeTag, TTag::FreeflowModel> { using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; template<class TypeTag> -struct Grid<TypeTag, TTag::DarcyTwoPTwoCNI> { using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; +struct Grid<TypeTag, TTag::PorousMediumModel> { using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; // The fluid system template<class TypeTag> -struct FluidSystem<TypeTag, TTag::StokesZeroEq> +struct FluidSystem<TypeTag, TTag::FreeflowModel> { using H2OAir = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; static constexpr auto phaseIdx = H2OAir::gasPhaseIdx; // simulate the air phase using type = FluidSystems::OnePAdapter<H2OAir, phaseIdx>; }; template<class TypeTag> -struct FluidSystem<TypeTag, TTag::DarcyTwoPTwoCNI> { using type = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; }; +struct FluidSystem<TypeTag, TTag::PorousMediumModel> { using type = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; }; // The gas component balance (air) is replaced by the total mass balance template<class TypeTag> -struct ReplaceCompEqIdx<TypeTag, TTag::DarcyTwoPTwoCNI> { static constexpr int value = 3; }; +struct ReplaceCompEqIdx<TypeTag, TTag::PorousMediumModel> { static constexpr int value = 3; }; template<class TypeTag> -struct ReplaceCompEqIdx<TypeTag, TTag::StokesZeroEq> { static constexpr int value = 3; }; +struct ReplaceCompEqIdx<TypeTag, TTag::FreeflowModel> { static constexpr int value = 3; }; // Use formulation based on mass fractions template<class TypeTag> -struct UseMoles<TypeTag, TTag::StokesZeroEq> { static constexpr bool value = true; }; +struct UseMoles<TypeTag, TTag::FreeflowModel> { static constexpr bool value = true; }; template<class TypeTag> -struct UseMoles<TypeTag, TTag::DarcyTwoPTwoCNI> { static constexpr bool value = true; }; +struct UseMoles<TypeTag, TTag::PorousMediumModel> { static constexpr bool value = true; }; //! Set the default formulation to pw-Sn: This can be over written in the problem. template<class TypeTag> -struct Formulation<TypeTag, TTag::DarcyTwoPTwoCNI> +struct Formulation<TypeTag, TTag::PorousMediumModel> { static constexpr auto value = TwoPFormulation::p1s0; }; template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyTwoPTwoCNI> +struct SpatialParams<TypeTag, TTag::PorousMediumModel> { using type = TwoPSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; }; template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::StokesZeroEq> { static constexpr bool value = true; }; +struct EnableGridGeometryCache<TypeTag, TTag::FreeflowModel> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::StokesZeroEq> { static constexpr bool value = true; }; +struct EnableGridFluxVariablesCache<TypeTag, TTag::FreeflowModel> { static constexpr bool value = true; }; template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::StokesZeroEq> { static constexpr bool value = true; }; +struct EnableGridVolumeVariablesCache<TypeTag, TTag::FreeflowModel> { static constexpr bool value = true; }; } //end namespace Dumux::Properties -- GitLab