1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 "fixedGradientFvPatchField.H"
28 #include "dictionary.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
38 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
41 const DimensionedField<Type, volMesh>& iF
44 fvPatchField<Type>(p, iF),
45 gradient_(p.size(), pTraits<Type>::zero)
50 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
52 const fixedGradientFvPatchField<Type>& ptf,
54 const DimensionedField<Type, volMesh>& iF,
55 const fvPatchFieldMapper& mapper
58 fvPatchField<Type>(ptf, p, iF, mapper),
59 gradient_(ptf.gradient_, mapper)
64 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
67 const DimensionedField<Type, volMesh>& iF,
68 const dictionary& dict
71 fvPatchField<Type>(p, iF, dict),
72 gradient_("gradient", dict, p.size())
79 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
81 const fixedGradientFvPatchField<Type>& ptf
84 fvPatchField<Type>(ptf),
85 gradient_(ptf.gradient_)
90 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
92 const fixedGradientFvPatchField<Type>& ptf,
93 const DimensionedField<Type, volMesh>& iF
96 fvPatchField<Type>(ptf, iF),
97 gradient_(ptf.gradient_)
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 void fixedGradientFvPatchField<Type>::autoMap
106 const fvPatchFieldMapper& m
109 fvPatchField<Type>::autoMap(m);
110 gradient_.autoMap(m);
115 void fixedGradientFvPatchField<Type>::rmap
117 const fvPatchField<Type>& ptf,
118 const labelList& addr
121 fvPatchField<Type>::rmap(ptf, addr);
123 const fixedGradientFvPatchField<Type>& fgptf =
124 refCast<const fixedGradientFvPatchField<Type> >(ptf);
126 gradient_.rmap(fgptf.gradient_, addr);
131 void fixedGradientFvPatchField<Type>::evaluate(const Pstream::commsTypes)
133 if (!this->updated())
135 this->updateCoeffs();
138 Field<Type>::operator=
140 this->patchInternalField() + gradient_/this->patch().deltaCoeffs()
143 fvPatchField<Type>::evaluate();
148 tmp<Field<Type> > fixedGradientFvPatchField<Type>::valueInternalCoeffs
150 const tmp<scalarField>&
153 return tmp<Field<Type> >(new Field<Type>(this->size(), pTraits<Type>::one));
158 tmp<Field<Type> > fixedGradientFvPatchField<Type>::valueBoundaryCoeffs
160 const tmp<scalarField>&
163 return gradient()/this->patch().deltaCoeffs();
168 tmp<Field<Type> > fixedGradientFvPatchField<Type>::
169 gradientInternalCoeffs() const
171 return tmp<Field<Type> >
173 new Field<Type>(this->size(), pTraits<Type>::zero)
179 tmp<Field<Type> > fixedGradientFvPatchField<Type>::
180 gradientBoundaryCoeffs() const
187 void fixedGradientFvPatchField<Type>::write(Ostream& os) const
189 fvPatchField<Type>::write(os);
190 gradient_.writeEntry("gradient", os);
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 } // End namespace Foam
198 // ************************************************************************* //