From 01cbfce031f9401a954303f7a4b2143bf0ed09b5 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Fri, 8 Jan 2021 08:45:04 +0000 Subject: [PATCH] Merge branch 'fix/rotsym-navierstokes' into 'master' [bugfix][navierstokes][radsym] Fix rotational symmetric Navier-Stokes with pressure normalization See merge request dumux-repositories/dumux!2435 (cherry picked from commit f89cee8e0e904f51825aca42067c88f9dd9945f1) 6a1fa49a [bugfix][navierstokes][radsym] Fix rotational symmetric Navier-Stokes with pressure normalization 0e6f7a14 [test][ff][pipe] Test for non-zero initial pressure --- dumux/freeflow/navierstokes/staggered/localresidual.hh | 8 +++++++- test/freeflow/navierstokes/channel/pipe/params.input | 3 +-- test/freeflow/navierstokes/channel/pipe/problem.hh | 8 +++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dumux/freeflow/navierstokes/staggered/localresidual.hh b/dumux/freeflow/navierstokes/staggered/localresidual.hh index b0abdc46ba..82c9af5702 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 9bcb4dacc3..66b549898c 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 91668701cd..21ed3446d6 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_; -- GitLab