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 fieldMapper&
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(const fvPatchField<Type>&, const fieldMapper&);
142 
143  //- Reset the fvPatchField to the given fvPatchField
144  // Used for mesh to mesh mapping
145  virtual void reset(const fvPatchField<Type>&);
146 
147 
148  // Return defining fields
149 
150  virtual Field<Type>& refValue()
151  {
152  return refValue_;
153  }
154 
155  virtual const Field<Type>& refValue() const
156  {
157  return refValue_;
158  }
159 
160  virtual Field<Type>& refGrad()
161  {
162  return refGrad_;
163  }
164 
165  virtual const Field<Type>& refGrad() const
166  {
167  return refGrad_;
168  }
169 
170  virtual symmTensorField& valueFraction()
171  {
172  return valueFraction_;
173  }
174 
175  virtual const symmTensorField& valueFraction() const
176  {
177  return valueFraction_;
178  }
179 
180 
181  // Evaluation functions
182 
183  //- Return gradient at boundary
184  virtual tmp<Field<Type>> snGrad() const;
185 
186  //- Evaluate the patch field
187  virtual void evaluate
188  (
189  const Pstream::commsTypes commsType =
191  );
192 
193  //- Return face-gradient transform diagonal
194  virtual tmp<Field<Type>> snGradTransformDiag() const;
195 
196 
197  //- Write
198  virtual void write(Ostream&) const;
199 
200 
201  // Member Operators
202 
203  virtual void operator=(const fvPatchField<Type>&) {}
204  virtual void operator+=(const fvPatchField<Type>&) {}
205  virtual void operator-=(const fvPatchField<Type>&) {}
206  virtual void operator*=(const fvPatchField<Type>&) {}
207  virtual void operator/=(const fvPatchField<Type>&) {}
208 
209  virtual void operator=(const Field<Type>&) {}
210  virtual void operator+=(const Field<Type>&) {}
211  virtual void operator-=(const Field<Type>&) {}
212  virtual void operator*=(const Field<scalar>&) {}
213  virtual void operator/=(const Field<scalar>&) {}
214 
215  virtual void operator=(const Type&) {}
216  virtual void operator+=(const Type&) {}
217  virtual void operator-=(const Type&) {}
218  virtual void operator*=(const scalar) {}
219  virtual void operator/=(const scalar) {}
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #ifdef NoRepository
231 #endif
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
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
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
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.
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 > &)
virtual void map(const fvPatchField< Type > &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
directionMixedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Abstract base class for field mapping.
Definition: fieldMapper.H:48
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
A class for managing temporary objects.
Definition: tmp.H:55
Foam::transformFvPatchField.
Namespace for OpenFOAM.