From 499b8813fcbac1e29f31808813c50f677267506d Mon Sep 17 00:00:00 2001 From: Martin Schneider <martin.schneider@iws.uni-stuttgart.de> Date: Mon, 29 Jul 2019 09:01:52 +0200 Subject: [PATCH] [course][exercises] Use new gravity method --- exercises/exercise-basic/injection2p2cproblem.hh | 2 +- exercises/exercise-basic/injection2pniproblem.hh | 2 +- exercises/exercise-basic/injection2pproblem.hh | 2 +- .../turbulence/ex_turbulence_pmproblem.hh | 2 +- exercises/exercise-fractures/fractureproblem.hh | 2 +- exercises/exercise-fractures/matrixproblem.hh | 2 +- exercises/exercise-grids/injection2pproblem.hh | 2 +- exercises/exercise-properties/problem.hh | 4 ++-- exercises/exercise-runtimeparams/injection2pproblem.hh | 2 +- exercises/solution/exercise-basic/injection2pniproblem.hh | 2 +- .../turbulence/ex_turbulence_pmproblem.hh | 2 +- exercises/solution/exercise-fractures/fractureproblem.hh | 2 +- exercises/solution/exercise-fractures/matrixproblem.hh | 2 +- exercises/solution/exercise-grids/injection2pproblem.hh | 2 +- exercises/solution/exercise-properties/problem.hh | 4 ++-- .../solution/exercise-runtimeparams/injection2pproblem.hh | 2 +- 16 files changed, 18 insertions(+), 18 deletions(-) diff --git a/exercises/exercise-basic/injection2p2cproblem.hh b/exercises/exercise-basic/injection2p2cproblem.hh index f564bffe..ab6ba038 100644 --- a/exercises/exercise-basic/injection2p2cproblem.hh +++ b/exercises/exercise-basic/injection2p2cproblem.hh @@ -251,7 +251,7 @@ public: // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative - const Scalar pw = 1.0e5 - densityW*this->gravity()[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); + const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); // initially we have some nitrogen dissolved // saturation mole fraction would be diff --git a/exercises/exercise-basic/injection2pniproblem.hh b/exercises/exercise-basic/injection2pniproblem.hh index 7642c96a..5d44bbce 100644 --- a/exercises/exercise-basic/injection2pniproblem.hh +++ b/exercises/exercise-basic/injection2pniproblem.hh @@ -253,7 +253,7 @@ public: // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative - const Scalar pw = 1.0e5 - densityW*this->gravity()[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); + const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); values[Indices::pressureIdx] = pw; values[Indices::saturationIdx] = 0.0; diff --git a/exercises/exercise-basic/injection2pproblem.hh b/exercises/exercise-basic/injection2pproblem.hh index a4f762b5..789a0311 100644 --- a/exercises/exercise-basic/injection2pproblem.hh +++ b/exercises/exercise-basic/injection2pproblem.hh @@ -250,7 +250,7 @@ public: // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative - const Scalar pw = 1.0e5 - densityW*this->gravity()[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); + const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); values[Indices::pressureIdx] = pw; values[Indices::saturationIdx] = 0.0; diff --git a/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh b/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh index 0ded6f6e..38ddb500 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh @@ -283,7 +283,7 @@ public: PrimaryVariables values(0.0); values.setState(initialPhasePresence_); - values[pressureIdx] = pressure_ + 1. * this->gravity()[1] * (globalPos[1] - this->fvGridGeometry().bBoxMax()[1]); + values[pressureIdx] = pressure_ + 1. * this->spatialParams().gravity(globalPos)[1] * (globalPos[1] - this->fvGridGeometry().bBoxMax()[1]); values[switchIdx] = initialSw_; values[Indices::temperatureIdx] = temperature_; diff --git a/exercises/exercise-fractures/fractureproblem.hh b/exercises/exercise-fractures/fractureproblem.hh index 5088241c..dc92eaa5 100644 --- a/exercises/exercise-fractures/fractureproblem.hh +++ b/exercises/exercise-fractures/fractureproblem.hh @@ -182,7 +182,7 @@ public: const auto domainHeight = this->fvGridGeometry().bBoxMax()[1]; // we assume a constant water density of 1000 for initial conditions! - const auto& g = this->gravityAtPos(globalPos); + const auto& g = this->spatialParams().gravity(globalPos); PrimaryVariables values; Scalar densityW = 1000.0; values[pressureIdx] = 1e5 - (domainHeight - globalPos[1])*densityW*g[1]; diff --git a/exercises/exercise-fractures/matrixproblem.hh b/exercises/exercise-fractures/matrixproblem.hh index 7c475d97..85092b7e 100644 --- a/exercises/exercise-fractures/matrixproblem.hh +++ b/exercises/exercise-fractures/matrixproblem.hh @@ -199,7 +199,7 @@ public: const auto domainHeight = this->fvGridGeometry().bBoxMax()[1]; // we assume a constant water density of 1000 for initial conditions! - const auto& g = this->gravityAtPos(globalPos); + const auto& g = this->spatialParams().gravity(globalPos); PrimaryVariables values; Scalar densityW = 1000.0; values[pressureIdx] = 1e5 - (domainHeight - globalPos[1])*densityW*g[1]; diff --git a/exercises/exercise-grids/injection2pproblem.hh b/exercises/exercise-grids/injection2pproblem.hh index 910b2ff8..01bf863a 100644 --- a/exercises/exercise-grids/injection2pproblem.hh +++ b/exercises/exercise-grids/injection2pproblem.hh @@ -241,7 +241,7 @@ public: // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative - const Scalar pw = 1.0e5 - densityW*this->gravity()[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); + const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); values[Indices::pressureIdx] = pw; values[Indices::saturationIdx] = 0.0; diff --git a/exercises/exercise-properties/problem.hh b/exercises/exercise-properties/problem.hh index f3360293..bc0cf945 100644 --- a/exercises/exercise-properties/problem.hh +++ b/exercises/exercise-properties/problem.hh @@ -157,7 +157,7 @@ public: Scalar factor = (width*alpha + (1.0 - alpha)*globalPos[0])/width; // hydrostatic pressure scaled by alpha - values[pressureH2OIdx] = 1e5 - factor*densityW*this->gravity()[1]*depth; + values[pressureH2OIdx] = 1e5 - factor*densityW*this->spatialParams().gravity(globalPos)[1]*depth; values[saturationDNAPLIdx] = 0.0; return values; @@ -203,7 +203,7 @@ public: Scalar depth = this->fvGridGeometry().bBoxMax()[1] - globalPos[1]; // hydrostatic pressure - values[pressureH2OIdx] = 1e5 - densityW*this->gravity()[1]*depth; + values[pressureH2OIdx] = 1e5 - densityW*this->spatialParams().gravity(globalPos)[1]*depth; values[saturationDNAPLIdx] = 0; return values; } diff --git a/exercises/exercise-runtimeparams/injection2pproblem.hh b/exercises/exercise-runtimeparams/injection2pproblem.hh index ea353268..d80f4949 100644 --- a/exercises/exercise-runtimeparams/injection2pproblem.hh +++ b/exercises/exercise-runtimeparams/injection2pproblem.hh @@ -242,7 +242,7 @@ public: // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative - const Scalar pw = 1.0e5 - densityW*this->gravity()[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); + const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); values[Indices::pressureIdx] = pw; values[Indices::saturationIdx] = 0.0; diff --git a/exercises/solution/exercise-basic/injection2pniproblem.hh b/exercises/solution/exercise-basic/injection2pniproblem.hh index 8d971152..ababa5ad 100644 --- a/exercises/solution/exercise-basic/injection2pniproblem.hh +++ b/exercises/solution/exercise-basic/injection2pniproblem.hh @@ -242,7 +242,7 @@ public: // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative - const Scalar pw = 1.0e5 - densityW*this->gravity()[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); + const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); values[Indices::pressureIdx] = pw; values[Indices::saturationIdx] = 0.0; diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh index 0ded6f6e..38ddb500 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh @@ -283,7 +283,7 @@ public: PrimaryVariables values(0.0); values.setState(initialPhasePresence_); - values[pressureIdx] = pressure_ + 1. * this->gravity()[1] * (globalPos[1] - this->fvGridGeometry().bBoxMax()[1]); + values[pressureIdx] = pressure_ + 1. * this->spatialParams().gravity(globalPos)[1] * (globalPos[1] - this->fvGridGeometry().bBoxMax()[1]); values[switchIdx] = initialSw_; values[Indices::temperatureIdx] = temperature_; diff --git a/exercises/solution/exercise-fractures/fractureproblem.hh b/exercises/solution/exercise-fractures/fractureproblem.hh index 1f74f6c6..e20a9bc5 100644 --- a/exercises/solution/exercise-fractures/fractureproblem.hh +++ b/exercises/solution/exercise-fractures/fractureproblem.hh @@ -186,7 +186,7 @@ public: const auto domainHeight = this->fvGridGeometry().bBoxMax()[1]; // we assume a constant water density of 1000 for initial conditions! - const auto& g = this->gravityAtPos(globalPos); + const auto& g = this->spatialParams().gravity(globalPos); PrimaryVariables values; Scalar densityW = 1000.0; values[pressureIdx] = 1e5 - (domainHeight - globalPos[1])*densityW*g[1]; diff --git a/exercises/solution/exercise-fractures/matrixproblem.hh b/exercises/solution/exercise-fractures/matrixproblem.hh index ab15c84c..e967be6f 100644 --- a/exercises/solution/exercise-fractures/matrixproblem.hh +++ b/exercises/solution/exercise-fractures/matrixproblem.hh @@ -251,7 +251,7 @@ public: const auto domainHeight = this->fvGridGeometry().bBoxMax()[1]; // we assume a constant water density of 1000 for initial conditions! - const auto& g = this->gravityAtPos(globalPos); + const auto& g = this->spatialParams().gravity(globalPos); PrimaryVariables values; Scalar densityW = 1000.0; values[pressureIdx] = 1e5 - (domainHeight - globalPos[1])*densityW*g[1]; diff --git a/exercises/solution/exercise-grids/injection2pproblem.hh b/exercises/solution/exercise-grids/injection2pproblem.hh index 101c0379..d152c88a 100644 --- a/exercises/solution/exercise-grids/injection2pproblem.hh +++ b/exercises/solution/exercise-grids/injection2pproblem.hh @@ -249,7 +249,7 @@ public: // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative - const Scalar pw = 1.0e5 - densityW*this->gravity()[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); + const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); values[Indices::pressureIdx] = pw; values[Indices::saturationIdx] = 0.0; diff --git a/exercises/solution/exercise-properties/problem.hh b/exercises/solution/exercise-properties/problem.hh index 1aae5fcb..66a822ec 100644 --- a/exercises/solution/exercise-properties/problem.hh +++ b/exercises/solution/exercise-properties/problem.hh @@ -157,7 +157,7 @@ public: Scalar factor = (width*alpha + (1.0 - alpha)*globalPos[0])/width; // hydrostatic pressure scaled by alpha - values[pressureH2OIdx] = 1e5 - factor*densityW*this->gravity()[1]*depth; + values[pressureH2OIdx] = 1e5 - factor*densityW*this->spatialParams().gravity(globalPos)[1]*depth; values[saturationDNAPLIdx] = 0.0; return values; @@ -206,7 +206,7 @@ public: Scalar depth = this->fvGridGeometry().bBoxMax()[1] - globalPos[1]; // hydrostatic pressure - values[pressureH2OIdx] = 1e5 - densityW*this->gravity()[1]*depth; + values[pressureH2OIdx] = 1e5 - densityW*this->spatialParams().gravity(globalPos)[1]*depth; values[saturationDNAPLIdx] = 0; return values; } diff --git a/exercises/solution/exercise-runtimeparams/injection2pproblem.hh b/exercises/solution/exercise-runtimeparams/injection2pproblem.hh index b2d79304..5eb8a949 100644 --- a/exercises/solution/exercise-runtimeparams/injection2pproblem.hh +++ b/exercises/solution/exercise-runtimeparams/injection2pproblem.hh @@ -248,7 +248,7 @@ public: // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative - const Scalar pw = 1.0e5 - densityW*this->gravity()[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); + const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); values[Indices::pressureIdx] = pw; values[Indices::saturationIdx] = 0.0; -- GitLab