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-2024 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  return tmp<fvPatchField<Type>>
105  (
106  new slicedFvPatchField<Type>(*this, iF)
107  );
108  };
109 
110 
111  //- Destructor
112  virtual ~slicedFvPatchField();
113 
114 
115  // Member Functions
116 
117  // Attributes
118 
119  //- Return true if this patch field fixes a value.
120  // Needed to check if a level has to be specified while solving
121  // Poissons equations.
122  virtual bool fixesValue() const
123  {
124  return true;
125  }
126 
127  //- Return false: this patch field is not altered by assignment
128  virtual bool assignable() const
129  {
130  return false;
131  }
132 
133 
134  // Evaluation functions
135 
136  //- Return patch-normal gradient
137  virtual tmp<Field<Type>> snGrad() const;
138 
139  //- Update the coefficients associated with the patch field
140  // Sets Updated to true
141  virtual void updateCoeffs();
142 
143  //- Initialise the evaluation of the patch field
144  virtual void initEvaluate
145  (
146  const Pstream::commsTypes commsType =
148  )
149  {}
150 
151  //- Evaluate the patch field, sets Updated to false
152  virtual void evaluate
153  (
154  const Pstream::commsTypes commsType =
156  )
157  {}
158 
159  //- Return the matrix diagonal coefficients corresponding to the
160  // evaluation of the value of this patchField with given weights
162  (
163  const tmp<scalarField>&
164  ) const;
165 
166  //- Return the matrix source coefficients corresponding to the
167  // evaluation of the value of this patchField with given weights
169  (
170  const tmp<scalarField>&
171  ) const;
172 
173  //- Return the matrix diagonal coefficients corresponding to the
174  // evaluation of the gradient of this patchField
175  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
176 
177  //- Return the matrix source coefficients corresponding to the
178  // evaluation of the gradient of this patchField
179  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
180 
181 
182  //- Write
183  virtual void write(Ostream&) const;
184 
185 
186  // Member Operators
187 
188  virtual void operator=(const UList<Type>&) {}
189 
190  virtual void operator=(const fvPatchField<Type>&) {}
191  virtual void operator+=(const fvPatchField<Type>&) {}
192  virtual void operator-=(const fvPatchField<Type>&) {}
193  virtual void operator*=(const fvPatchField<scalar>&) {}
194  virtual void operator/=(const fvPatchField<scalar>&) {}
195 
196  virtual void operator+=(const Field<Type>&) {}
197  virtual void operator-=(const Field<Type>&) {}
198 
199  virtual void operator*=(const Field<scalar>&) {}
200  virtual void operator/=(const Field<scalar>&) {}
201 
202  virtual void operator=(const Type&) {}
203  virtual void operator+=(const Type&) {}
204  virtual void operator-=(const Type&) {}
205  virtual void operator*=(const scalar) {}
206  virtual void operator/=(const scalar) {}
207 };
208 
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 } // End namespace Foam
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #ifdef NoRepository
217  #include "slicedFvPatchField.C"
218 #endif
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #endif
223 
224 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Definition: Field.H:83
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
commsTypes
Types of communications.
Definition: UPstream.H:65
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:204
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Specialisation of fvPatchField which creates the underlying fvPatchField as a slice of the given comp...
virtual void initEvaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Initialise the evaluation of the patch field.
virtual bool fixesValue() const
Return true if this patch field fixes a value.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field, sets Updated to false.
virtual void write(Ostream &) const
Write.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual void operator+=(const fvPatchField< Type > &)
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
virtual void operator/=(const fvPatchField< scalar > &)
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
virtual void operator*=(const fvPatchField< scalar > &)
virtual void operator-=(const fvPatchField< Type > &)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void operator=(const UList< Type > &)
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual ~slicedFvPatchField()
Destructor.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
slicedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const Field< Type > &)
Construct from patch, internal field and field to slice.
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
TypeName("sliced")
Runtime type information.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.