1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "fixedFluxBuoyantPressureFvPatchScalarField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvPatchFieldMapper.H"
30 #include "volFields.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 fixedFluxBuoyantPressureFvPatchScalarField::
40 fixedFluxBuoyantPressureFvPatchScalarField
43 const DimensionedField<scalar, volMesh>& iF
46 fixedGradientFvPatchScalarField(p, iF)
50 fixedFluxBuoyantPressureFvPatchScalarField::
51 fixedFluxBuoyantPressureFvPatchScalarField
53 const fixedFluxBuoyantPressureFvPatchScalarField& ptf,
55 const DimensionedField<scalar, volMesh>& iF,
56 const fvPatchFieldMapper& mapper
59 fixedGradientFvPatchScalarField(ptf, p, iF, mapper)
63 fixedFluxBuoyantPressureFvPatchScalarField::
64 fixedFluxBuoyantPressureFvPatchScalarField
67 const DimensionedField<scalar, volMesh>& iF,
71 fixedGradientFvPatchScalarField(p, iF)
73 fvPatchField<scalar>::operator=(patchInternalField());
78 fixedFluxBuoyantPressureFvPatchScalarField::
79 fixedFluxBuoyantPressureFvPatchScalarField
81 const fixedFluxBuoyantPressureFvPatchScalarField& wbppsf
84 fixedGradientFvPatchScalarField(wbppsf)
88 fixedFluxBuoyantPressureFvPatchScalarField::
89 fixedFluxBuoyantPressureFvPatchScalarField
91 const fixedFluxBuoyantPressureFvPatchScalarField& wbppsf,
92 const DimensionedField<scalar, volMesh>& iF
95 fixedGradientFvPatchScalarField(wbppsf, iF)
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 void fixedFluxBuoyantPressureFvPatchScalarField::updateCoeffs()
108 const dictionary& environmentalProperties
109 = db().lookupObject<IOdictionary>("environmentalProperties");
111 dimensionedVector g(environmentalProperties.lookup("g"));
113 const fvPatchField<scalar>& rho =
114 patch().lookupPatchField<volScalarField, scalar>("rho");
116 // If the variable name is "pd" assume it is p - rho*g.h
117 // and set the gradient appropriately.
118 // Otherwise assume the variable is the static pressure.
119 if (dimensionedInternalField().name() == "pd")
121 gradient() = -rho.snGrad()*(g.value() & patch().Cf());
125 gradient() = rho*(g.value() & patch().nf());
128 fixedGradientFvPatchScalarField::updateCoeffs();
132 void fixedFluxBuoyantPressureFvPatchScalarField::write(Ostream& os) const
134 fixedGradientFvPatchScalarField::write(os);
135 writeEntry("value", os);
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 fixedFluxBuoyantPressureFvPatchScalarField
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 } // End namespace Foam
151 // ************************************************************************* //