From 2bfa9c18f59fbceb76cb701bbcb9af6578a20d63 Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Tue, 29 Apr 2014 14:54:55 +0100 Subject: [PATCH] fvcMeshPhi: added 'relative' equivalent of absolute function --- .../finiteVolume/fvc/fvcMeshPhi.C | 37 ++++++++++++++++++- .../finiteVolume/fvc/fvcMeshPhi.H | 19 +++++++++- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.C b/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.C index 5c53f64fdd0..741321612c9 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.C +++ b/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -148,6 +148,41 @@ void Foam::fvc::makeAbsolute } +Foam::tmp<Foam::surfaceScalarField> Foam::fvc::relative +( + const tmp<surfaceScalarField>& tphi, + const volVectorField& U +) +{ + if (tphi().mesh().moving()) + { + return tphi - fvc::meshPhi(U); + } + else + { + return tmp<surfaceScalarField>(tphi, true); + } +} + + +Foam::tmp<Foam::surfaceScalarField> Foam::fvc::relative +( + const tmp<surfaceScalarField>& tphi, + const volScalarField& rho, + const volVectorField& U +) +{ + if (tphi().mesh().moving()) + { + return tphi - fvc::interpolate(rho)*fvc::meshPhi(rho, U); + } + else + { + return tmp<surfaceScalarField>(tphi, true); + } +} + + Foam::tmp<Foam::surfaceScalarField> Foam::fvc::absolute ( const tmp<surfaceScalarField>& tphi, diff --git a/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.H b/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.H index 4f47c381e39..e055d4d9703 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.H +++ b/src/finiteVolume/finiteVolume/fvc/fvcMeshPhi.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,6 @@ SourceFiles \*---------------------------------------------------------------------------*/ - #ifndef fvcMeshPhi_H #define fvcMeshPhi_H @@ -118,6 +117,22 @@ namespace fvc ); + //- Return the given absolute flux in relative form + tmp<surfaceScalarField> relative + ( + const tmp<surfaceScalarField>& tphi, + const volVectorField& U + ); + + //- Return the given absolute flux in relative form + tmp<surfaceScalarField> relative + ( + const tmp<surfaceScalarField>& tphi, + const volScalarField& rho, + const volVectorField& U + ); + + //- Return the given relative flux in absolute form tmp<surfaceScalarField> absolute ( -- GitLab