1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "porousBafflePressureFvPatchFields.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "volFields.H"
29 #include "surfaceFields.H"
31 #include "compressible/turbulenceModel/turbulenceModel.H"
32 #include "incompressible/turbulenceModel/turbulenceModel.H"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 makeTemplatePatchTypeField
45 porousBafflePressureFvPatchScalarField
48 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
50 //- Specialisation of the jump-condition for the pressure
52 void Foam::porousBafflePressureFvPatchField<Foam::scalar>::updateCoeffs()
59 const label patchI = patch().index();
61 const surfaceScalarField& phi =
62 db().lookupObject<surfaceScalarField>("phi");
64 const fvsPatchField<scalar>& phip =
65 patch().patchField<surfaceScalarField, scalar>(phi);
67 scalarField Un(phip/patch().magSf());
69 scalarField magUn(mag(Un));
71 if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
73 const incompressible::turbulenceModel& model =
74 db().lookupObject<incompressible::turbulenceModel>
79 const scalarField nuEffw = model.nuEff()().boundaryField()[patchI];
81 jump_ = -sign(Un)*(I_*nuEffw + D_*0.5*magUn*length_)*magUn;
85 const compressible::turbulenceModel& model =
86 db().lookupObject<compressible::turbulenceModel>
91 const scalarField muEffw = model.muEff()().boundaryField()[patchI];
93 const scalarField rhow =
94 patch().lookupPatchField<volScalarField, scalar>("rho");
98 jump_ = -sign(Un)*(I_*muEffw + D_*0.5*rhow*magUn*length_)*magUn;
103 scalar avePressureJump = gAverage(jump_);
104 scalar aveVelocity = gAverage(mag(Un));
106 Info<< patch().boundaryMesh().mesh().name() << ':'
107 << patch().name() << ':'
108 << " Average pressure drop :" << avePressureJump
109 << " Average velocity :" << aveVelocity
113 fixedJumpFvPatchField<scalar>::updateCoeffs();
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 } // End namespace Foam
121 // ************************************************************************* //