diff --git a/dumux/freeflow/navierstokes/staggered/localresidual.hh b/dumux/freeflow/navierstokes/staggered/localresidual.hh index b0abdc46ba886800bc9527181363bb72e0e59b7a..82c9af570224a75fd9d6d88384c07630e50e42b1 100644 --- a/dumux/freeflow/navierstokes/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokes/staggered/localresidual.hh @@ -86,6 +86,8 @@ class NavierStokesResidualImpl<TypeTag, DiscretizationMethod::staggered> using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; + static constexpr bool normalizePressure = getPropValue<TypeTag, Properties::NormalizePressure>(); + using CellCenterResidual = CellCenterPrimaryVariables; using FaceResidual = FacePrimaryVariables; @@ -192,7 +194,11 @@ public: // Pressure term (needed because we incorporate pressure in terms of a surface integral). // grad(p) becomes div(pI) + (p/r)*n_r in cylindrical coordinates. The second term // is new with respect to Cartesian coordinates and handled below as a source term. - source += insideVolVars.pressure()/r; + const Scalar pressure = + normalizePressure ? insideVolVars.pressure() - problem.initial(scvf)[Indices::pressureIdx] + : insideVolVars.pressure(); + + source += pressure/r; } } diff --git a/test/freeflow/navierstokes/channel/pipe/params.input b/test/freeflow/navierstokes/channel/pipe/params.input index 9bcb4dacc3c10c43bbeba8a960d68da7c40292c3..66b549898c5ff69a86d5b5125ea5f657adef2aea 100644 --- a/test/freeflow/navierstokes/channel/pipe/params.input +++ b/test/freeflow/navierstokes/channel/pipe/params.input @@ -9,8 +9,7 @@ Grading1 = 1 [Problem] Name = test_ff_stokes_channel_pipe MeanInletVelocity = 0.1 # [m/s] - -[Problem] +InitialPressure = 1.0e5 # [Pa] EnableGravity = false EnableInertiaTerms = false diff --git a/test/freeflow/navierstokes/channel/pipe/problem.hh b/test/freeflow/navierstokes/channel/pipe/problem.hh index 91668701cdd87676fa18c63501cc941ccc36c94d..21ed3446d619000aa3fa0012c0ab3a1f98095bb8 100644 --- a/test/freeflow/navierstokes/channel/pipe/problem.hh +++ b/test/freeflow/navierstokes/channel/pipe/problem.hh @@ -52,6 +52,7 @@ public: { name_ = getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name"); meanInletVelocity_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.MeanInletVelocity"); + initialPressure_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.InitialPressure"); mu_ = getParam<Scalar>("Component.LiquidKinematicViscosity")*getParam<Scalar>("Component.LiquidDensity"); pipeRadius_ = this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0]; @@ -109,7 +110,11 @@ public: { return analyticalSolution(globalPos); } PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const - { return PrimaryVariables(0.0); } + { + PrimaryVariables values(0.0); + values[Indices::pressureIdx] = initialPressure_; + return values; + } PrimaryVariables analyticalSolution(const GlobalPosition& globalPos) const { @@ -139,6 +144,7 @@ private: { return globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_; } std::string name_; + Scalar initialPressure_; Scalar meanInletVelocity_; Scalar mu_; Scalar pipeRadius_, pipeLength_;