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 "fixedGradientFvPatchField.H"
27 #include "dictionary.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
40 const DimensionedField<Type, volMesh>& iF
43 fvPatchField<Type>(p, iF),
44 gradient_(p.size(), pTraits<Type>::zero)
49 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
51 const fixedGradientFvPatchField<Type>& ptf,
53 const DimensionedField<Type, volMesh>& iF,
54 const fvPatchFieldMapper& mapper
57 fvPatchField<Type>(ptf, p, iF, mapper),
58 gradient_(ptf.gradient_, mapper)
63 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
66 const DimensionedField<Type, volMesh>& iF,
67 const dictionary& dict
70 fvPatchField<Type>(p, iF, dict),
71 gradient_("gradient", dict, p.size())
78 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
80 const fixedGradientFvPatchField<Type>& ptf
83 fvPatchField<Type>(ptf),
84 gradient_(ptf.gradient_)
89 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
91 const fixedGradientFvPatchField<Type>& ptf,
92 const DimensionedField<Type, volMesh>& iF
95 fvPatchField<Type>(ptf, iF),
96 gradient_(ptf.gradient_)
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
103 void fixedGradientFvPatchField<Type>::autoMap
105 const fvPatchFieldMapper& m
108 fvPatchField<Type>::autoMap(m);
109 gradient_.autoMap(m);
114 void fixedGradientFvPatchField<Type>::rmap
116 const fvPatchField<Type>& ptf,
117 const labelList& addr
120 fvPatchField<Type>::rmap(ptf, addr);
122 const fixedGradientFvPatchField<Type>& fgptf =
123 refCast<const fixedGradientFvPatchField<Type> >(ptf);
125 gradient_.rmap(fgptf.gradient_, addr);
130 void fixedGradientFvPatchField<Type>::evaluate(const Pstream::commsTypes)
132 if (!this->updated())
134 this->updateCoeffs();
137 Field<Type>::operator=
139 this->patchInternalField() + gradient_/this->patch().deltaCoeffs()
142 fvPatchField<Type>::evaluate();
147 tmp<Field<Type> > fixedGradientFvPatchField<Type>::valueInternalCoeffs
149 const tmp<scalarField>&
152 return tmp<Field<Type> >(new Field<Type>(this->size(), pTraits<Type>::one));
157 tmp<Field<Type> > fixedGradientFvPatchField<Type>::valueBoundaryCoeffs
159 const tmp<scalarField>&
162 return gradient()/this->patch().deltaCoeffs();
167 tmp<Field<Type> > fixedGradientFvPatchField<Type>::
168 gradientInternalCoeffs() const
170 return tmp<Field<Type> >
172 new Field<Type>(this->size(), pTraits<Type>::zero)
178 tmp<Field<Type> > fixedGradientFvPatchField<Type>::
179 gradientBoundaryCoeffs() const
186 void fixedGradientFvPatchField<Type>::write(Ostream& os) const
188 fvPatchField<Type>::write(os);
189 gradient_.writeEntry("gradient", os);
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 } // End namespace Foam
197 // ************************************************************************* //