fixedRhoFvPatchScalarField.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-2012 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 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
34 (
35  const fvPatch& p,
36  const DimensionedField<scalar, volMesh>& iF
37 )
38 :
39  fixedValueFvPatchScalarField(p, iF),
40  pName_("p"),
41  psiName_("thermo:psi")
42 {}
43 
44 
46 (
47  const fixedRhoFvPatchScalarField& ptf,
48  const fvPatch& p,
49  const DimensionedField<scalar, volMesh>& iF,
50  const fvPatchFieldMapper& mapper
51 )
52 :
53  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
54  pName_(ptf.pName_),
55  psiName_(ptf.psiName_)
56 {}
57 
58 
60 (
61  const fvPatch& p,
62  const DimensionedField<scalar, volMesh>& iF,
63  const dictionary& dict
64 )
65 :
66  fixedValueFvPatchScalarField(p, iF, dict),
67  pName_(dict.lookupOrDefault<word>("p", "p")),
68  psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi"))
69 {}
70 
71 
73 (
74  const fixedRhoFvPatchScalarField& frpsf
75 )
76 :
77  fixedValueFvPatchScalarField(frpsf),
78  pName_(frpsf.pName_),
79  psiName_(frpsf.psiName_)
80 {}
81 
82 
84 (
85  const fixedRhoFvPatchScalarField& frpsf,
86  const DimensionedField<scalar, volMesh>& iF
87 )
88 :
89  fixedValueFvPatchScalarField(frpsf, iF),
90  pName_(frpsf.pName_),
91  psiName_(frpsf.psiName_)
92 {}
93 
94 
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 
98 {
99  if (updated())
100  {
101  return;
102  }
103 
104  const fvPatchField<scalar>& psip =
105  patch().lookupPatchField<volScalarField, scalar>(psiName_);
106 
107  const fvPatchField<scalar>& pp =
108  patch().lookupPatchField<volScalarField, scalar>(pName_);
109 
110  operator==(psip*pp);
111 
112  fixedValueFvPatchScalarField::updateCoeffs();
113 }
114 
115 
116 void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const
117 {
119 
120  writeEntryIfDifferent<word>(os, "p", "p", this->pName_);
121  writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_);
122  writeEntry("value", os);
123 }
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 namespace Foam
128 {
130  (
132  fixedRhoFvPatchScalarField
133  );
134 }
135 
136 // ************************************************************************* //
bool updated() const
Return true if the boundary condition has already been updated.
Definition: fvPatchField.H:348
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:354
Namespace for OpenFOAM.
const GeometricField::PatchFieldType & lookupPatchField(const word &name, const GeometricField *=NULL, const Type *=NULL) const
Lookup and return the patchField of the named field from the.
dictionary dict
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
volScalarField & p
Definition: createFields.H:51
void writeEntry(const word &keyword, Ostream &os) const
Write the field as a dictionary entry.
Definition: Field.C:634
Macros for easy insertion into run-time selection tables.
fvPatchField< scalar > fvPatchScalarField
virtual void operator==(const fvPatchField< Type > &)
Definition: fvPatchField.C:559
fixedRhoFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
makePatchTypeField(fvPatchVectorField, SRFFreestreamVelocityFvPatchVectorField)
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:300
virtual void write(Ostream &) const
Write.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.