slicedFvPatchField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
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  Specialisation 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 See also
37  Foam::fvPatchField
38 
39 SourceFiles
40  slicedFvPatchField.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef slicedFvPatchField_H
45 #define slicedFvPatchField_H
46 
47 #include "fvPatchField.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class slicedFvPatch Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template<class Type>
60 :
61  public fvPatchField<Type>
62 {
63 
64 public:
65 
66  //- Runtime type information
67  TypeName("sliced");
68 
69 
70  // Constructors
71 
72  //- Construct from patch, internal field and field to slice
74  (
75  const fvPatch&,
77  const Field<Type>&
78  );
79 
80  //- Construct from patch and internal field. Assign value later.
82  (
83  const fvPatch&,
85  const fvPatchField<Type>&
86  );
87 
88  //- Disallow copy without setting internal field reference
90 
91  //- Copy constructor setting internal field reference
93  (
96  );
97 
98  //- Construct and return a clone setting internal field reference
100  (
102  ) const;
103 
104 
105  //- Destructor
106  virtual ~slicedFvPatchField<Type>();
107 
108 
109  // Member Functions
110 
111  // Attributes
112 
113  //- Return true if this patch field fixes a value.
114  // Needed to check if a level has to be specified while solving
115  // Poissons equations.
116  virtual bool fixesValue() const
117  {
118  return true;
119  }
120 
121  //- Return false: this patch field is not altered by assignment
122  virtual bool assignable() const
123  {
124  return false;
125  }
126 
127 
128  // Evaluation functions
129 
130  //- Return patch-normal gradient
131  virtual tmp<Field<Type>> snGrad() const;
132 
133  //- Update the coefficients associated with the patch field
134  // Sets Updated to true
135  virtual void updateCoeffs();
136 
137  //- Initialise the evaluation of the patch field
138  virtual void initEvaluate
139  (
140  const Pstream::commsTypes commsType =
142  )
143  {}
144 
145  //- Evaluate the patch field, sets Updated to false
146  virtual void evaluate
147  (
148  const Pstream::commsTypes commsType =
150  )
151  {}
152 
153  //- Return the matrix diagonal coefficients corresponding to the
154  // evaluation of the value of this patchField with given weights
156  (
157  const tmp<scalarField>&
158  ) const;
159 
160  //- Return the matrix source coefficients corresponding to the
161  // evaluation of the value of this patchField with given weights
163  (
164  const tmp<scalarField>&
165  ) const;
166 
167  //- Return the matrix diagonal coefficients corresponding to the
168  // evaluation of the gradient of this patchField
169  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
170 
171  //- Return the matrix source coefficients corresponding to the
172  // evaluation of the gradient of this patchField
173  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
174 
175 
176  //- Write
177  virtual void write(Ostream&) const;
178 
179 
180  // Member Operators
182  virtual void operator=(const UList<Type>&) {}
184  virtual void operator=(const fvPatchField<Type>&) {}
185  virtual void operator+=(const fvPatchField<Type>&) {}
186  virtual void operator-=(const fvPatchField<Type>&) {}
187  virtual void operator*=(const fvPatchField<scalar>&) {}
188  virtual void operator/=(const fvPatchField<scalar>&) {}
190  virtual void operator+=(const Field<Type>&) {}
191  virtual void operator-=(const Field<Type>&) {}
193  virtual void operator*=(const Field<scalar>&) {}
194  virtual void operator/=(const Field<scalar>&) {}
196  virtual void operator=(const Type&) {}
197  virtual void operator+=(const Type&) {}
198  virtual void operator-=(const Type&) {}
199  virtual void operator*=(const scalar) {}
200  virtual void operator/=(const scalar) {}
201 };
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #ifdef NoRepository
211  #include "slicedFvPatchField.C"
212 #endif
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #endif
217 
218 // ************************************************************************* //
Specialisation of fvPatchField which creates the underlying fvPatchField as a slice of the given comp...
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field, sets Updated to false.
commsTypes
Types of communications.
Definition: UPstream.H:64
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Pre-declare SubField and related Field type.
Definition: Field.H:56
virtual void operator+=(const fvPatchField< Type > &)
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual bool fixesValue() const
Return true if this patch field fixes a value.
virtual void operator-=(const fvPatchField< Type > &)
virtual void write(Ostream &) const
Write.
TypeName("sliced")
Runtime type information.
virtual void operator*=(const fvPatchField< scalar > &)
virtual void operator/=(const fvPatchField< scalar > &)
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
slicedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const Field< Type > &)
Construct from patch, internal field and field to slice.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:199
virtual void initEvaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Initialise the evaluation of the patch field.
Namespace for OpenFOAM.
virtual void operator=(const UList< Type > &)