From 47cc58d3d66cde024300828472b5cfe01bf4df68 Mon Sep 17 00:00:00 2001 From: Ned Coltman <edward.coltman@iws.uni-stuttgart.de> Date: Thu, 30 Mar 2023 13:28:53 +0200 Subject: [PATCH] [exercises][ff-pm][interface] Add an extra points task (horizontal velocity BCs) --- exercises/exercise-coupling-ff-pm/README.md | 4 ++++ .../interface/CMakeLists.txt | 5 +++++ .../interface/freeflowsubproblem.hh | 16 +++++++++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/exercises/exercise-coupling-ff-pm/README.md b/exercises/exercise-coupling-ff-pm/README.md index 9357f8d7..739569c6 100644 --- a/exercises/exercise-coupling-ff-pm/README.md +++ b/exercises/exercise-coupling-ff-pm/README.md @@ -195,6 +195,10 @@ The final result should look 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 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 `initialAtPos` method. ### 2. Changing the porous medium model diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/CMakeLists.txt b/exercises/solution/exercise-coupling-ff-pm/interface/CMakeLists.txt index 2fd193dc..8ef01b7e 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/CMakeLists.txt +++ b/exercises/solution/exercise-coupling-ff-pm/interface/CMakeLists.txt @@ -18,5 +18,10 @@ dumux_add_test(NAME exercise_interface_coupling_ff-pm_c_solution LABELS ffpm COMPILE_DEFINITIONS EXNUMBER=3) +dumux_add_test(NAME exercise_interface_coupling_ff-pm_extra_solution + SOURCES main.cc + LABELS ffpm + COMPILE_DEFINITIONS EXNUMBER=4) + # add a symlink for each input file add_input_file_links() diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh index 45317a45..e083d38a 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh @@ -81,7 +81,7 @@ public: const auto& globalPos = scvf.dofPosition(); -#if EXNUMBER == 0 // flow from top to bottom +#if EXNUMBER == 0 // flow from top to bottom if(onUpperBoundary_(globalPos)) { values.setDirichlet(Indices::velocityXIdx); @@ -93,7 +93,7 @@ public: values.setDirichlet(Indices::velocityXIdx); values.setDirichlet(Indices::velocityYIdx); } -#else // flow flom left to right +#elif EXNUMBER < 4 // flow flom left to right if(onLeftBoundary_(globalPos) || onRightBoundary_(globalPos)) values.setDirichlet(Indices::pressureIdx); else @@ -101,6 +101,14 @@ public: values.setDirichlet(Indices::velocityXIdx); values.setDirichlet(Indices::velocityYIdx); } +#else + if (onRightBoundary_(globalPos)) + values.setDirichlet(Indices::pressureIdx); + else + { + values.setDirichlet(Indices::velocityXIdx); + values.setDirichlet(Indices::velocityYIdx); + } #endif if(couplingManager().isCoupledEntity(CouplingManager::stokesIdx, scvf)) @@ -199,6 +207,9 @@ public: PrimaryVariables values(0.0); #if EXNUMBER == 0 values[Indices::velocityYIdx] = -1e-6 * globalPos[0] * (this->gridGeometry().bBoxMax()[0] - globalPos[0]); +#elif EXNUMBER == 4 + values[Indices::velocityXIdx] = 1e-6 * (globalPos[1] - this->gridGeometry().bBoxMin()[1]) + * (this->gridGeometry().bBoxMax()[1] - globalPos[1]); #else // set fixed pressures on the left and right boundary if(onLeftBoundary_(globalPos)) @@ -206,7 +217,6 @@ public: if(onRightBoundary_(globalPos)) values[Indices::pressureIdx] = 0.0; #endif - return values; } -- GitLab