FreeFOAM The Cross-Platform CFD Toolkit
slicedFvPatchField.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::slicedFvPatchField
26 
27 Description
28  Specialization of fvPatchField which creates the underlying
29  fvPatchField as a slice of the given complete field.
30 
31  The destructor is wrapped to avoid deallocation of the storage of the
32  complete fields when this is destroyed.
33 
34  Should only used as a template argument for SlicedGeometricField.
35 
36 SourceFiles
37  slicedFvPatchField.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef slicedFvPatchField_H
42 #define slicedFvPatchField_H
43 
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class slicedFvPatch Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class Type>
57 :
58  public fvPatchField<Type>
59 {
60 
61 public:
62 
63  //- Runtime type information
64  TypeName("sliced");
65 
66 
67  // Constructors
68 
69  //- Construct from patch, internal field and field to slice
71  (
72  const fvPatch&,
74  const Field<Type>&
75  );
76 
77  //- Construct from patch and internal field. Assign value later.
79  (
80  const fvPatch&,
82  );
83 
84  //- Construct from patch, internal field and dictionary
86  (
87  const fvPatch&,
89  const dictionary&
90  );
91 
92  //- Construct by mapping the given slicedFvPatchField<Type>
93  // onto a new patch
95  (
97  const fvPatch&,
99  const fvPatchFieldMapper&
100  );
101 
102  //- Construct as copy
104 
105  //- Construct and return a clone
106  virtual tmp<fvPatchField<Type> > clone() const;
107 
108  //- Construct as copy setting internal field reference
110  (
113  );
114 
115  //- Construct and return a clone setting internal field reference
116  virtual tmp<fvPatchField<Type> > clone
117  (
119  ) const;
120 
121 
122  // Destructor
123 
124  virtual ~slicedFvPatchField<Type>();
125 
126 
127  // Member functions
128 
129  // Access
130 
131  //- Return true if this patch field fixes a value.
132  // Needed to check if a level has to be specified while solving
133  // Poissons equations.
134  virtual bool fixesValue() const
135  {
136  return true;
137  }
138 
139 
140  // Evaluation functions
141 
142  //- Return patch-normal gradient
143  virtual tmp<Field<Type> > snGrad() const;
144 
145  //- Update the coefficients associated with the patch field
146  // Sets Updated to true
147  virtual void updateCoeffs();
148 
149  //- Return internal field next to patch as patch field
150  virtual tmp<Field<Type> > patchInternalField() const;
151 
152  //- Return neighbour coupled given internal cell data
154  (
155  const Field<Type>& iField
156  ) const;
157 
158  //- Return patchField of the values on the patch or on the
159  // opposite patch
160  virtual tmp<Field<Type> > patchNeighbourField() const;
161 
162  //- Initialise the evaluation of the patch field
163  virtual void initEvaluate
164  (
165  const Pstream::commsTypes commsType=Pstream::blocking
166  )
167  {}
168 
169  //- Evaluate the patch field, sets Updated to false
170  virtual void evaluate
171  (
172  const Pstream::commsTypes commsType=Pstream::blocking
173  )
174  {}
175 
176  //- Return the matrix diagonal coefficients corresponding to the
177  // evaluation of the value of this patchField with given weights
179  (
180  const tmp<scalarField>&
181  ) const;
182 
183  //- Return the matrix source coefficients corresponding to the
184  // evaluation of the value of this patchField with given weights
186  (
187  const tmp<scalarField>&
188  ) const;
189 
190  //- Return the matrix diagonal coefficients corresponding to the
191  // evaluation of the gradient of this patchField
192  virtual tmp<Field<Type> > gradientInternalCoeffs() const;
193 
194  //- Return the matrix source coefficients corresponding to the
195  // evaluation of the gradient of this patchField
196  virtual tmp<Field<Type> > gradientBoundaryCoeffs() const;
197 
198 
199  //- Write
200  virtual void write(Ostream&) const;
201 
202 
203  // Member operators
204 
205  virtual void operator=(const UList<Type>&) {}
206 
207  virtual void operator=(const fvPatchField<Type>&) {}
208  virtual void operator+=(const fvPatchField<Type>&) {}
209  virtual void operator-=(const fvPatchField<Type>&) {}
210  virtual void operator*=(const fvPatchField<scalar>&) {}
211  virtual void operator/=(const fvPatchField<scalar>&) {}
212 
213  virtual void operator+=(const Field<Type>&) {}
214  virtual void operator-=(const Field<Type>&) {}
215 
216  virtual void operator*=(const Field<scalar>&) {}
217  virtual void operator/=(const Field<scalar>&) {}
218 
219  virtual void operator=(const Type&) {}
220  virtual void operator+=(const Type&) {}
221  virtual void operator-=(const Type&) {}
222  virtual void operator*=(const scalar) {}
223  virtual void operator/=(const scalar) {}
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #ifdef NoRepository
235 #endif
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #endif
240 
241 // ************************ vim: set sw=4 sts=4 et: ************************ //