FreeFOAM The Cross-Platform CFD Toolkit
fixedGradientFvPatchField.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) 1991-2010 OpenCFD Ltd.
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 
27 #include <OpenFOAM/dictionary.H>
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
35 
36 template<class Type>
38 (
39  const fvPatch& p,
41 )
42 :
43  fvPatchField<Type>(p, iF),
44  gradient_(p.size(), pTraits<Type>::zero)
45 {}
46 
47 
48 template<class Type>
50 (
52  const fvPatch& p,
54  const fvPatchFieldMapper& mapper
55 )
56 :
57  fvPatchField<Type>(ptf, p, iF, mapper),
58  gradient_(ptf.gradient_, mapper)
59 {}
60 
61 
62 template<class Type>
64 (
65  const fvPatch& p,
67  const dictionary& dict
68 )
69 :
70  fvPatchField<Type>(p, iF, dict),
71  gradient_("gradient", dict, p.size())
72 {
73  evaluate();
74 }
75 
76 
77 template<class Type>
79 (
81 )
82 :
83  fvPatchField<Type>(ptf),
84  gradient_(ptf.gradient_)
85 {}
86 
87 
88 template<class Type>
90 (
93 )
94 :
95  fvPatchField<Type>(ptf, iF),
96  gradient_(ptf.gradient_)
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
102 template<class Type>
104 (
105  const fvPatchFieldMapper& m
106 )
107 {
109  gradient_.autoMap(m);
110 }
111 
112 
113 template<class Type>
115 (
116  const fvPatchField<Type>& ptf,
117  const labelList& addr
118 )
119 {
120  fvPatchField<Type>::rmap(ptf, addr);
121 
122  const fixedGradientFvPatchField<Type>& fgptf =
123  refCast<const fixedGradientFvPatchField<Type> >(ptf);
124 
125  gradient_.rmap(fgptf.gradient_, addr);
126 }
127 
128 
129 template<class Type>
131 {
132  if (!this->updated())
133  {
134  this->updateCoeffs();
135  }
136 
138  (
139  this->patchInternalField() + gradient_/this->patch().deltaCoeffs()
140  );
141 
143 }
144 
145 
146 template<class Type>
148 (
149  const tmp<scalarField>&
150 ) const
151 {
152  return tmp<Field<Type> >(new Field<Type>(this->size(), pTraits<Type>::one));
153 }
154 
155 
156 template<class Type>
158 (
159  const tmp<scalarField>&
160 ) const
161 {
162  return gradient()/this->patch().deltaCoeffs();
163 }
164 
165 
166 template<class Type>
169 {
170  return tmp<Field<Type> >
171  (
172  new Field<Type>(this->size(), pTraits<Type>::zero)
173  );
174 }
175 
176 
177 template<class Type>
180 {
181  return gradient();
182 }
183 
184 
185 template<class Type>
187 {
189  gradient_.writeEntry("gradient", os);
190 }
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace Foam
196 
197 // ************************ vim: set sw=4 sts=4 et: ************************ //