freestreamPressureFvPatchScalarField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 #include "fvPatchFieldMapper.H"
29 #include "volFields.H"
30 #include "surfaceFields.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
37 (
38  const fvPatch& p,
40 )
41 :
42  zeroGradientFvPatchScalarField(p, iF),
43  UName_("U"),
44  phiName_("phi"),
45  rhoName_("none")
46 {}
47 
48 
51 (
52  const fvPatch& p,
54  const dictionary& dict
55 )
56 :
57  zeroGradientFvPatchScalarField(p, iF, dict),
58  UName_(dict.lookupOrDefault<word>("U", "U")),
59  phiName_(dict.lookupOrDefault<word>("phi", "phi")),
60  rhoName_(dict.lookupOrDefault<word>("rho", "none"))
61 {}
62 
63 
66 (
68  const fvPatch& p,
70  const fvPatchFieldMapper& mapper
71 )
72 :
73  zeroGradientFvPatchScalarField(ptf, p, iF, mapper),
74  UName_(ptf.UName_),
75  phiName_(ptf.phiName_),
76  rhoName_(ptf.rhoName_)
77 {}
78 
79 
82 (
84 )
85 :
86  zeroGradientFvPatchScalarField(wbppsf),
87  UName_(wbppsf.UName_),
88  phiName_(wbppsf.phiName_),
89  rhoName_(wbppsf.rhoName_)
90 {}
91 
92 
95 (
98 )
99 :
100  zeroGradientFvPatchScalarField(wbppsf, iF),
101  UName_(wbppsf.UName_),
102  phiName_(wbppsf.phiName_),
103  rhoName_(wbppsf.rhoName_)
104 {}
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 
110 {
111  if (updated())
112  {
113  return;
114  }
115 
116  const freestreamFvPatchVectorField& Up =
117  refCast<const freestreamFvPatchVectorField>
118  (
119  patch().lookupPatchField<volVectorField, vector>(UName_)
120  );
121 
122  const surfaceScalarField& phi =
123  db().lookupObject<surfaceScalarField>(phiName_);
124 
125  fvsPatchField<scalar>& phip =
126  const_cast<fvsPatchField<scalar>&>
127  (
128  patch().patchField<surfaceScalarField, scalar>(phi)
129  );
130 
131  if (phi.dimensions() == dimVelocity*dimArea)
132  {
133  phip = patch().Sf() & Up.freestreamValue();
134  }
135  else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
136  {
137  const fvPatchField<scalar>& rhop =
138  patch().lookupPatchField<volScalarField, scalar>(rhoName_);
139 
140  phip = rhop*(patch().Sf() & Up.freestreamValue());
141  }
142  else
143  {
145  << "dimensions of phi are not correct"
146  << "\n on patch " << this->patch().name()
147  << " of field " << this->dimensionedInternalField().name()
148  << " in file " << this->dimensionedInternalField().objectPath()
149  << exit(FatalError);
150  }
151 
152  zeroGradientFvPatchScalarField::updateCoeffs();
153 }
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 namespace Foam
159 {
161  (
164  );
165 }
166 
167 // ************************************************************************* //
Foam::fvPatchField< scalar >
volFields.H
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
freestreamPressureFvPatchScalarField.H
Foam::dimVelocity
const dimensionSet dimVelocity
Foam::dimDensity
const dimensionSet dimDensity
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::freestreamPressureFvPatchScalarField
This boundary condition provides a free-stream condition for pressure. It is a zero-gradient conditio...
Definition: freestreamPressureFvPatchScalarField.H:98
dimensionedInternalField
rDeltaT dimensionedInternalField()
Foam::fvsPatchField
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:65
Foam::freestreamPressureFvPatchScalarField::UName_
word UName_
Name of the velocity field.
Definition: freestreamPressureFvPatchScalarField.H:105
surfaceFields.H
Foam::surfaceFields.
fvPatchFieldMapper.H
Foam::freestreamPressureFvPatchScalarField::freestreamPressureFvPatchScalarField
freestreamPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: freestreamPressureFvPatchScalarField.C:37
Foam::freestreamPressureFvPatchScalarField::phiName_
word phiName_
Name of the flux transporting the field.
Definition: freestreamPressureFvPatchScalarField.H:108
Foam::dimArea
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:57
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
freestreamFvPatchFields.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::freestreamPressureFvPatchScalarField::rhoName_
word rhoName_
Name of the density field used to normalise the mass flux.
Definition: freestreamPressureFvPatchScalarField.H:112
Foam::freestreamPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: freestreamPressureFvPatchScalarField.C:109
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::makePatchTypeField
makePatchTypeField(fvPatchVectorField, SRFFreestreamVelocityFvPatchVectorField)
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:52
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51