initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / basic / fixedGradient / fixedGradientFvPatchField.C
blob7e7a622e69edf02ee8d8199436cf128bc504f317
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
35 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
37 template<class Type>
38 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
40     const fvPatch& p,
41     const DimensionedField<Type, volMesh>& iF
44     fvPatchField<Type>(p, iF),
45     gradient_(p.size(), pTraits<Type>::zero)
49 template<class Type>
50 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
52     const fixedGradientFvPatchField<Type>& ptf,
53     const fvPatch& p,
54     const DimensionedField<Type, volMesh>& iF,
55     const fvPatchFieldMapper& mapper
58     fvPatchField<Type>(ptf, p, iF, mapper),
59     gradient_(ptf.gradient_, mapper)
63 template<class Type>
64 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
66     const fvPatch& p,
67     const DimensionedField<Type, volMesh>& iF,
68     const dictionary& dict
71     fvPatchField<Type>(p, iF, dict),
72     gradient_("gradient", dict, p.size())
74     evaluate();
78 template<class Type>
79 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
81     const fixedGradientFvPatchField<Type>& ptf
84     fvPatchField<Type>(ptf),
85     gradient_(ptf.gradient_)
89 template<class Type>
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  * * * * * * * * * * * * * //
103 template<class Type>
104 void fixedGradientFvPatchField<Type>::autoMap
106     const fvPatchFieldMapper& m
109     fvPatchField<Type>::autoMap(m);
110     gradient_.autoMap(m);
114 template<class Type>
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);
130 template<class Type>
131 void fixedGradientFvPatchField<Type>::evaluate(const Pstream::commsTypes)
133     if (!this->updated())
134     {
135         this->updateCoeffs();
136     }
138     Field<Type>::operator=
139     (
140         this->patchInternalField() + gradient_/this->patch().deltaCoeffs()
141     );
143     fvPatchField<Type>::evaluate();
147 template<class Type>
148 tmp<Field<Type> > fixedGradientFvPatchField<Type>::valueInternalCoeffs
150     const tmp<scalarField>&
151 ) const
153     return tmp<Field<Type> >(new Field<Type>(this->size(), pTraits<Type>::one));
157 template<class Type>
158 tmp<Field<Type> > fixedGradientFvPatchField<Type>::valueBoundaryCoeffs
160     const tmp<scalarField>&
161 ) const
163     return gradient()/this->patch().deltaCoeffs();
167 template<class Type>
168 tmp<Field<Type> > fixedGradientFvPatchField<Type>::
169 gradientInternalCoeffs() const
171     return tmp<Field<Type> >
172     (
173         new Field<Type>(this->size(), pTraits<Type>::zero)
174     );
178 template<class Type>
179 tmp<Field<Type> > fixedGradientFvPatchField<Type>::
180 gradientBoundaryCoeffs() const
182     return gradient();
186 template<class Type>
187 void fixedGradientFvPatchField<Type>::write(Ostream& os) const
189     fvPatchField<Type>::write(os);
190     gradient_.writeEntry("gradient", os);
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 } // End namespace Foam
198 // ************************************************************************* //