diff --git a/exercises/exercise-coupling-ff-pm/README.md b/exercises/exercise-coupling-ff-pm/README.md index 6066ca60bd888009cd9d1e7a370e75cf6825f7a0..50756d140e289f8860026a2d608fc64c001806c1 100644 --- a/exercises/exercise-coupling-ff-pm/README.md +++ b/exercises/exercise-coupling-ff-pm/README.md @@ -382,11 +382,14 @@ freeflowProblem->updateDynamicWallProperties(freeflowSol); In addition to designating the locations of walls, additional boundary conditions and initial conditions need to be set for the two new primary variables $k$ and $\omega$. In the `boundaryTypes` function, set both variables on all walls to be dirichlet, except for the right boundary, which should have outflow conditions. + For the initial conditions, Reynolds number specific base conditions should be applied everywhere. In the problem constructor, uncomment the code calculating these terms, -then apply the `turbulentKineticEnergy_`and `dissipation_` variables to their primary variables in all locations, -except for the wall boundaries, where these values can be set to zero. -In addition, dirichlet constraints for the dissipation or $\omega$ variable will be set for all wall adjacent cells. +then apply the `turbulentKineticEnergy_`and `dissipation_` variables to their primary variables in all locations. +Within the dirichlet function for cell faces (`dirichlet(element, scvf)`), +we also need to specify that these variables should be fixed to 0 at the wall. + +In addition, dirichlet cell constraints for the dissipation or $\omega$ variable will be set for all wall adjacent cells. This is done in the `isDirichletCell` function, as well as the `dirichlet` function already, and requires no further changes. Compile and run your new coupled problem and take a look at the results in Paraview. @@ -405,7 +408,7 @@ you can use symmetric boundary conditions at the top boundary of your free flow values.setAllSymmetry(); ``` -In addition, you have to remove the condition `onUpperBoundary_(globalPos)` from the `initialAtPos(globalPos)` method. +In addition, you have to remove the condition `onUpperBoundary_(globalPos)` from the `initialAtPos(globalPos)` method and the `dirichlet(element, scvf)` method. __Task C__: diff --git a/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh index 07c1b7fb708b304a80a8d9eb6292dbe06b9985bc..6859b9c661a999743db4a8fc4245d994505e69ca 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh @@ -181,6 +181,18 @@ public: { const auto globalPos = scvf.ipGlobal(); PrimaryVariables values(initialAtPos(globalPos)); + + // TODO: dumux-course-task 3.A + // Add dirichlet conditions setting TKE and Dissipation to zero on the upper and lower walls. + // TODO: dumux-course-task 3.B + // Remove the condition `onUpperBoundary_(globalPos)` here. + // if (onUpperBoundary_(globalPos) || onLowerBoundary_(globalPos)) + // { + // values[Indices::turbulentKineticEnergyIdx] = 0.0; + // values[Indices::dissipationIdx] = 0.0; + // } + } + 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 daf89074bcf5a0f48e4b9a5106167ba661cc2458..11042b533bd30eee26438880cc87db821bbc9773 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh @@ -216,6 +216,20 @@ public: { const auto globalPos = scvf.ipGlobal(); PrimaryVariables values(initialAtPos(globalPos)); + +#if EXNUMBER == 1 + if (onUpperBoundary_(globalPos) || onLowerBoundary_(globalPos)) + { + values[Indices::turbulentKineticEnergyIdx] = 0.0; + values[Indices::dissipationIdx] = 0.0; + } +#elif EXNUMBER >= 2 + if (onLowerBoundary_(globalPos)) + { + values[Indices::turbulentKineticEnergyIdx] = 0.0; + values[Indices::dissipationIdx] = 0.0; + } +#endif return values; } @@ -327,20 +341,6 @@ public: values[Indices::dissipationIdx] = dissipation_; #endif -#if EXNUMBER == 1 - if (onLowerBoundary_(globalPos) || onUpperBoundary_(globalPos)) - { - values[Indices::turbulentKineticEnergyIdx] = 0.0; - values[Indices::dissipationIdx] = 0.0; - } -#elif EXNUMBER >= 2 - if (onLowerBoundary_(globalPos) || onUpperBoundary_(globalPos)) - { - values[Indices::turbulentKineticEnergyIdx] = 0.0; - values[Indices::dissipationIdx] = 0.0; - } -#endif - #if EXNUMBER >= 2 if(onLowerBoundary_(globalPos)) values[Indices::velocityXIdx] = 0.0;