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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2017 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::slicedFvPatchField
29 
30 Group
31  grpGenericBoundaryConditions
32 
33 Description
34  Specialization of fvPatchField which creates the underlying
35  fvPatchField as a slice of the given complete field.
36 
37  The destructor is wrapped to avoid deallocation of the storage of the
38  complete fields when this is destroyed.
39 
40  Should only used as a template argument for SlicedGeometricField.
41 
42 See also
43  Foam::fvPatchField
44 
45 SourceFiles
46  slicedFvPatchField.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef slicedFvPatchField_H
51 #define slicedFvPatchField_H
52 
53 #include "fvPatchField.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class slicedFvPatch Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class Type>
66 :
67  public fvPatchField<Type>
68 {
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("sliced");
74 
75 
76  // Constructors
77 
78  //- Construct from patch, internal field and field to slice
80  (
81  const fvPatch&,
83  const Field<Type>&
84  );
85 
86  //- Construct from patch and internal field. Assign value later.
88  (
89  const fvPatch&,
91  );
92 
93  //- Construct from patch, internal field and dictionary
95  (
96  const fvPatch&,
98  const dictionary&
99  );
100 
101  //- Construct by mapping the given slicedFvPatchField<Type>
102  // onto a new patch
104  (
106  const fvPatch&,
108  const fvPatchFieldMapper&
109  );
110 
111  //- Construct as copy
113 
114  //- Construct and return a clone
115  virtual tmp<fvPatchField<Type>> clone() const;
116 
117  //- Construct as copy setting internal field reference
119  (
122  );
123 
124  //- Construct and return a clone setting internal field reference
126  (
128  ) const;
129 
130 
131  //- Destructor
132  virtual ~slicedFvPatchField<Type>();
133 
134 
135  // Member functions
136 
137  // Attributes
138 
139  //- Return true if this patch field fixes a value.
140  // Needed to check if a level has to be specified while solving
141  // Poissons equations.
142  virtual bool fixesValue() const
143  {
144  return true;
145  }
146 
147  //- Return false: this patch field is not altered by assignment
148  virtual bool assignable() const
149  {
150  return false;
151  }
152 
153 
154  // Evaluation functions
155 
156  //- Return patch-normal gradient
157  virtual tmp<Field<Type>> snGrad() const;
158 
159  //- Return internal field next to patch as patch field
160  virtual tmp<Field<Type>> patchInternalField() const;
161 
162  //- Return internal field next to patch as patch field
163  virtual void patchInternalField(Field<Type>&) const;
164 
165  //- Return neighbour coupled given internal cell data
167  (
168  const Field<Type>& iField
169  ) const;
170 
171  //- Return patchField of the values on the patch or on the
172  // opposite patch
173  virtual tmp<Field<Type>> patchNeighbourField() const;
174 
175  //- Initialise the evaluation of the patch field
176  virtual void initEvaluate
177  (
178  const Pstream::commsTypes commsType =
180  )
181  {}
182 
183  //- Evaluate the patch field, sets Updated to false
184  virtual void evaluate
185  (
186  const Pstream::commsTypes commsType =
188  )
189  {}
190 
191  //- Return the matrix diagonal coefficients corresponding to the
192  // evaluation of the value of this patchField with given weights
194  (
195  const tmp<scalarField>&
196  ) const;
197 
198  //- Return the matrix source coefficients corresponding to the
199  // evaluation of the value of this patchField with given weights
201  (
202  const tmp<scalarField>&
203  ) const;
204 
205  //- Return the matrix diagonal coefficients corresponding to the
206  // evaluation of the gradient of this patchField
207  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
208 
209  //- Return the matrix source coefficients corresponding to the
210  // evaluation of the gradient of this patchField
211  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
212 
213 
214  //- Write
215  virtual void write(Ostream&) const;
216 
217 
218  // Member operators
219 
220  virtual void operator=(const UList<Type>&) {}
221 
222  virtual void operator=(const fvPatchField<Type>&) {}
223  virtual void operator+=(const fvPatchField<Type>&) {}
224  virtual void operator-=(const fvPatchField<Type>&) {}
225  virtual void operator*=(const fvPatchField<scalar>&) {}
226  virtual void operator/=(const fvPatchField<scalar>&) {}
227 
228  virtual void operator+=(const Field<Type>&) {}
229  virtual void operator-=(const Field<Type>&) {}
230 
231  virtual void operator*=(const Field<scalar>&) {}
232  virtual void operator/=(const Field<scalar>&) {}
233 
234  virtual void operator=(const Type&) {}
235  virtual void operator+=(const Type&) {}
236  virtual void operator-=(const Type&) {}
237  virtual void operator*=(const scalar) {}
238  virtual void operator/=(const scalar) {}
239 };
240 
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 } // End namespace Foam
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #ifdef NoRepository
249  #include "slicedFvPatchField.C"
250 #endif
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 #endif
255 
256 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
Foam::slicedFvPatchField::operator*=
virtual void operator*=(const fvPatchField< scalar > &)
Definition: slicedFvPatchField.H:224
Foam::slicedFvPatchField::operator/=
virtual void operator/=(const scalar)
Definition: slicedFvPatchField.H:237
Foam::slicedFvPatchField::snGrad
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Definition: slicedFvPatchField.C:157
Foam::slicedFvPatchField::gradientInternalCoeffs
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
Definition: slicedFvPatchField.C:233
Foam::slicedFvPatchField::operator=
virtual void operator=(const fvPatchField< Type > &)
Definition: slicedFvPatchField.H:221
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::slicedFvPatchField::valueBoundaryCoeffs
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
Definition: slicedFvPatchField.C:221
Foam::slicedFvPatchField::operator-=
virtual void operator-=(const Field< Type > &)
Definition: slicedFvPatchField.H:228
Foam::slicedFvPatchField::operator+=
virtual void operator+=(const Type &)
Definition: slicedFvPatchField.H:234
Foam::slicedFvPatchField::operator-=
virtual void operator-=(const fvPatchField< Type > &)
Definition: slicedFvPatchField.H:223
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::slicedFvPatchField::operator-=
virtual void operator-=(const Type &)
Definition: slicedFvPatchField.H:235
Foam::slicedFvPatchField::slicedFvPatchField
slicedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const Field< Type > &)
Construct from patch, internal field and field to slice.
Definition: slicedFvPatchField.C:35
Foam::slicedFvPatchField::TypeName
TypeName("sliced")
Runtime type information.
Foam::slicedFvPatchField::fixesValue
virtual bool fixesValue() const
Return true if this patch field fixes a value.
Definition: slicedFvPatchField.H:141
Foam::slicedFvPatchField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field, sets Updated to false.
Definition: slicedFvPatchField.H:184
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::slicedFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Definition: slicedFvPatchField.C:104
Foam::slicedFvPatchField::patchNeighbourField
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField of the values on the patch or on the.
Definition: slicedFvPatchField.C:197
Foam::slicedFvPatchField::valueInternalCoeffs
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Definition: slicedFvPatchField.C:208
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::slicedFvPatchField::operator/=
virtual void operator/=(const fvPatchField< scalar > &)
Definition: slicedFvPatchField.H:225
Foam::slicedFvPatchField::initEvaluate
virtual void initEvaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Initialise the evaluation of the patch field.
Definition: slicedFvPatchField.H:176
Foam::slicedFvPatchField::assignable
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
Definition: slicedFvPatchField.H:147
Foam::slicedFvPatchField
Specialization of fvPatchField which creates the underlying fvPatchField as a slice of the given comp...
Definition: slicedFvPatchField.H:64
Foam::slicedFvPatchField::operator/=
virtual void operator/=(const Field< scalar > &)
Definition: slicedFvPatchField.H:231
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::slicedFvPatchField::operator=
virtual void operator=(const Type &)
Definition: slicedFvPatchField.H:233
Foam::slicedFvPatchField::operator+=
virtual void operator+=(const Field< Type > &)
Definition: slicedFvPatchField.H:227
Foam::slicedFvPatchField::operator+=
virtual void operator+=(const fvPatchField< Type > &)
Definition: slicedFvPatchField.H:222
Foam::slicedFvPatchField::gradientBoundaryCoeffs
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
Definition: slicedFvPatchField.C:243
Foam::UList< Type >
slicedFvPatchField.C
Foam::slicedFvPatchField::operator=
virtual void operator=(const UList< Type > &)
Definition: slicedFvPatchField.H:219
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::slicedFvPatchField::patchInternalField
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
Definition: slicedFvPatchField.C:167
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::slicedFvPatchField::operator*=
virtual void operator*=(const scalar)
Definition: slicedFvPatchField.H:236
Foam::slicedFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: slicedFvPatchField.C:252
Foam::slicedFvPatchField::operator*=
virtual void operator*=(const Field< scalar > &)
Definition: slicedFvPatchField.H:230
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::UPstream::commsTypes::blocking
fvPatchField.H