From f14e69bdc51458bff74589ab742e1714940fd355 Mon Sep 17 00:00:00 2001 From: Henry Weller <http://cfd.direct> Date: Wed, 14 Dec 2016 10:39:32 +0000 Subject: [PATCH] functionObjects::forceCoeffs: Corrected setting of rhoRef for compressible flow Resolves bug-report https://bugs.openfoam.org/view.php?id=2387 --- src/functionObjects/forces/forceCoeffs/forceCoeffs.C | 3 +++ src/functionObjects/forces/forces/forces.C | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/functionObjects/forces/forceCoeffs/forceCoeffs.C index 635edfd6f4..27a95872ac 100644 --- a/src/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -163,6 +163,9 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict) // Free stream velocity magnitude dict.lookup("magUInf") >> magUInf_; + // Reference (free stream) density + dict.lookup("rhoInf") >> rhoRef_; + // Reference length and area scales dict.lookup("lRef") >> lRef_; dict.lookup("Aref") >> Aref_; diff --git a/src/functionObjects/forces/forces/forces.C b/src/functionObjects/forces/forces/forces.C index ec0f0810e5..9ade518a92 100644 --- a/src/functionObjects/forces/forces/forces.C +++ b/src/functionObjects/forces/forces/forces.C @@ -638,7 +638,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict) // Reference density needed for incompressible calculations if (rhoName_ == "rhoInf") { - rhoRef_ = readScalar(dict.lookup("rhoInf")); + dict.lookup("rhoInf") >> rhoRef_; } // Reference pressure, 0 by default -- GitLab