FreeFOAM The Cross-Platform CFD Toolkit
mixedFvPatchField.H
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 Class
25  Foam::mixedFvPatchField
26 
27 Description
28  Foam::mixedFvPatchField
29 
30 SourceFiles
31  mixedFvPatchField.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef mixedFvPatchField_H
36 #define mixedFvPatchField_H
37 
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class mixedFvPatch Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class Type>
51 :
52  public fvPatchField<Type>
53 {
54  // Private data
55 
56  //- Value field
57  Field<Type> refValue_;
58 
59  //- Normal gradient field
60  Field<Type> refGrad_;
61 
62  //- Fraction (0-1) of value used for boundary condition
63  scalarField valueFraction_;
64 
65 
66 public:
67 
68  //- Runtime type information
69  TypeName("mixed");
70 
71 
72  // Constructors
73 
74  //- Construct from patch and internal field
76  (
77  const fvPatch&,
79  );
80 
81  //- Construct from patch, internal field and dictionary
83  (
84  const fvPatch&,
86  const dictionary&
87  );
88 
89  //- Construct by mapping the given mixedFvPatchField onto a new patch
91  (
93  const fvPatch&,
95  const fvPatchFieldMapper&
96  );
97 
98  //- Construct as copy
100  (
102  );
103 
104  //- Construct and return a clone
105  virtual tmp<fvPatchField<Type> > clone() const
106  {
107  return tmp<fvPatchField<Type> >
108  (
109  new mixedFvPatchField<Type>(*this)
110  );
111  }
112 
113  //- Construct as copy setting internal field reference
115  (
118  );
119 
120  //- Construct and return a clone setting internal field reference
121  virtual tmp<fvPatchField<Type> > clone
122  (
124  ) const
125  {
126  return tmp<fvPatchField<Type> >
127  (
128  new mixedFvPatchField<Type>(*this, iF)
129  );
130  }
131 
132 
133  // Member functions
134 
135  // Access
136 
137  //- Return true if this patch field fixes a value.
138  // Needed to check if a level has to be specified while solving
139  // Poissons equations.
140  virtual bool fixesValue() const
141  {
142  return true;
143  }
144 
145 
146  // Return defining fields
147 
149  {
150  return refValue_;
151  }
152 
153  virtual const Field<Type>& refValue() const
154  {
155  return refValue_;
156  }
157 
158  virtual Field<Type>& refGrad()
159  {
160  return refGrad_;
161  }
162 
163  virtual const Field<Type>& refGrad() const
164  {
165  return refGrad_;
166  }
167 
169  {
170  return valueFraction_;
171  }
172 
173  virtual const scalarField& valueFraction() const
174  {
175  return valueFraction_;
176  }
177 
178 
179  // Mapping functions
180 
181  //- Map (and resize as needed) from self given a mapping object
182  virtual void autoMap
183  (
184  const fvPatchFieldMapper&
185  );
186 
187  //- Reverse map the given fvPatchField onto this fvPatchField
188  virtual void rmap
189  (
190  const fvPatchField<Type>&,
191  const labelList&
192  );
193 
194 
195  // Evaluation functions
196 
197  //- Return gradient at boundary
198  virtual tmp<Field<Type> > snGrad() const;
199 
200  //- Evaluate the patch field
201  virtual void evaluate
202  (
203  const Pstream::commsTypes commsType=Pstream::blocking
204  );
205 
206  //- Return the matrix diagonal coefficients corresponding to the
207  // evaluation of the value of this patchField with given weights
209  (
210  const tmp<scalarField>&
211  ) const;
212 
213  //- Return the matrix source coefficients corresponding to the
214  // evaluation of the value of this patchField with given weights
216  (
217  const tmp<scalarField>&
218  ) const;
219 
220  //- Return the matrix diagonal coefficients corresponding to the
221  // evaluation of the gradient of this patchField
222  virtual tmp<Field<Type> > gradientInternalCoeffs() const;
223 
224  //- Return the matrix source coefficients corresponding to the
225  // evaluation of the gradient of this patchField
226  virtual tmp<Field<Type> > gradientBoundaryCoeffs() const;
227 
228 
229  //- Write
230  virtual void write(Ostream&) const;
231 
232 
233  // Member operators
234 
235  virtual void operator=(const UList<Type>&) {}
236 
237  virtual void operator=(const fvPatchField<Type>&) {}
238  virtual void operator+=(const fvPatchField<Type>&) {}
239  virtual void operator-=(const fvPatchField<Type>&) {}
240  virtual void operator*=(const fvPatchField<scalar>&) {}
241  virtual void operator/=(const fvPatchField<scalar>&) {}
242 
243  virtual void operator+=(const Field<Type>&) {}
244  virtual void operator-=(const Field<Type>&) {}
245 
246  virtual void operator*=(const Field<scalar>&) {}
247  virtual void operator/=(const Field<scalar>&) {}
248 
249  virtual void operator=(const Type&) {}
250  virtual void operator+=(const Type&) {}
251  virtual void operator-=(const Type&) {}
252  virtual void operator*=(const scalar) {}
253  virtual void operator/=(const scalar) {}
254 };
255 
256 
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 
259 } // End namespace Foam
260 
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 
263 #ifdef NoRepository
265 #endif
266 
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
268 
269 #endif
270 
271 // ************************ vim: set sw=4 sts=4 et: ************************ //