diff --git a/exercises/exercise-coupling-ff-pm/README.md b/exercises/exercise-coupling-ff-pm/README.md index 9357f8d77097a70f2a1f2ad48813dedba6f58e23..739569c67d4bb8274b2c60eb1e88e4fa3579b1c3 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 2fd193dcf2fe5a3f340ab7e651690207ff32b7f2..8ef01b7e68d413ea597e4ac2956ca6647abf8835 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 45317a4583f97f55a4e489d8768fec8ad45168dd..e083d38aece298468b187e93ee673462738703ae 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; }