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 See also
35  Foam::fvPatchField
36 
37 SourceFiles
38  slicedFvPatchField.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef slicedFvPatchField_H
43 #define slicedFvPatchField_H
44 
45 #include "fvPatchField.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class slicedFvPatch Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template<class Type>
58 :
59  public fvPatchField<Type>
60 {
61 
62 public:
63 
64  //- Runtime type information
65  TypeName("sliced");
66 
67 
68  // Constructors
69 
70  //- Construct from patch, internal field and field to slice
72  (
73  const fvPatch&,
75  const Field<Type>&
76  );
77 
78  //- Construct from patch and internal field. Assign value later.
80  (
81  const fvPatch&,
83  const fvPatchField<Type>&
84  );
85 
86  //- Disallow copy without setting internal field reference
88 
89  //- Copy constructor setting internal field reference
91  (
94  );
95 
96  //- Construct and return a clone setting internal field reference
98  (
100  ) const
101  {
102  return tmp<fvPatchField<Type>>
103  (
104  new slicedFvPatchField<Type>(*this, iF)
105  );
106  };
107 
108 
109  //- Destructor
110  virtual ~slicedFvPatchField();
111 
112 
113  // Member Functions
114 
115  // Attributes
116 
117  //- Return true if this patch field fixes a value.
118  // Needed to check if a level has to be specified while solving
119  // Poissons equations.
120  virtual bool fixesValue() const
121  {
122  return true;
123  }
124 
125  //- Return false: this patch field is not altered by assignment
126  virtual bool assignable() const
127  {
128  return false;
129  }
130 
131 
132  // Evaluation functions
133 
134  //- Return patch-normal gradient
135  virtual tmp<Field<Type>> snGrad() const;
136 
137  //- Update the coefficients associated with the patch field
138  // Sets Updated to true
139  virtual void updateCoeffs();
140 
141  //- Initialise the evaluation of the patch field
142  virtual void initEvaluate
143  (
144  const Pstream::commsTypes commsType =
146  )
147  {}
148 
149  //- Evaluate the patch field, sets Updated to false
150  virtual void evaluate
151  (
152  const Pstream::commsTypes commsType =
154  )
155  {}
156 
157  //- Return the matrix diagonal coefficients corresponding to the
158  // evaluation of the value of this patchField with given weights
160  (
161  const tmp<scalarField>&
162  ) const;
163 
164  //- Return the matrix source coefficients corresponding to the
165  // evaluation of the value of this patchField with given weights
167  (
168  const tmp<scalarField>&
169  ) const;
170 
171  //- Return the matrix diagonal coefficients corresponding to the
172  // evaluation of the gradient of this patchField
173  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
174 
175  //- Return the matrix source coefficients corresponding to the
176  // evaluation of the gradient of this patchField
177  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
178 
179 
180  //- Write
181  virtual void write(Ostream&) const;
182 
183 
184  // Member Operators
185 
186  virtual void operator=(const UList<Type>&) {}
187 
188  virtual void operator=(const fvPatchField<Type>&) {}
189  virtual void operator+=(const fvPatchField<Type>&) {}
190  virtual void operator-=(const fvPatchField<Type>&) {}
191  virtual void operator*=(const fvPatchField<scalar>&) {}
192  virtual void operator/=(const fvPatchField<scalar>&) {}
193 
194  virtual void operator+=(const Field<Type>&) {}
195  virtual void operator-=(const Field<Type>&) {}
196 
197  virtual void operator*=(const Field<scalar>&) {}
198  virtual void operator/=(const Field<scalar>&) {}
199 
200  virtual void operator=(const Type&) {}
201  virtual void operator+=(const Type&) {}
202  virtual void operator-=(const Type&) {}
203  virtual void operator*=(const scalar) {}
204  virtual void operator/=(const scalar) {}
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #ifdef NoRepository
215  #include "slicedFvPatchField.C"
216 #endif
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
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:91
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:216
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.