From ce5fa54265472c6a042e80924a08bdae785178a5 Mon Sep 17 00:00:00 2001 From: Anna Mareike Kostelecky <anmako96@web.de> Date: Wed, 17 Jul 2024 12:31:54 +0000 Subject: [PATCH] [ex][coupling_ff-pm] adapt exercises and solutions to have similar structure --- .patches/exercise-basic/exercise-basic.patch | 27 +-- .../exercise-coupling-ff-pm.patch | 227 ++++++++---------- .../exercise-dunemodule.patch | 3 +- .patches/exercise-grids/exercise-grids.patch | 23 +- .../exercise-mainfile/exercise-mainfile.patch | 22 +- .../exercise-runtimeparams.patch | 27 +-- exercises/exercise-basic/CMakeLists.txt | 2 +- exercises/exercise-basic/README.md | 2 +- exercises/exercise-coupling-ff-pm/README.md | 2 +- .../interface/porousmediumsubproblem.hh | 8 +- .../interface/properties.hh | 4 + .../interface/readme.md | 2 +- .../models/params.input | 2 +- .../models/porousmediumsubproblem.hh | 10 +- .../models/properties.hh | 10 +- .../exercise-coupling-ff-pm/models/readme.md | 2 +- .../turbulence/freeflowsubproblem.hh | 3 +- .../turbulence/properties.hh | 2 +- exercises/exercise-dunemodule/README.md | 2 +- exercises/exercise-grids/params.input | 2 +- .../exercise_mainfile_c.input | 2 +- .../exercise-coupling-ff-pm/interface/main.cc | 2 +- .../interface/porousmediumsubproblem.hh | 3 +- .../models/porousmediumsubproblem.hh | 8 +- .../turbulence/freeflowsubproblem.hh | 2 - .../turbulence/main.cc | 7 +- .../exercise_mainfile_a_solution.input | 2 +- .../exercise-runtimeparams/params.input | 2 +- 28 files changed, 187 insertions(+), 223 deletions(-) diff --git a/.patches/exercise-basic/exercise-basic.patch b/.patches/exercise-basic/exercise-basic.patch index 7160d480..5b19ef06 100644 --- a/.patches/exercise-basic/exercise-basic.patch +++ b/.patches/exercise-basic/exercise-basic.patch @@ -1,5 +1,5 @@ diff -ruN exercises/exercise-basic/2pmain.cc exercises/solution/exercise-basic/2pmain.cc ---- exercises/exercise-basic/2pmain.cc 2024-07-17 11:27:28.866348938 +0200 +--- exercises/exercise-basic/2pmain.cc 2024-07-17 13:58:18.204850249 +0200 +++ exercises/solution/exercise-basic/2pmain.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,145 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- @@ -149,7 +149,7 @@ diff -ruN exercises/exercise-basic/2pmain.cc exercises/solution/exercise-basic/2 -} // end main diff -ruN exercises/exercise-basic/2pnimain.cc exercises/solution/exercise-basic/2pnimain.cc --- exercises/exercise-basic/2pnimain.cc 1970-01-01 01:00:00.000000000 +0100 -+++ exercises/solution/exercise-basic/2pnimain.cc 2024-07-17 11:27:28.878349199 +0200 ++++ exercises/solution/exercise-basic/2pnimain.cc 2024-07-17 13:58:18.212850366 +0200 @@ -0,0 +1,138 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: @@ -290,8 +290,8 @@ diff -ruN exercises/exercise-basic/2pnimain.cc exercises/solution/exercise-basic + return 0; +} // end main diff -ruN exercises/exercise-basic/CMakeLists.txt exercises/solution/exercise-basic/CMakeLists.txt ---- exercises/exercise-basic/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 -+++ exercises/solution/exercise-basic/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 +--- exercises/exercise-basic/CMakeLists.txt 2024-07-17 14:10:30.239561158 +0200 ++++ exercises/solution/exercise-basic/CMakeLists.txt 2024-07-17 14:11:44.100637927 +0200 @@ -1,12 +1,9 @@ # SPDX-FileCopyrightInfo: Copyright © DuMux-Course contributors, see AUTHORS.md in root folder # SPDX-License-Identifier: GPL-3.0-or-later @@ -307,12 +307,10 @@ diff -ruN exercises/exercise-basic/CMakeLists.txt exercises/solution/exercise-ba + SOURCES 2pnimain.cc) # add a symlink for each input file --add_input_file_links() -\ No newline at end of file -+add_input_file_links() + add_input_file_links() diff -ruN exercises/exercise-basic/injection2pniproblem.hh exercises/solution/exercise-basic/injection2pniproblem.hh ---- exercises/exercise-basic/injection2pniproblem.hh 2024-07-17 11:27:28.866348938 +0200 -+++ exercises/solution/exercise-basic/injection2pniproblem.hh 2024-07-17 11:27:28.878349199 +0200 +--- exercises/exercise-basic/injection2pniproblem.hh 2024-07-17 13:58:18.208850308 +0200 ++++ exercises/solution/exercise-basic/injection2pniproblem.hh 2024-07-17 13:58:18.212850366 +0200 @@ -7,7 +7,7 @@ /*! * \file @@ -403,7 +401,7 @@ diff -ruN exercises/exercise-basic/injection2pniproblem.hh exercises/solution/ex } diff -ruN exercises/exercise-basic/injection2pproblem.hh exercises/solution/exercise-basic/injection2pproblem.hh ---- exercises/exercise-basic/injection2pproblem.hh 2024-07-17 11:27:28.866348938 +0200 +--- exercises/exercise-basic/injection2pproblem.hh 2024-07-17 13:58:18.208850308 +0200 +++ exercises/solution/exercise-basic/injection2pproblem.hh 1970-01-01 01:00:00.000000000 +0100 @@ -1,211 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- @@ -633,7 +631,7 @@ diff -ruN exercises/exercise-basic/params.input exercises/solution/exercise-basi +SolidThermalConductivity = 2.8 # solid thermal conducitivity of granite +SolidHeatCapacity = 790 # solid heat capacity of granite diff -ruN exercises/exercise-basic/properties2p.hh exercises/solution/exercise-basic/properties2p.hh ---- exercises/exercise-basic/properties2p.hh 2024-07-17 11:27:28.866348938 +0200 +--- exercises/exercise-basic/properties2p.hh 2024-07-17 13:58:18.208850308 +0200 +++ exercises/solution/exercise-basic/properties2p.hh 1970-01-01 01:00:00.000000000 +0100 @@ -1,63 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- @@ -700,8 +698,8 @@ diff -ruN exercises/exercise-basic/properties2p.hh exercises/solution/exercise-b - -#endif diff -ruN exercises/exercise-basic/properties2pni.hh exercises/solution/exercise-basic/properties2pni.hh ---- exercises/exercise-basic/properties2pni.hh 2024-07-17 11:27:28.866348938 +0200 -+++ exercises/solution/exercise-basic/properties2pni.hh 2024-07-17 11:27:28.878349199 +0200 +--- exercises/exercise-basic/properties2pni.hh 2024-07-17 13:58:18.208850308 +0200 ++++ exercises/solution/exercise-basic/properties2pni.hh 2024-07-17 13:58:18.212850366 +0200 @@ -24,13 +24,9 @@ namespace Dumux::Properties { @@ -718,7 +716,7 @@ diff -ruN exercises/exercise-basic/properties2pni.hh exercises/solution/exercise } // end namespace TTag diff -ruN exercises/exercise-basic/README.md exercises/solution/exercise-basic/README.md ---- exercises/exercise-basic/README.md 2024-07-17 10:58:43.885582971 +0200 +--- exercises/exercise-basic/README.md 2024-07-17 14:11:07.348102188 +0200 +++ exercises/solution/exercise-basic/README.md 1970-01-01 01:00:00.000000000 +0100 @@ -1,94 +0,0 @@ -# Exercise Basics (DuMuX course) @@ -815,4 +813,3 @@ diff -ruN exercises/exercise-basic/README.md exercises/solution/exercise-basic/R -<img src="https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/master/exercises/extradoc/exercise1_nonisothermal.png" width="800"> - -The non-isothermal model requires additional parameters like the thermal conductivity of the solid component. They are already implemented and set in `params.input`, you just need to _uncomment_ them. -\ No newline at end of file diff --git a/.patches/exercise-coupling-ff-pm/exercise-coupling-ff-pm.patch b/.patches/exercise-coupling-ff-pm/exercise-coupling-ff-pm.patch index b0af88fb..31522747 100644 --- a/.patches/exercise-coupling-ff-pm/exercise-coupling-ff-pm.patch +++ b/.patches/exercise-coupling-ff-pm/exercise-coupling-ff-pm.patch @@ -1,6 +1,6 @@ diff -ruN exercises/exercise-coupling-ff-pm/interface/CMakeLists.txt exercises/solution/exercise-coupling-ff-pm/interface/CMakeLists.txt ---- exercises/exercise-coupling-ff-pm/interface/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/interface/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 +--- exercises/exercise-coupling-ff-pm/interface/CMakeLists.txt 2024-07-17 13:58:18.208850308 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/interface/CMakeLists.txt 2024-07-17 13:58:18.216850425 +0200 @@ -1,10 +1,30 @@ # SPDX-FileCopyrightInfo: Copyright © DuMux-Course contributors, see AUTHORS.md in root folder # SPDX-License-Identifier: GPL-3.0-or-later @@ -36,8 +36,8 @@ diff -ruN exercises/exercise-coupling-ff-pm/interface/CMakeLists.txt exercises/s # add a symlink for each input file add_input_file_links() diff -ruN exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh ---- exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh 2024-07-17 11:27:28.870349025 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh 2024-07-17 11:27:28.882349286 +0200 +--- exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh 2024-07-17 13:58:18.208850308 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh 2024-07-17 13:58:18.216850425 +0200 @@ -71,8 +71,7 @@ const auto& globalPos = scvf.dofPosition(); @@ -135,21 +135,19 @@ diff -ruN exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh exer } diff -ruN exercises/exercise-coupling-ff-pm/interface/main.cc exercises/solution/exercise-coupling-ff-pm/interface/main.cc ---- exercises/exercise-coupling-ff-pm/interface/main.cc 2024-07-17 11:27:28.870349025 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/interface/main.cc 2024-07-17 11:27:28.882349286 +0200 -@@ -52,10 +52,8 @@ +--- exercises/exercise-coupling-ff-pm/interface/main.cc 2024-07-17 13:58:18.208850308 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/interface/main.cc 2024-07-17 13:58:18.252850955 +0200 +@@ -52,9 +52,7 @@ 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) +#if EXNUMBER < 3 -+ // try to create a grid (from the given grid file or the input file) + // create two individual grids (from the given grid file or the input file) // for both sub-domains using PorousMediumGridManager = Dumux::GridManager<GetPropType<PorousMediumTypeTag, Properties::Grid>>; - PorousMediumGridManager porousMediumGridManager; @@ -68,57 +66,51 @@ // we compute on the leaf grid view const auto& porousMediumGridView = porousMediumGridManager.grid().leafGridView(); @@ -265,30 +263,23 @@ diff -ruN exercises/exercise-coupling-ff-pm/interface/main.cc exercises/solution using PorousMediumSolutionVector = GetPropType<PorousMediumTypeTag, Properties::SolutionVector>; VtkOutputModule<PorousMediumGridVariables, PorousMediumSolutionVector> porousMediumVtkWriter(*porousMediumGridVariables, diff -ruN exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh ---- exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh 2024-07-17 11:27:28.870349025 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh 2024-07-17 11:27:28.882349286 +0200 -@@ -68,13 +68,13 @@ +--- exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh 2024-07-17 13:58:18.252850955 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh 2024-07-17 13:58:18.252850955 +0200 +@@ -68,9 +68,10 @@ // set Neumann BCs to all boundaries first values.setAllNeumann(); -- // set the coupling boundary condition at the interface -- if (couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf)) -- values.setAllCouplingNeumann(); -- - // set a Dirichlet boundary condition at the bottom -+#if EXNUMBER == 0 // flow from top to bottom ++#if EXNUMBER == 0 // set a Dirichlet boundary condition at the bottom if (onLowerBoundary_(scvf.center())) values.setAllDirichlet(); +#endif -+ -+ if (couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf)) -+ values.setAllCouplingNeumann(); - return values; - } + // set the coupling boundary condition at the interface + if (couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf)) diff -ruN exercises/exercise-coupling-ff-pm/interface/properties.hh exercises/solution/exercise-coupling-ff-pm/interface/properties.hh ---- exercises/exercise-coupling-ff-pm/interface/properties.hh 2024-07-17 11:27:28.870349025 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/interface/properties.hh 2024-07-17 11:27:28.882349286 +0200 +--- exercises/exercise-coupling-ff-pm/interface/properties.hh 2024-07-17 13:58:18.252850955 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/interface/properties.hh 2024-07-17 13:58:18.216850425 +0200 @@ -16,9 +16,9 @@ #include <dumux/multidomain/staggeredtraits.hh> #include <dumux/multidomain/boundary/stokesdarcy/couplingmanager.hh> @@ -302,16 +293,18 @@ diff -ruN exercises/exercise-coupling-ff-pm/interface/properties.hh exercises/so #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/components/simpleh2o.hh> -@@ -86,13 +86,12 @@ +@@ -86,15 +86,12 @@ using Scalar = GetPropType<TypeTag, Properties::Scalar>; using TensorGrid = Dune::YaspGrid<2, Dune::TensorProductCoordinates<Scalar, dim> >; -// TODO: dumux-course-task 1.C -//****** comment out for the last exercise *****// +- // use "normal" grid +#if EXNUMBER < 3 // use "normal" grid using type = TensorGrid; - -//****** uncomment for the last exercise *****// +- // // use dune-subgrid - // using HostGrid = TensorGrid; - // using type = Dune::SubGrid<dim, HostGrid>; +#else // use dune-subgrid @@ -321,16 +314,18 @@ diff -ruN exercises/exercise-coupling-ff-pm/interface/properties.hh exercises/so }; template<class TypeTag> struct Grid<TypeTag, TTag::FreeflowOneP> -@@ -101,13 +100,12 @@ +@@ -103,15 +100,12 @@ using Scalar = GetPropType<TypeTag, Properties::Scalar>; using TensorGrid = Dune::YaspGrid<2, Dune::TensorProductCoordinates<Scalar, dim> >; -// TODO: dumux-course-task 1.C -//****** comment out for the last exercise *****// +- // use "normal" grid +#if EXNUMBER < 3 // use "normal" grid using type = TensorGrid; - -//****** uncomment for the last exercise *****// +- // // use dune-subgrid - // using HostGrid = TensorGrid; - // using type = Dune::SubGrid<dim, HostGrid>; +#else // use dune-subgrid @@ -341,7 +336,7 @@ diff -ruN exercises/exercise-coupling-ff-pm/interface/properties.hh exercises/so template<class TypeTag> diff -ruN exercises/exercise-coupling-ff-pm/interface/readme.md exercises/solution/exercise-coupling-ff-pm/interface/readme.md ---- exercises/exercise-coupling-ff-pm/interface/readme.md 2024-07-16 16:28:05.555708496 +0200 +--- exercises/exercise-coupling-ff-pm/interface/readme.md 2024-07-17 14:00:29.510779420 +0200 +++ exercises/solution/exercise-coupling-ff-pm/interface/readme.md 1970-01-01 01:00:00.000000000 +0100 @@ -1,169 +0,0 @@ -## 1. Changing the interface @@ -513,10 +508,9 @@ diff -ruN exercises/exercise-coupling-ff-pm/interface/readme.md exercises/soluti -Rather than enforcing a pressure difference across the domain, an inflow velocity profile could be set. -What changes to the left boundary conditions in the free-flow domain would you make to introduce this? What conditions can be enforced on the right boundary? -Hint: A relation between velocity and position is used for the vertical velocity component in the original form of the `dirichletAtPos` method. -\ No newline at end of file diff -ruN exercises/exercise-coupling-ff-pm/models/CMakeLists.txt exercises/solution/exercise-coupling-ff-pm/models/CMakeLists.txt ---- exercises/exercise-coupling-ff-pm/models/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/models/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 +--- exercises/exercise-coupling-ff-pm/models/CMakeLists.txt 2024-07-17 13:58:18.208850308 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/models/CMakeLists.txt 2024-07-17 13:58:18.216850425 +0200 @@ -1,9 +1,32 @@ # SPDX-FileCopyrightInfo: Copyright © DuMux-Course contributors, see AUTHORS.md in root folder # SPDX-License-Identifier: GPL-3.0-or-later @@ -555,8 +549,8 @@ diff -ruN exercises/exercise-coupling-ff-pm/models/CMakeLists.txt exercises/solu + +dune_symlink_to_source_files(FILES "params_orig_a.input" "params_b_c.input" plotFluxes.py) diff -ruN exercises/exercise-coupling-ff-pm/models/main.cc exercises/solution/exercise-coupling-ff-pm/models/main.cc ---- exercises/exercise-coupling-ff-pm/models/main.cc 2024-07-17 11:27:28.870349025 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/models/main.cc 2024-07-17 11:27:28.882349286 +0200 +--- exercises/exercise-coupling-ff-pm/models/main.cc 2024-07-17 13:58:18.208850308 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/models/main.cc 2024-07-17 13:58:18.216850425 +0200 @@ -127,9 +127,15 @@ auto porousMediumGridVariables = std::make_shared<PorousMediumGridVariables>(porousMediumProblem, porousMediumFvGridGeometry); porousMediumGridVariables->init(sol[porousMediumIdx]); @@ -638,11 +632,11 @@ diff -ruN exercises/exercise-coupling-ff-pm/models/params_b_c.input exercises/so +[Assembly] +NumericDifference.BaseEpsilon = 1e-8 diff -ruN exercises/exercise-coupling-ff-pm/models/params.input exercises/solution/exercise-coupling-ff-pm/models/params.input ---- exercises/exercise-coupling-ff-pm/models/params.input 2024-07-16 16:28:05.559708538 +0200 +--- exercises/exercise-coupling-ff-pm/models/params.input 2024-07-17 13:58:18.252850955 +0200 +++ exercises/solution/exercise-coupling-ff-pm/models/params.input 1970-01-01 01:00:00.000000000 +0100 @@ -1,58 +0,0 @@ -[TimeLoop] --DtInitial = 1 # s +-DtInitial = 100 # s -EpisodeLength = -360 # s # 0.25 days -TEnd = 256000 # s # 2 days - @@ -760,8 +754,8 @@ diff -ruN exercises/exercise-coupling-ff-pm/models/params_orig_a.input exercises +[Assembly] +NumericDifference.BaseEpsilon = 1e-8 diff -ruN exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh ---- exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh 2024-07-17 11:27:28.870349025 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh 2024-07-17 11:27:28.882349286 +0200 +--- exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh 2024-07-17 13:58:18.252850955 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh 2024-07-17 13:58:18.252850955 +0200 @@ -52,10 +52,15 @@ // primary variable indices static constexpr int conti0EqIdx = Indices::conti0EqIdx; @@ -809,14 +803,14 @@ diff -ruN exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh exe for ([[maybe_unused]] auto&& scv : scvs(fvGeometry)) { -- // const auto& volVars = elemVolVars[scv]; -- - // TODO: dumux-course-task 2.B -- // Insert calculation of the water mass here +- // insert calculation of the water mass over all present phases +- +- // const auto& volVars = elemVolVars[scv]; - waterMass += 0.0; ++ // calculation of the water mass over all present phases + for(int phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) + { -+ // insert calculation of the water mass here +#if EXNUMBER >= 2 + const auto& volVars = elemVolVars[scv]; + waterMass += volVars.massFraction(phaseIdx, FluidSystem::H2OIdx) * volVars.density(phaseIdx) @@ -840,41 +834,36 @@ diff -ruN exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh exe - // TODO: dumux-course-task 2.B - // Use "massCouplingCondition" from the couplingManager here -- NumEqVector flux(0.0); +#if EXNUMBER >= 2 + NumEqVector flux = couplingManager().couplingData().massCouplingCondition(element, fvGeometry, elemVolVars, scvf) + * scvf.area() * elemVolVars[scvf.insideScvIdx()].extrusionFactor() * FluidSystem::molarMass(1) * -1.0 * 86400.0; +#else -+ NumEqVector flux(0.0); // add "massCouplingCondition" from the couplingManager here + NumEqVector flux(0.0); +#endif faceEvaporation.push_back(flux[transportCompIdx]); } } -@@ -333,14 +357,16 @@ - static const Scalar freeflowPressure = getParamFromGroup<Scalar>("Freeflow", "Problem.Pressure"); - +@@ -335,11 +359,15 @@ PrimaryVariables values(0.0); -- + values[pressureIdx] = freeflowPressure; + - // TODO: dumux-course-task 2.A - // Declare here which phases are present. - // TODO: dumux-course-task 2.C - // Change initial condition to 2p system with liquid saturation of 0.1 -- -- values[Indices::pressureIdx] = freeflowPressure; +#if EXNUMBER >= 3 + values.setState(3/*bothPhases*/); + values[saturationIdx] = saturation_; +#elif EXNUMBER >= 1 + values.setState(2/*secondPhaseOnly*/); - values[transportCompIdx] = moleFraction_; -+#else + values[transportCompIdx] = moleFraction_; ++#else + values[transportCompIdx] = moleFraction_; +#endif -+ values[pressureIdx] = freeflowPressure; + return values; } - -@@ -375,7 +401,12 @@ +@@ -375,7 +403,12 @@ { return globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_; } Scalar eps_; @@ -888,43 +877,37 @@ diff -ruN exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh exe std::shared_ptr<CouplingManager> couplingManager_; diff -ruN exercises/exercise-coupling-ff-pm/models/properties.hh exercises/solution/exercise-coupling-ff-pm/models/properties.hh ---- exercises/exercise-coupling-ff-pm/models/properties.hh 2024-07-17 11:27:28.870349025 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/models/properties.hh 2024-07-17 11:27:28.882349286 +0200 -@@ -22,15 +22,17 @@ - #include <dumux/material/fluidsystems/h2oair.hh> - - // Porous medium flow domain --// TODO: dumux-course-task 2.A --// Include 2pnc model here --#include <dumux/porousmediumflow/1pnc/model.hh> +--- exercises/exercise-coupling-ff-pm/models/properties.hh 2024-07-17 13:58:18.252850955 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/models/properties.hh 2024-07-17 13:58:18.216850425 +0200 +@@ -25,12 +25,14 @@ #include <dumux/discretization/cctpfa.hh> #include <dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh> -// TODO: dumux-course-task 2.A --// Include spatial params for a 2-phase system +-// Include 2pnc model here +#if EXNUMBER >= 1 +#include <dumux/porousmediumflow/2pnc/model.hh> +#include "../2pspatialparams.hh" +#else -+#include <dumux/porousmediumflow/1pnc/model.hh> + #include <dumux/porousmediumflow/1pnc/model.hh> +-// TODO: dumux-course-task 2.A +-// Include spatial params for a 2-phase system #include "../1pspatialparams.hh" +#endif + #include "porousmediumsubproblem.hh" // Free-flow -@@ -43,10 +45,12 @@ - +@@ -44,9 +46,11 @@ // Create new type tags namespace TTag { + struct FreeflowNC { using InheritsFrom = std::tuple<NavierStokesNC, StaggeredFreeFlowModel>; }; -// TODO: dumux-course-task 2.A -// Change the inheritance such that the correct model is used. --struct PorousMediumOnePNC { using InheritsFrom = std::tuple<OnePNC, CCTpfaModel>; }; - struct FreeflowNC { using InheritsFrom = std::tuple<NavierStokesNC, StaggeredFreeFlowModel>; }; +#if EXNUMBER >= 1 +struct PorousMediumOnePNC { using InheritsFrom = std::tuple<TwoPNC, CCTpfaModel>; }; +#else -+struct PorousMediumOnePNC { using InheritsFrom = std::tuple<OnePNC, CCTpfaModel>; }; + struct PorousMediumOnePNC { using InheritsFrom = std::tuple<OnePNC, CCTpfaModel>; }; +#endif } // end namespace TTag @@ -961,6 +944,8 @@ diff -ruN exercises/exercise-coupling-ff-pm/models/properties.hh exercises/solut +#endif // Set the spatial parameters type +-// TODO: dumux-course-task 2.A +-// Adapt the spatial params here. +#if EXNUMBER >= 1 +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::PorousMediumOnePNC> { @@ -968,8 +953,6 @@ diff -ruN exercises/exercise-coupling-ff-pm/models/properties.hh exercises/solut +}; +#else template<class TypeTag> --// TODO: dumux-course-task 2.A --// Adapt the spatial params here. struct SpatialParams<TypeTag, TTag::PorousMediumOnePNC> { using type = OnePSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; }; @@ -978,7 +961,7 @@ diff -ruN exercises/exercise-coupling-ff-pm/models/properties.hh exercises/solut template<class TypeTag> struct EnableGridGeometryCache<TypeTag, TTag::FreeflowNC> { static constexpr bool value = true; }; diff -ruN exercises/exercise-coupling-ff-pm/models/readme.md exercises/solution/exercise-coupling-ff-pm/models/readme.md ---- exercises/exercise-coupling-ff-pm/models/readme.md 2024-07-16 16:28:05.559708538 +0200 +--- exercises/exercise-coupling-ff-pm/models/readme.md 2024-07-17 14:03:33.957481940 +0200 +++ exercises/solution/exercise-coupling-ff-pm/models/readme.md 1970-01-01 01:00:00.000000000 +0100 @@ -1,118 +0,0 @@ -## 2. Changing the porous medium model @@ -1099,9 +1082,8 @@ diff -ruN exercises/exercise-coupling-ff-pm/models/readme.md exercises/solution/ -describe an algorithm to switch the primary variables, if phases should appear or disappear during a simulation. - -Now you are able to simulate a complete drying of the porous medium. Have a look the resulting liquid saturation distribution within the porous medium (with using paraview). -\ No newline at end of file diff -ruN exercises/exercise-coupling-ff-pm/README.md exercises/solution/exercise-coupling-ff-pm/README.md ---- exercises/exercise-coupling-ff-pm/README.md 2024-07-16 17:23:04.816373944 +0200 +--- exercises/exercise-coupling-ff-pm/README.md 2024-07-17 14:00:29.510779420 +0200 +++ exercises/solution/exercise-coupling-ff-pm/README.md 1970-01-01 01:00:00.000000000 +0100 @@ -1,125 +0,0 @@ -# Exercise Coupling free flow/porous medium flow (DuMuX Course) @@ -1229,10 +1211,9 @@ diff -ruN exercises/exercise-coupling-ff-pm/README.md exercises/solution/exercis -* [**Exercise 1:** Changing the interface between the free- and the porous medium domain](./interface/readme.md) -* [**Exercise 2:** Changing the porous medium model](./models/readme.md) -* [**Exercise 3:** Introducing a turbulence model in the free flow domain](./turbulence/readme.md) -\ No newline at end of file diff -ruN exercises/exercise-coupling-ff-pm/turbulence/CMakeLists.txt exercises/solution/exercise-coupling-ff-pm/turbulence/CMakeLists.txt ---- exercises/exercise-coupling-ff-pm/turbulence/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/turbulence/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 +--- exercises/exercise-coupling-ff-pm/turbulence/CMakeLists.txt 2024-07-17 13:58:18.208850308 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/turbulence/CMakeLists.txt 2024-07-17 13:58:18.216850425 +0200 @@ -1,10 +1,33 @@ # SPDX-FileCopyrightInfo: Copyright © DuMux-Course contributors, see AUTHORS.md in root folder # SPDX-License-Identifier: GPL-3.0-or-later @@ -1271,9 +1252,9 @@ diff -ruN exercises/exercise-coupling-ff-pm/turbulence/CMakeLists.txt exercises/ # add a symlink for each input file add_input_file_links() diff -ruN exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh ---- exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh 2024-07-17 11:27:28.870349025 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh 2024-07-17 11:27:28.882349286 +0200 -@@ -8,8 +8,9 @@ +--- exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh 2024-07-17 13:58:18.252850955 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh 2024-07-17 13:58:18.252850955 +0200 +@@ -8,8 +8,8 @@ * \file * \brief The free-flow sub problem */ @@ -1281,11 +1262,10 @@ diff -ruN exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh exe -#define DUMUX_FREEFLOW_TURBULENCE_SUBPROBLEM_HH +#ifndef DUMUX_FREEFLOW_TURBULENCE_SUBPROBLEM_SOL_HH +#define DUMUX_FREEFLOW_TURBULENCE_SUBPROBLEM_SOL_HH -+ #include <dumux/common/properties.hh> #include <dumux/common/boundarytypes.hh> -@@ -18,21 +19,29 @@ +@@ -18,21 +18,29 @@ #include <dumux/multidomain/boundary/stokesdarcy/couplingdata.hh> #include <dumux/freeflow/turbulencemodel.hh> @@ -1319,7 +1299,7 @@ diff -ruN exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh exe using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; static constexpr auto dimWorld = GridView::dimensionworld; -@@ -40,9 +49,11 @@ +@@ -40,9 +48,11 @@ using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; @@ -1333,25 +1313,11 @@ diff -ruN exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh exe using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; -@@ -79,21 +90,21 @@ +@@ -79,21 +89,20 @@ diffCoeffAvgType_ = StokesDarcyCouplingOptions::stringToEnum(DiffusionCoefficientAveragingType{}, getParamFromGroup<std::string>(this->paramGroup(), "Problem.InterfaceDiffusionCoefficientAvg")); -+#if EXNUMBER >=1 -+ FluidSystem::init(); -+ Dumux::TurbulenceProperties<Scalar, dimWorld, true> turbulenceProperties; -+ FluidState fluidState; -+ const auto phaseIdx = 0; -+ fluidState.setPressure(phaseIdx, refPressure_); -+ fluidState.setTemperature(this->spatialParams().temperatureAtPos({})); -+ fluidState.setMassFraction(phaseIdx, phaseIdx, 1.0); -+ Scalar density = FluidSystem::density(fluidState, phaseIdx); -+ Scalar kinematicViscosity = FluidSystem::viscosity(fluidState, phaseIdx) / density; -+ Scalar diameter = this->gridGeometry().bBoxMax()[1] - this->gridGeometry().bBoxMin()[1]; -+ turbulentKineticEnergy_ = turbulenceProperties.turbulentKineticEnergy(refVelocity_, diameter, kinematicViscosity); -+ dissipation_ = turbulenceProperties.dissipationRate(refVelocity_, diameter, kinematicViscosity); -+#endif - +- - // TODO: // ******************** uncomment this section for the first task 3.A ****************** // - // FluidSystem::init(); - // Dumux::TurbulenceProperties<Scalar, dimWorld, true> turbulenceProperties; @@ -1366,13 +1332,30 @@ diff -ruN exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh exe - // turbulentKineticEnergy_ = turbulenceProperties.turbulentKineticEnergy(refVelocity_, diameter, kinematicViscosity); - // dissipation_ = turbulenceProperties.dissipationRate(refVelocity_, diameter, kinematicViscosity); - // // ************************************************************************************* // ++#if EXNUMBER >=1 ++ FluidSystem::init(); ++ Dumux::TurbulenceProperties<Scalar, dimWorld, true> turbulenceProperties; ++ FluidState fluidState; ++ const auto phaseIdx = 0; ++ fluidState.setPressure(phaseIdx, refPressure_); ++ fluidState.setTemperature(this->spatialParams().temperatureAtPos({})); ++ fluidState.setMassFraction(phaseIdx, phaseIdx, 1.0); ++ Scalar density = FluidSystem::density(fluidState, phaseIdx); ++ Scalar kinematicViscosity = FluidSystem::viscosity(fluidState, phaseIdx) / density; ++ Scalar diameter = this->gridGeometry().bBoxMax()[1] - this->gridGeometry().bBoxMin()[1]; ++ turbulentKineticEnergy_ = turbulenceProperties.turbulentKineticEnergy(refVelocity_, diameter, kinematicViscosity); ++ dissipation_ = turbulenceProperties.dissipationRate(refVelocity_, diameter, kinematicViscosity); ++#endif } /*! -@@ -110,6 +121,20 @@ +@@ -109,8 +118,20 @@ + BoundaryTypes values; const auto& globalPos = scvf.center(); - +- // TODO: dumux-course-task 3.A +- // set boundary conditions for the turbulence model primary variables k and \omega everywhere (outflow on right boundary, otherwise dirichlet) ++ +#if EXNUMBER >=1 + if(onRightBoundary_(globalPos)) + { @@ -1386,21 +1369,19 @@ diff -ruN exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh exe + values.setDirichlet(Indices::dissipationIdx); + } +#endif -+ + if (onLeftBoundary_(globalPos)) { - values.setDirichlet(Indices::velocityXIdx); -@@ -118,9 +143,6 @@ +@@ -120,8 +141,6 @@ values.setDirichlet(Indices::energyEqIdx); } - // TODO: dumux-course-task 3.A - // set wall conditions for the turbulence model at the walls (values.setWall()) corresponding to the upper and lower boundary -- // set boundary conditions for the turbulence model primary variables everywhere (outflow on right boundary, otherwise dirichlet) if (onLowerBoundary_(globalPos)) { values.setDirichlet(Indices::velocityXIdx); -@@ -128,17 +150,29 @@ +@@ -129,17 +148,29 @@ values.setNeumann(Indices::conti0EqIdx); values.setNeumann(Indices::conti0EqIdx + 1); values.setNeumann(Indices::energyEqIdx); @@ -1432,7 +1413,7 @@ diff -ruN exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh exe } if (onRightBoundary_(globalPos)) -@@ -171,16 +205,19 @@ +@@ -172,16 +203,19 @@ const auto globalPos = scvf.ipGlobal(); PrimaryVariables values(initialAtPos(globalPos)); @@ -1462,7 +1443,7 @@ diff -ruN exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh exe return values; } -@@ -287,15 +324,18 @@ +@@ -288,15 +322,18 @@ values[Indices::velocityXIdx] = refVelocity(); values[Indices::temperatureIdx] = refTemperature(); @@ -1488,35 +1469,31 @@ diff -ruN exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh exe return values; } diff -ruN exercises/exercise-coupling-ff-pm/turbulence/main.cc exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc ---- exercises/exercise-coupling-ff-pm/turbulence/main.cc 2024-07-17 11:27:28.870349025 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc 2024-07-17 11:27:28.882349286 +0200 -@@ -121,12 +121,12 @@ - auto solOld = sol; +--- exercises/exercise-coupling-ff-pm/turbulence/main.cc 2024-07-17 13:58:18.208850308 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc 2024-07-17 13:58:18.256851014 +0200 +@@ -122,11 +122,12 @@ couplingManager->init(freeflowProblem, porousMediumProblem, sol); -- + - // TODO: dumux-course-task 3.A -- // Update static wall properties ++#if EXNUMBER >= 1 + // Update static wall properties - - // TODO: dumux-course-task 3.A -- // Update dynamic wall properties -+ // TODO: update static wall properties -+ // TODO: update dynamic wall properties -+#if EXNUMBER >= 1 + freeflowProblem->updateStaticWallProperties(); + // Update dynamic wall properties + freeflowProblem->updateDynamicWallProperties(freeflowSol); +#endif // the grid variables using FreeflowGridVariables = GetPropType<FreeflowTypeTag, Properties::GridVariables>; -@@ -180,8 +180,10 @@ +@@ -180,8 +181,10 @@ // make the new solution the old solution solOld = sol; - // TODO: dumux-course-task 3.A -- // Update dynamic wall properties +#if EXNUMBER >= 1 -+ // TODO: update dynamic wall properties + // Update dynamic wall properties + freeflowProblem->updateDynamicWallProperties(freeflowSol); +#endif @@ -1828,8 +1805,8 @@ diff -ruN exercises/exercise-coupling-ff-pm/turbulence/params_orig_a.input exerc +[RANS] +IsFlatWallBounded = True diff -ruN exercises/exercise-coupling-ff-pm/turbulence/properties.hh exercises/solution/exercise-coupling-ff-pm/turbulence/properties.hh ---- exercises/exercise-coupling-ff-pm/turbulence/properties.hh 2024-07-17 11:27:28.874349112 +0200 -+++ exercises/solution/exercise-coupling-ff-pm/turbulence/properties.hh 2024-07-17 11:27:28.882349286 +0200 +--- exercises/exercise-coupling-ff-pm/turbulence/properties.hh 2024-07-17 13:58:18.252850955 +0200 ++++ exercises/solution/exercise-coupling-ff-pm/turbulence/properties.hh 2024-07-17 13:58:18.216850425 +0200 @@ -8,8 +8,8 @@ * \file * \brief The coupled exercise properties file or the turbulent case. @@ -1846,7 +1823,7 @@ diff -ruN exercises/exercise-coupling-ff-pm/turbulence/properties.hh exercises/s // Free-flow domain #include <dumux/discretization/staggered/freeflow/properties.hh> -// TODO: dumux-course-task 3.A --// Include headers for compositional zero equation turbulence model here. +-// Include headers for compositional k-\omega SST turbulence model here. + +#if EXNUMBER >= 1 +#include <dumux/freeflow/compositional/sstncmodel.hh> diff --git a/.patches/exercise-dunemodule/exercise-dunemodule.patch b/.patches/exercise-dunemodule/exercise-dunemodule.patch index 0ce683a5..381f901f 100644 --- a/.patches/exercise-dunemodule/exercise-dunemodule.patch +++ b/.patches/exercise-dunemodule/exercise-dunemodule.patch @@ -1,5 +1,5 @@ diff -ruN exercises/exercise-dunemodule/README.md exercises/solution/exercise-dunemodule/README.md ---- exercises/exercise-dunemodule/README.md 2024-07-16 17:23:04.820373999 +0200 +--- exercises/exercise-dunemodule/README.md 2024-07-17 14:00:29.510779420 +0200 +++ exercises/solution/exercise-dunemodule/README.md 1970-01-01 01:00:00.000000000 +0100 @@ -1,114 +0,0 @@ -# Exercise New Dune Module (DuMuX course) @@ -116,4 +116,3 @@ diff -ruN exercises/exercise-dunemodule/README.md exercises/solution/exercise-du -git commit -m "Initial commit" -git push -u origin main -``` -\ No newline at end of file diff --git a/.patches/exercise-grids/exercise-grids.patch b/.patches/exercise-grids/exercise-grids.patch index fd21d225..18a57aa5 100644 --- a/.patches/exercise-grids/exercise-grids.patch +++ b/.patches/exercise-grids/exercise-grids.patch @@ -1,6 +1,6 @@ diff -ruN exercises/exercise-grids/CMakeLists.txt exercises/solution/exercise-grids/CMakeLists.txt ---- exercises/exercise-grids/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 -+++ exercises/solution/exercise-grids/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 +--- exercises/exercise-grids/CMakeLists.txt 2024-07-17 13:58:18.212850366 +0200 ++++ exercises/solution/exercise-grids/CMakeLists.txt 2024-07-17 13:58:18.220850484 +0200 @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later @@ -55,8 +55,8 @@ diff -ruN exercises/exercise-grids/grids/grid_structured.geo exercises/solution/ -Transfinite Volume "*"; - diff -ruN exercises/exercise-grids/main.cc exercises/solution/exercise-grids/main.cc ---- exercises/exercise-grids/main.cc 2024-07-17 11:27:28.874349112 +0200 -+++ exercises/solution/exercise-grids/main.cc 2024-07-17 11:27:28.886349373 +0200 +--- exercises/exercise-grids/main.cc 2024-07-17 13:58:18.212850366 +0200 ++++ exercises/solution/exercise-grids/main.cc 2024-07-17 13:58:18.220850484 +0200 @@ -6,7 +6,7 @@ // /*! @@ -67,8 +67,8 @@ diff -ruN exercises/exercise-grids/main.cc exercises/solution/exercise-grids/mai #include <config.h> diff -ruN exercises/exercise-grids/params.input exercises/solution/exercise-grids/params.input ---- exercises/exercise-grids/params.input 2024-07-17 10:58:43.901583076 +0200 -+++ exercises/solution/exercise-grids/params.input 2020-11-12 12:07:04.133814393 +0100 +--- exercises/exercise-grids/params.input 2024-07-17 14:09:52.163005898 +0200 ++++ exercises/solution/exercise-grids/params.input 2024-07-17 14:10:01.563142989 +0200 @@ -3,13 +3,34 @@ TEnd = 3.154e9 # in seconds, i.e ten years @@ -109,16 +109,9 @@ diff -ruN exercises/exercise-grids/params.input exercises/solution/exercise-grid [Problem] Name = grid_exercise -@@ -27,4 +48,4 @@ - Aquifer.BrooksCoreyPcEntry = 1e4 # Pa - Aquifer.BrooksCoreyLambda = 2.0 - Aquifer.Swr = 0.2 --Aquifer.Snr = 0.0 -\ No newline at end of file -+Aquifer.Snr = 0.0 diff -ruN exercises/exercise-grids/properties.hh exercises/solution/exercise-grids/properties.hh ---- exercises/exercise-grids/properties.hh 2024-07-17 11:27:28.874349112 +0200 -+++ exercises/solution/exercise-grids/properties.hh 2024-07-17 11:27:28.886349373 +0200 +--- exercises/exercise-grids/properties.hh 2024-07-17 13:58:18.212850366 +0200 ++++ exercises/solution/exercise-grids/properties.hh 2024-07-17 13:58:18.220850484 +0200 @@ -5,9 +5,9 @@ // SPDX-License-Identifier: GPL-3.0-or-later // diff --git a/.patches/exercise-mainfile/exercise-mainfile.patch b/.patches/exercise-mainfile/exercise-mainfile.patch index 804501d0..4ef11fa0 100644 --- a/.patches/exercise-mainfile/exercise-mainfile.patch +++ b/.patches/exercise-mainfile/exercise-mainfile.patch @@ -1,6 +1,6 @@ diff -ruN exercises/exercise-mainfile/CMakeLists.txt exercises/solution/exercise-mainfile/CMakeLists.txt ---- exercises/exercise-mainfile/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 -+++ exercises/solution/exercise-mainfile/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 +--- exercises/exercise-mainfile/CMakeLists.txt 2024-07-17 14:07:42.177109339 +0200 ++++ exercises/solution/exercise-mainfile/CMakeLists.txt 2024-07-17 13:58:18.220850484 +0200 @@ -2,14 +2,9 @@ # SPDX-License-Identifier: GPL-3.0-or-later @@ -22,7 +22,7 @@ diff -ruN exercises/exercise-mainfile/CMakeLists.txt exercises/solution/exercise +add_input_file_links() \ No newline at end of file diff -ruN exercises/exercise-mainfile/exercise1pamain.cc exercises/solution/exercise-mainfile/exercise1pamain.cc ---- exercises/exercise-mainfile/exercise1pamain.cc 2024-07-17 11:27:28.874349112 +0200 +--- exercises/exercise-mainfile/exercise1pamain.cc 2024-07-17 13:58:18.212850366 +0200 +++ exercises/solution/exercise-mainfile/exercise1pamain.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,130 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- @@ -157,7 +157,7 @@ diff -ruN exercises/exercise-mainfile/exercise1pamain.cc exercises/solution/exer -}// end main diff -ruN exercises/exercise-mainfile/exercise1pa_solution_main.cc exercises/solution/exercise-mainfile/exercise1pa_solution_main.cc --- exercises/exercise-mainfile/exercise1pa_solution_main.cc 1970-01-01 01:00:00.000000000 +0100 -+++ exercises/solution/exercise-mainfile/exercise1pa_solution_main.cc 2024-07-17 11:27:28.886349373 +0200 ++++ exercises/solution/exercise-mainfile/exercise1pa_solution_main.cc 2024-07-17 13:58:18.220850484 +0200 @@ -0,0 +1,130 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: @@ -290,7 +290,7 @@ diff -ruN exercises/exercise-mainfile/exercise1pa_solution_main.cc exercises/sol + +}// end main diff -ruN exercises/exercise-mainfile/exercise1pbmain.cc exercises/solution/exercise-mainfile/exercise1pbmain.cc ---- exercises/exercise-mainfile/exercise1pbmain.cc 2024-07-17 11:27:28.874349112 +0200 +--- exercises/exercise-mainfile/exercise1pbmain.cc 2024-07-17 13:58:18.212850366 +0200 +++ exercises/solution/exercise-mainfile/exercise1pbmain.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,120 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- @@ -414,7 +414,7 @@ diff -ruN exercises/exercise-mainfile/exercise1pbmain.cc exercises/solution/exer - -}// end main diff -ruN exercises/exercise-mainfile/exercise1pcmain.cc exercises/solution/exercise-mainfile/exercise1pcmain.cc ---- exercises/exercise-mainfile/exercise1pcmain.cc 2024-07-17 11:27:28.878349199 +0200 +--- exercises/exercise-mainfile/exercise1pcmain.cc 2024-07-17 13:58:18.212850366 +0200 +++ exercises/solution/exercise-mainfile/exercise1pcmain.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,146 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- @@ -587,7 +587,7 @@ diff -ruN exercises/exercise-mainfile/exercise_mainfile_a.input exercises/soluti -BaseEpsilon = 1e-10 diff -ruN exercises/exercise-mainfile/exercise_mainfile_a_solution.input exercises/solution/exercise-mainfile/exercise_mainfile_a_solution.input --- exercises/exercise-mainfile/exercise_mainfile_a_solution.input 1970-01-01 01:00:00.000000000 +0100 -+++ exercises/solution/exercise-mainfile/exercise_mainfile_a_solution.input 2024-07-17 11:27:28.698345291 +0200 ++++ exercises/solution/exercise-mainfile/exercise_mainfile_a_solution.input 2024-07-17 14:08:11.237533494 +0200 @@ -0,0 +1,18 @@ +[Grid] +LowerLeft = 0 0 @@ -607,7 +607,6 @@ diff -ruN exercises/exercise-mainfile/exercise_mainfile_a_solution.input exercis +[Assembly.NumericDifference] +PriVarMagnitude = 1e5 +BaseEpsilon = 1e-10 -\ No newline at end of file diff -ruN exercises/exercise-mainfile/exercise_mainfile_b.input exercises/solution/exercise-mainfile/exercise_mainfile_b.input --- exercises/exercise-mainfile/exercise_mainfile_b.input 2023-10-13 18:08:54.718521039 +0200 +++ exercises/solution/exercise-mainfile/exercise_mainfile_b.input 1970-01-01 01:00:00.000000000 +0100 @@ -630,7 +629,7 @@ diff -ruN exercises/exercise-mainfile/exercise_mainfile_b.input exercises/soluti -[Assembly.NumericDifference] -PriVarMagnitude = 1e5 diff -ruN exercises/exercise-mainfile/exercise_mainfile_c.input exercises/solution/exercise-mainfile/exercise_mainfile_c.input ---- exercises/exercise-mainfile/exercise_mainfile_c.input 2023-10-13 18:08:54.718521039 +0200 +--- exercises/exercise-mainfile/exercise_mainfile_c.input 2024-07-17 14:08:27.885776444 +0200 +++ exercises/solution/exercise-mainfile/exercise_mainfile_c.input 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -[TimeLoop] @@ -654,10 +653,9 @@ diff -ruN exercises/exercise-mainfile/exercise_mainfile_c.input exercises/soluti - -[Assembly.NumericDifference] -PriVarMagnitude = 1e5 -\ No newline at end of file diff -ruN exercises/exercise-mainfile/properties.hh exercises/solution/exercise-mainfile/properties.hh ---- exercises/exercise-mainfile/properties.hh 2024-07-17 11:27:28.878349199 +0200 -+++ exercises/solution/exercise-mainfile/properties.hh 2024-07-17 11:27:28.886349373 +0200 +--- exercises/exercise-mainfile/properties.hh 2024-07-17 13:58:18.212850366 +0200 ++++ exercises/solution/exercise-mainfile/properties.hh 2024-07-17 13:58:18.220850484 +0200 @@ -25,8 +25,8 @@ #include <dumux/porousmediumflow/1p/model.hh> diff --git a/.patches/exercise-runtimeparams/exercise-runtimeparams.patch b/.patches/exercise-runtimeparams/exercise-runtimeparams.patch index 1bcfc692..4de557eb 100644 --- a/.patches/exercise-runtimeparams/exercise-runtimeparams.patch +++ b/.patches/exercise-runtimeparams/exercise-runtimeparams.patch @@ -1,6 +1,6 @@ diff -ruN exercises/exercise-runtimeparams/CMakeLists.txt exercises/solution/exercise-runtimeparams/CMakeLists.txt ---- exercises/exercise-runtimeparams/CMakeLists.txt 2024-07-17 11:27:28.798347462 +0200 -+++ exercises/solution/exercise-runtimeparams/CMakeLists.txt 2024-07-17 11:27:28.802347549 +0200 +--- exercises/exercise-runtimeparams/CMakeLists.txt 2024-07-17 13:58:18.212850366 +0200 ++++ exercises/solution/exercise-runtimeparams/CMakeLists.txt 2024-07-17 13:58:18.220850484 +0200 @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later @@ -11,8 +11,8 @@ diff -ruN exercises/exercise-runtimeparams/CMakeLists.txt exercises/solution/exe # add a symlink for each input file diff -ruN exercises/exercise-runtimeparams/params.input exercises/solution/exercise-runtimeparams/params.input ---- exercises/exercise-runtimeparams/params.input 2023-10-13 18:08:54.718521039 +0200 -+++ exercises/solution/exercise-runtimeparams/params.input 2020-11-12 12:07:04.133814393 +0100 +--- exercises/exercise-runtimeparams/params.input 2024-07-17 14:07:04.624561096 +0200 ++++ exercises/solution/exercise-runtimeparams/params.input 2024-07-17 14:06:46.236292578 +0200 @@ -12,11 +12,12 @@ AquiferDepth = 2700.0 # m InjectionDuration = 2.628e6 # in seconds, i.e. one month @@ -27,16 +27,9 @@ diff -ruN exercises/exercise-runtimeparams/params.input exercises/solution/exerc Aquitard.BrooksCoreyLambda = 2.0 Aquitard.Swr = 0.2 Aquitard.Snr = 0.0 -@@ -24,4 +25,4 @@ - Aquifer.BrooksCoreyPcEntry = 1e4 # Pa - Aquifer.BrooksCoreyLambda = 2.0 - Aquifer.Swr = 0.2 --Aquifer.Snr = 0.0 -+Aquifer.Snr = 0.0 -\ No newline at end of file diff -ruN exercises/exercise-runtimeparams/problem.hh exercises/solution/exercise-runtimeparams/problem.hh ---- exercises/exercise-runtimeparams/problem.hh 2024-07-17 11:27:28.878349199 +0200 -+++ exercises/solution/exercise-runtimeparams/problem.hh 2024-07-17 11:27:28.886349373 +0200 +--- exercises/exercise-runtimeparams/problem.hh 2024-07-17 13:58:18.212850366 +0200 ++++ exercises/solution/exercise-runtimeparams/problem.hh 2024-07-17 13:58:18.220850484 +0200 @@ -81,12 +81,16 @@ injectionDuration_ = getParamFromGroup<Scalar>("Problem","InjectionDuration"); // TODO: dumux-course-task 2 @@ -74,8 +67,8 @@ diff -ruN exercises/exercise-runtimeparams/problem.hh exercises/solution/exercis }; diff -ruN exercises/exercise-runtimeparams/properties.hh exercises/solution/exercise-runtimeparams/properties.hh ---- exercises/exercise-runtimeparams/properties.hh 2024-07-17 11:27:28.878349199 +0200 -+++ exercises/solution/exercise-runtimeparams/properties.hh 2024-07-17 11:27:28.890349459 +0200 +--- exercises/exercise-runtimeparams/properties.hh 2024-07-17 13:58:18.212850366 +0200 ++++ exercises/solution/exercise-runtimeparams/properties.hh 2024-07-17 13:58:18.220850484 +0200 @@ -58,6 +58,6 @@ FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true> >; }; @@ -260,8 +253,8 @@ diff -ruN exercises/exercise-runtimeparams/README.md exercises/solution/exercise - -* > __Task 4__: Using one of the bool `hasParam` functions, place an output in the problem file to alert the user where the parameter value comes from. diff -ruN exercises/exercise-runtimeparams/spatialparams.hh exercises/solution/exercise-runtimeparams/spatialparams.hh ---- exercises/exercise-runtimeparams/spatialparams.hh 2024-07-17 11:27:28.878349199 +0200 -+++ exercises/solution/exercise-runtimeparams/spatialparams.hh 2024-07-17 11:27:28.890349459 +0200 +--- exercises/exercise-runtimeparams/spatialparams.hh 2024-07-17 13:58:18.212850366 +0200 ++++ exercises/solution/exercise-runtimeparams/spatialparams.hh 2024-07-17 13:58:18.220850484 +0200 @@ -12,8 +12,8 @@ * fully implicit model. */ diff --git a/exercises/exercise-basic/CMakeLists.txt b/exercises/exercise-basic/CMakeLists.txt index 2e66f1f0..b8882a5c 100644 --- a/exercises/exercise-basic/CMakeLists.txt +++ b/exercises/exercise-basic/CMakeLists.txt @@ -9,4 +9,4 @@ dumux_add_test(NAME exercise_basic_2p # add a symlink for each input file -add_input_file_links() \ No newline at end of file +add_input_file_links() diff --git a/exercises/exercise-basic/README.md b/exercises/exercise-basic/README.md index 57dc3f3f..e98dbf05 100644 --- a/exercises/exercise-basic/README.md +++ b/exercises/exercise-basic/README.md @@ -91,4 +91,4 @@ $\displaystyle d_\text{aquifer}=2700~\text{m}$. Additionally, add a subdomain (2 <img src="https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/master/exercises/extradoc/exercise1_nonisothermal.png" width="800"> -The non-isothermal model requires additional parameters like the thermal conductivity of the solid component. They are already implemented and set in `params.input`, you just need to _uncomment_ them. \ No newline at end of file +The non-isothermal model requires additional parameters like the thermal conductivity of the solid component. They are already implemented and set in `params.input`, you just need to _uncomment_ them. diff --git a/exercises/exercise-coupling-ff-pm/README.md b/exercises/exercise-coupling-ff-pm/README.md index edb1b10f..1243b30e 100644 --- a/exercises/exercise-coupling-ff-pm/README.md +++ b/exercises/exercise-coupling-ff-pm/README.md @@ -122,4 +122,4 @@ Take a closer look at the above listed files before moving to the three exercise * [**Exercise 1:** Changing the interface between the free- and the porous medium domain](./interface/readme.md) * [**Exercise 2:** Changing the porous medium model](./models/readme.md) -* [**Exercise 3:** Introducing a turbulence model in the free flow domain](./turbulence/readme.md) \ No newline at end of file +* [**Exercise 3:** Introducing a turbulence model in the free flow domain](./turbulence/readme.md) diff --git a/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh index 3f2da72a..157f8ce6 100644 --- a/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh @@ -68,14 +68,14 @@ public: // set Neumann BCs to all boundaries first values.setAllNeumann(); - // set the coupling boundary condition at the interface - if (couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf)) - values.setAllCouplingNeumann(); - // set a Dirichlet boundary condition at the bottom if (onLowerBoundary_(scvf.center())) values.setAllDirichlet(); + // set the coupling boundary condition at the interface + if (couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf)) + values.setAllCouplingNeumann(); + return values; } diff --git a/exercises/exercise-coupling-ff-pm/interface/properties.hh b/exercises/exercise-coupling-ff-pm/interface/properties.hh index 04d07b65..4ae54e7f 100644 --- a/exercises/exercise-coupling-ff-pm/interface/properties.hh +++ b/exercises/exercise-coupling-ff-pm/interface/properties.hh @@ -88,9 +88,11 @@ struct Grid<TypeTag, TTag::PorousMediumFlowOneP> // TODO: dumux-course-task 1.C //****** comment out for the last exercise *****// + // use "normal" grid using type = TensorGrid; //****** uncomment for the last exercise *****// + // // use dune-subgrid // using HostGrid = TensorGrid; // using type = Dune::SubGrid<dim, HostGrid>; }; @@ -103,9 +105,11 @@ struct Grid<TypeTag, TTag::FreeflowOneP> // TODO: dumux-course-task 1.C //****** comment out for the last exercise *****// + // use "normal" grid using type = TensorGrid; //****** uncomment for the last exercise *****// + // // use dune-subgrid // using HostGrid = TensorGrid; // using type = Dune::SubGrid<dim, HostGrid>; }; diff --git a/exercises/exercise-coupling-ff-pm/interface/readme.md b/exercises/exercise-coupling-ff-pm/interface/readme.md index 2b1bf9b7..c0e08a53 100644 --- a/exercises/exercise-coupling-ff-pm/interface/readme.md +++ b/exercises/exercise-coupling-ff-pm/interface/readme.md @@ -166,4 +166,4 @@ Recompile and rerun to check if the final result looks something like this: *Extra Points:* Rather than enforcing a pressure difference across the domain, an inflow velocity profile could be set. What changes to the left boundary conditions in the free-flow domain would you make to introduce this? What conditions can be enforced on the right boundary? -Hint: A relation between velocity and position is used for the vertical velocity component in the original form of the `dirichletAtPos` method. \ No newline at end of file +Hint: A relation between velocity and position is used for the vertical velocity component in the original form of the `dirichletAtPos` method. diff --git a/exercises/exercise-coupling-ff-pm/models/params.input b/exercises/exercise-coupling-ff-pm/models/params.input index d036bf85..69c4ec15 100644 --- a/exercises/exercise-coupling-ff-pm/models/params.input +++ b/exercises/exercise-coupling-ff-pm/models/params.input @@ -1,5 +1,5 @@ [TimeLoop] -DtInitial = 1 # s +DtInitial = 100 # s EpisodeLength = -360 # s # 0.25 days TEnd = 256000 # s # 2 days diff --git a/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh index b2f76192..b894499a 100644 --- a/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh @@ -193,10 +193,10 @@ public: for ([[maybe_unused]] auto&& scv : scvs(fvGeometry)) { - // const auto& volVars = elemVolVars[scv]; - // TODO: dumux-course-task 2.B - // Insert calculation of the water mass here + // insert calculation of the water mass over all present phases + + // const auto& volVars = elemVolVars[scv]; waterMass += 0.0; } } @@ -333,14 +333,14 @@ public: static const Scalar freeflowPressure = getParamFromGroup<Scalar>("Freeflow", "Problem.Pressure"); PrimaryVariables values(0.0); + values[pressureIdx] = freeflowPressure; // TODO: dumux-course-task 2.A // Declare here which phases are present. // TODO: dumux-course-task 2.C // Change initial condition to 2p system with liquid saturation of 0.1 - - 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 c23a42bd..36ef5e33 100644 --- a/exercises/exercise-coupling-ff-pm/models/properties.hh +++ b/exercises/exercise-coupling-ff-pm/models/properties.hh @@ -22,12 +22,12 @@ #include <dumux/material/fluidsystems/h2oair.hh> // Porous medium flow domain -// TODO: dumux-course-task 2.A -// Include 2pnc model here -#include <dumux/porousmediumflow/1pnc/model.hh> #include <dumux/discretization/cctpfa.hh> #include <dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh> +// TODO: dumux-course-task 2.A +// Include 2pnc model here +#include <dumux/porousmediumflow/1pnc/model.hh> // TODO: dumux-course-task 2.A // Include spatial params for a 2-phase system #include "../1pspatialparams.hh" @@ -43,10 +43,10 @@ namespace Dumux::Properties { // Create new type tags namespace TTag { +struct FreeflowNC { using InheritsFrom = std::tuple<NavierStokesNC, StaggeredFreeFlowModel>; }; // TODO: dumux-course-task 2.A // Change the inheritance such that the correct model is used. struct PorousMediumOnePNC { using InheritsFrom = std::tuple<OnePNC, CCTpfaModel>; }; -struct FreeflowNC { using InheritsFrom = std::tuple<NavierStokesNC, StaggeredFreeFlowModel>; }; } // end namespace TTag // Set the coupling manager @@ -112,9 +112,9 @@ struct EffectiveDiffusivityModel<TypeTag, TTag::PorousMediumOnePNC> // Define new formulation for primary variables here. // Set the spatial parameters type -template<class TypeTag> // TODO: dumux-course-task 2.A // Adapt the spatial params here. +template<class TypeTag> struct SpatialParams<TypeTag, TTag::PorousMediumOnePNC> { using type = OnePSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; }; diff --git a/exercises/exercise-coupling-ff-pm/models/readme.md b/exercises/exercise-coupling-ff-pm/models/readme.md index 6e123170..bf9c4c5c 100644 --- a/exercises/exercise-coupling-ff-pm/models/readme.md +++ b/exercises/exercise-coupling-ff-pm/models/readme.md @@ -115,4 +115,4 @@ manually adapting the primary variable states and values is inconvenient. [Class et al. (2002)](http://dx.doi.org/10.1016/S0309-1708(02)00014-3) describe an algorithm to switch the primary variables, if phases should appear or disappear during a simulation. -Now you are able to simulate a complete drying of the porous medium. Have a look the resulting liquid saturation distribution within the porous medium (with using paraview). \ No newline at end of file +Now you are able to simulate a complete drying of the porous medium. Have a look the resulting liquid saturation distribution within the porous medium (with using paraview). diff --git a/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh index a25bb63e..a756e161 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh @@ -109,6 +109,8 @@ public: BoundaryTypes values; const auto& globalPos = scvf.center(); + // TODO: dumux-course-task 3.A + // set boundary conditions for the turbulence model primary variables k and \omega everywhere (outflow on right boundary, otherwise dirichlet) if (onLeftBoundary_(globalPos)) { @@ -120,7 +122,6 @@ public: // TODO: dumux-course-task 3.A // set wall conditions for the turbulence model at the walls (values.setWall()) corresponding to the upper and lower boundary - // set boundary conditions for the turbulence model primary variables everywhere (outflow on right boundary, otherwise dirichlet) if (onLowerBoundary_(globalPos)) { values.setDirichlet(Indices::velocityXIdx); diff --git a/exercises/exercise-coupling-ff-pm/turbulence/properties.hh b/exercises/exercise-coupling-ff-pm/turbulence/properties.hh index c7d6371e..4a219b5a 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/properties.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/properties.hh @@ -29,7 +29,7 @@ // Free-flow domain #include <dumux/discretization/staggered/freeflow/properties.hh> // TODO: dumux-course-task 3.A -// Include headers for compositional zero equation turbulence model here. +// Include headers for compositional k-\omega SST turbulence model here. #include <dumux/freeflow/compositional/navierstokesncmodel.hh> #include"freeflowsubproblem.hh" diff --git a/exercises/exercise-dunemodule/README.md b/exercises/exercise-dunemodule/README.md index 9556e798..34c1bbf2 100644 --- a/exercises/exercise-dunemodule/README.md +++ b/exercises/exercise-dunemodule/README.md @@ -111,4 +111,4 @@ Then you can commit and push your new module to your repository: git add . git commit -m "Initial commit" git push -u origin main -``` \ No newline at end of file +``` diff --git a/exercises/exercise-grids/params.input b/exercises/exercise-grids/params.input index dfff01e2..dbba7056 100644 --- a/exercises/exercise-grids/params.input +++ b/exercises/exercise-grids/params.input @@ -27,4 +27,4 @@ PermeabilityAquifer = 1e-12 # m^2 Aquifer.BrooksCoreyPcEntry = 1e4 # Pa Aquifer.BrooksCoreyLambda = 2.0 Aquifer.Swr = 0.2 -Aquifer.Snr = 0.0 \ No newline at end of file +Aquifer.Snr = 0.0 diff --git a/exercises/exercise-mainfile/exercise_mainfile_c.input b/exercises/exercise-mainfile/exercise_mainfile_c.input index ef4d9cb3..a72d588c 100644 --- a/exercises/exercise-mainfile/exercise_mainfile_c.input +++ b/exercises/exercise-mainfile/exercise_mainfile_c.input @@ -18,4 +18,4 @@ Permeability = 1e-10 # [m^2] PermeabilityLens = 1e-12 # [m^2] [Assembly.NumericDifference] -PriVarMagnitude = 1e5 \ No newline at end of file +PriVarMagnitude = 1e5 diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/main.cc b/exercises/solution/exercise-coupling-ff-pm/interface/main.cc index 20eb4c90..b65cb361 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/main.cc +++ b/exercises/solution/exercise-coupling-ff-pm/interface/main.cc @@ -53,7 +53,7 @@ int main(int argc, char** argv) using PorousMediumTypeTag = Properties::TTag::PorousMediumFlowOneP; #if EXNUMBER < 3 - // try to create a grid (from the given grid file or the input file) + // create two individual grids (from the given grid file or the input file) // for both sub-domains using PorousMediumGridManager = Dumux::GridManager<GetPropType<PorousMediumTypeTag, Properties::Grid>>; PorousMediumGridManager porousMediumGridManager; diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh index f18b4648..da7fa5d9 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh @@ -68,11 +68,12 @@ public: // set Neumann BCs to all boundaries first values.setAllNeumann(); -#if EXNUMBER == 0 // flow from top to bottom +#if EXNUMBER == 0 // set a Dirichlet boundary condition at the bottom if (onLowerBoundary_(scvf.center())) values.setAllDirichlet(); #endif + // set the coupling boundary condition at the interface if (couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf)) values.setAllCouplingNeumann(); diff --git a/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh index ceadde6c..431b9a5e 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh @@ -204,9 +204,9 @@ public: for ([[maybe_unused]] auto&& scv : scvs(fvGeometry)) { + // calculation of the water mass over all present phases for(int phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) { - // insert calculation of the water mass here #if EXNUMBER >= 2 const auto& volVars = elemVolVars[scv]; waterMass += volVars.massFraction(phaseIdx, FluidSystem::H2OIdx) * volVars.density(phaseIdx) @@ -264,7 +264,7 @@ public: NumEqVector flux = couplingManager().couplingData().massCouplingCondition(element, fvGeometry, elemVolVars, scvf) * scvf.area() * elemVolVars[scvf.insideScvIdx()].extrusionFactor() * FluidSystem::molarMass(1) * -1.0 * 86400.0; #else - NumEqVector flux(0.0); // add "massCouplingCondition" from the couplingManager here + NumEqVector flux(0.0); #endif faceEvaporation.push_back(flux[transportCompIdx]); } @@ -357,6 +357,8 @@ public: static const Scalar freeflowPressure = getParamFromGroup<Scalar>("Freeflow", "Problem.Pressure"); PrimaryVariables values(0.0); + values[pressureIdx] = freeflowPressure; + #if EXNUMBER >= 3 values.setState(3/*bothPhases*/); values[saturationIdx] = saturation_; @@ -366,7 +368,7 @@ public: #else values[transportCompIdx] = moleFraction_; #endif - values[pressureIdx] = freeflowPressure; + return values; } diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh index abda9b6e..0138dbf7 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh @@ -11,7 +11,6 @@ #ifndef DUMUX_FREEFLOW_TURBULENCE_SUBPROBLEM_SOL_HH #define DUMUX_FREEFLOW_TURBULENCE_SUBPROBLEM_SOL_HH - #include <dumux/common/properties.hh> #include <dumux/common/boundarytypes.hh> #include <dumux/common/timeloop.hh> @@ -104,7 +103,6 @@ public: turbulentKineticEnergy_ = turbulenceProperties.turbulentKineticEnergy(refVelocity_, diameter, kinematicViscosity); dissipation_ = turbulenceProperties.dissipationRate(refVelocity_, diameter, kinematicViscosity); #endif - } /*! diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc b/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc index d6aa013e..8427e700 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc @@ -121,10 +121,11 @@ int main(int argc, char** argv) auto solOld = sol; couplingManager->init(freeflowProblem, porousMediumProblem, sol); - // TODO: update static wall properties - // TODO: update dynamic wall properties + #if EXNUMBER >= 1 + // Update static wall properties freeflowProblem->updateStaticWallProperties(); + // Update dynamic wall properties freeflowProblem->updateDynamicWallProperties(freeflowSol); #endif @@ -181,7 +182,7 @@ int main(int argc, char** argv) solOld = sol; #if EXNUMBER >= 1 - // TODO: update dynamic wall properties + // Update dynamic wall properties freeflowProblem->updateDynamicWallProperties(freeflowSol); #endif diff --git a/exercises/solution/exercise-mainfile/exercise_mainfile_a_solution.input b/exercises/solution/exercise-mainfile/exercise_mainfile_a_solution.input index c9eb9c07..f621fa49 100644 --- a/exercises/solution/exercise-mainfile/exercise_mainfile_a_solution.input +++ b/exercises/solution/exercise-mainfile/exercise_mainfile_a_solution.input @@ -15,4 +15,4 @@ PermeabilityLens = 1e-12 # [m^2] [Assembly.NumericDifference] PriVarMagnitude = 1e5 -BaseEpsilon = 1e-10 \ No newline at end of file +BaseEpsilon = 1e-10 diff --git a/exercises/solution/exercise-runtimeparams/params.input b/exercises/solution/exercise-runtimeparams/params.input index 542e29f6..4e356277 100644 --- a/exercises/solution/exercise-runtimeparams/params.input +++ b/exercises/solution/exercise-runtimeparams/params.input @@ -25,4 +25,4 @@ PermeabilityAquifer = 1e-12 # m^2 Aquifer.BrooksCoreyPcEntry = 1e4 # Pa Aquifer.BrooksCoreyLambda = 2.0 Aquifer.Swr = 0.2 -Aquifer.Snr = 0.0 \ No newline at end of file +Aquifer.Snr = 0.0 -- GitLab