From ae9343da24fc81e07dd08b8ad24cb707b9ecb304 Mon Sep 17 00:00:00 2001 From: Ned Coltman <edward.coltman@iws.uni-stuttgart.de> Date: Tue, 4 Apr 2023 17:49:27 +0200 Subject: [PATCH] [ex][ffpm] set the boundary condtions for SST more clearly --- exercises/exercise-coupling-ff-pm/README.md | 11 +++++--- .../turbulence/freeflowsubproblem.hh | 12 ++++++++ .../turbulence/freeflowsubproblem.hh | 28 +++++++++---------- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/exercises/exercise-coupling-ff-pm/README.md b/exercises/exercise-coupling-ff-pm/README.md index 6066ca60..50756d14 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 07c1b7fb..6859b9c6 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 daf89074..11042b53 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; -- GitLab