directionMixedFvPatchField.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-2023 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::directionMixedFvPatchField
26 
27 Description
28  Base class for direction-mixed boundary conditions.
29 
30 SourceFiles
31  directionMixedFvPatchField.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef directionMixedFvPatchField_H
36 #define directionMixedFvPatchField_H
37 
38 #include "transformFvPatchField.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class directionMixedFvPatchField Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class Type>
51 :
52  public transformFvPatchField<Type>
53 {
54  // Private Data
55 
56  //- Value field
57  Field<Type> refValue_;
58 
59  //- Normal gradient field
60  Field<Type> refGrad_;
61 
62  //- Fraction (0-1) of value used for boundary condition
63  symmTensorField valueFraction_;
64 
65 
66 public:
67 
68  //- Runtime type information
69  TypeName("directionMixed");
70 
71 
72  // Constructors
73 
74  //- Construct from patch and internal field
76  (
77  const fvPatch&,
79  );
80 
81  //- Construct from patch, internal field and dictionary
83  (
84  const fvPatch&,
86  const dictionary&
87  );
88 
89  //- Construct by mapping given directionMixedFvPatchField
90  // onto a new patch
92  (
94  const fvPatch&,
96  const fvPatchFieldMapper&
97  );
98 
99  //- Construct as copy setting internal field reference
101  (
104  );
105 
106  //- Construct and return a clone setting internal field reference
108  (
110  ) const
111  {
112  return tmp<fvPatchField<Type>>
113  (
114  new directionMixedFvPatchField<Type>(*this, iF)
115  );
116  }
117 
118 
119  // Member Functions
120 
121  // Attributes
122 
123  //- Return true: this patch field fixes a value.
124  // Needed to check if a level has to be specified while solving
125  // Poissons equations.
126  virtual bool fixesValue() const
127  {
128  return true;
129  }
130 
131  //- Return false: this patch field is not altered by assignment
132  virtual bool assignable() const
133  {
134  return false;
135  }
136 
137 
138  // Mapping functions
139 
140  //- Map the given fvPatchField onto this fvPatchField
141  virtual void map
142  (
143  const fvPatchField<Type>&,
144  const fvPatchFieldMapper&
145  );
146 
147  //- Reset the fvPatchField to the given fvPatchField
148  // Used for mesh to mesh mapping
149  virtual void reset(const fvPatchField<Type>&);
150 
151 
152  // Return defining fields
153 
154  virtual Field<Type>& refValue()
155  {
156  return refValue_;
157  }
158 
159  virtual const Field<Type>& refValue() const
160  {
161  return refValue_;
162  }
163 
164  virtual Field<Type>& refGrad()
165  {
166  return refGrad_;
167  }
168 
169  virtual const Field<Type>& refGrad() const
170  {
171  return refGrad_;
172  }
173 
174  virtual symmTensorField& valueFraction()
175  {
176  return valueFraction_;
177  }
178 
179  virtual const symmTensorField& valueFraction() const
180  {
181  return valueFraction_;
182  }
183 
184 
185  // Evaluation functions
186 
187  //- Return gradient at boundary
188  virtual tmp<Field<Type>> snGrad() const;
189 
190  //- Evaluate the patch field
191  virtual void evaluate
192  (
193  const Pstream::commsTypes commsType =
195  );
196 
197  //- Return face-gradient transform diagonal
198  virtual tmp<Field<Type>> snGradTransformDiag() const;
199 
200 
201  //- Write
202  virtual void write(Ostream&) const;
203 
204 
205  // Member Operators
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<Type>&) {}
211  virtual void operator/=(const fvPatchField<Type>&) {}
212 
213  virtual void operator=(const Field<Type>&) {}
214  virtual void operator+=(const Field<Type>&) {}
215  virtual void operator-=(const Field<Type>&) {}
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 // ************************************************************************* //
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:82
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
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Base class for direction-mixed boundary conditions.
virtual bool fixesValue() const
Return true: this patch field fixes a value.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
virtual void write(Ostream &) const
Write.
virtual symmTensorField & valueFraction()
virtual void operator+=(const fvPatchField< Type > &)
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
virtual void operator=(const fvPatchField< Type > &)
virtual void operator-=(const fvPatchField< Type > &)
virtual void operator/=(const fvPatchField< Type > &)
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
virtual void map(const fvPatchField< Type > &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
TypeName("directionMixed")
Runtime type information.
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
virtual tmp< Field< Type > > snGradTransformDiag() const
Return face-gradient transform diagonal.
virtual void operator*=(const fvPatchField< Type > &)
directionMixedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:203
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
Foam::transformFvPatchField.
Namespace for OpenFOAM.