From 06e2a6b791da684cd17394eb87c2a26a8a827406 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 9 Mar 2012 14:56:54 +0000 Subject: [PATCH 1/2] STYLE: added further explanation to Q utility header --- applications/utilities/postProcessing/velocityField/Q/Q.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/applications/utilities/postProcessing/velocityField/Q/Q.C b/applications/utilities/postProcessing/velocityField/Q/Q.C index 74de3084b5..0f9c6d8d8c 100644 --- a/applications/utilities/postProcessing/velocityField/Q/Q.C +++ b/applications/utilities/postProcessing/velocityField/Q/Q.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,8 @@ Application Description Calculates and writes the second invariant of the velocity gradient tensor. + Q = 0.5*(sqr(tr(gradU)) - tr(((gradU)&(gradU)))) [1/s^2] + The -noWrite option just outputs the max/min values without writing the field. From f849409c20604c0317037077811f1151c7a9d121 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Mar 2012 08:47:16 +0000 Subject: [PATCH 2/2] BUG: Corrected use of rho if reference pressure is kinematic --- .../pressureCoefficient/pressureCoefficient.C | 27 +++++++++---------- .../pressureCoefficient/pressureCoefficient.H | 12 +++------ 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/postProcessing/functionObjects/utilities/pressureCoefficient/pressureCoefficient.C b/src/postProcessing/functionObjects/utilities/pressureCoefficient/pressureCoefficient.C index 5ec597f9bf..b4d1e30c87 100644 --- a/src/postProcessing/functionObjects/utilities/pressureCoefficient/pressureCoefficient.C +++ b/src/postProcessing/functionObjects/utilities/pressureCoefficient/pressureCoefficient.C @@ -34,9 +34,16 @@ defineTypeNameAndDebug(Foam::pressureCoefficient, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -Foam::tmp Foam::pressureCoefficient::rho() const +Foam::tmp Foam::pressureCoefficient::rho +( + const volScalarField& p +) const { - if (rhoName_ == "rhoInf") + if (p.dimensions() == dimPressure) + { + return(obr_.lookupObject(rhoName_)); + } + else { const fvMesh& mesh = refCast(obr_); @@ -51,14 +58,10 @@ Foam::tmp Foam::pressureCoefficient::rho() const mesh ), mesh, - dimensionedScalar("rho", dimDensity, rhoRef_) + dimensionedScalar("rho", dimless, 1.0) ) ); } - else - { - return(obr_.lookupObject(rhoName_)); - } } @@ -76,8 +79,7 @@ Foam::pressureCoefficient::pressureCoefficient obr_(obr), active_(true), pName_("p"), - rhoName_(word::null), - rhoRef_(-GREAT), + rhoName_("rho"), magUinf_(0.0) { // Check if the available mesh is an fvMesh, otherwise deactivate @@ -114,12 +116,7 @@ void Foam::pressureCoefficient::read(const dictionary& dict) if (active_) { pName_ = dict.lookupOrDefault("pName", "p"); - rhoName_ = dict.lookupOrDefault("rhoName", "rho"); - if (rhoName_ == "rhoInf") - { - dict.lookup("rhoInf") >> rhoRef_; - } dict.lookup("magUinf") >> magUinf_; } @@ -153,7 +150,7 @@ void Foam::pressureCoefficient::write() obr_, IOobject::NO_READ ), - p/(0.5*rho()*sqr(magUinf_)) + p/(0.5*rho(p)*sqr(magUinf_)) ); pressureCoefficient.write(); diff --git a/src/postProcessing/functionObjects/utilities/pressureCoefficient/pressureCoefficient.H b/src/postProcessing/functionObjects/utilities/pressureCoefficient/pressureCoefficient.H index aaf0ca499b..5f0379aa7f 100644 --- a/src/postProcessing/functionObjects/utilities/pressureCoefficient/pressureCoefficient.H +++ b/src/postProcessing/functionObjects/utilities/pressureCoefficient/pressureCoefficient.H @@ -77,21 +77,15 @@ class pressureCoefficient //- Name of density field (optional) word rhoName_; - //- Reference density needed for incompressible calculations [kg/m3] - scalar rhoRef_; - //- Free stream velocity magnitude [m/s] scalar magUinf_; // Private Member Functions - //- Return rho if rhoName is specified otherwise rhoRef - tmp rho() const; - - //- Return rhoRef if the pressure field is dynamic, i.e. p/rho - // otherwise return 1 - scalar rho(const volScalarField& p) const; + //- Return 1 if the pressure field is kinematic, i.e. p/rho + // otherwise return rho from database + tmp rho(const volScalarField& p) const; //- Disallow default bitwise copy construct pressureCoefficient(const pressureCoefficient&);