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-2019 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 onto
90  // a new patch
92  (
94  const fvPatch&,
96  const fvPatchFieldMapper&
97  );
98 
99  //- Construct and return a clone
100  virtual tmp<fvPatchField<Type>> clone() const
101  {
102  return tmp<fvPatchField<Type>>
103  (
105  );
106  }
107 
108  //- Construct as copy setting internal field reference
110  (
113  );
114 
115  //- Construct and return a clone setting internal field reference
117  (
119  ) const
120  {
121  return tmp<fvPatchField<Type>>
122  (
123  new directionMixedFvPatchField<Type>(*this, iF)
124  );
125  }
126 
127 
128  // Member Functions
129 
130  // Attributes
131 
132  //- Return true: this patch field fixes a value.
133  // Needed to check if a level has to be specified while solving
134  // Poissons equations.
135  virtual bool fixesValue() const
136  {
137  return true;
138  }
139 
140  //- Return false: this patch field is not altered by assignment
141  virtual bool assignable() const
142  {
143  return false;
144  }
145 
146 
147  // Mapping functions
148 
149  //- Map (and resize as needed) from self given a mapping object
150  // Used to update fields following mesh topology change
151  virtual void autoMap(const fvPatchFieldMapper&);
152 
153  //- Reverse map the given fvPatchField onto this fvPatchField
154  // Used to reconstruct fields
155  virtual void rmap(const fvPatchField<Type>&, const labelList&);
156 
157 
158  // Return defining fields
160  virtual Field<Type>& refValue()
161  {
162  return refValue_;
163  }
165  virtual const Field<Type>& refValue() const
166  {
167  return refValue_;
168  }
170  virtual Field<Type>& refGrad()
171  {
172  return refGrad_;
173  }
175  virtual const Field<Type>& refGrad() const
176  {
177  return refGrad_;
178  }
180  virtual symmTensorField& valueFraction()
181  {
182  return valueFraction_;
183  }
185  virtual const symmTensorField& valueFraction() const
186  {
187  return valueFraction_;
188  }
189 
190 
191  // Evaluation functions
192 
193  //- Return gradient at boundary
194  virtual tmp<Field<Type>> snGrad() const;
195 
196  //- Evaluate the patch field
197  virtual void evaluate
198  (
199  const Pstream::commsTypes commsType =
201  );
202 
203  //- Return face-gradient transform diagonal
204  virtual tmp<Field<Type>> snGradTransformDiag() const;
205 
206 
207  //- Write
208  virtual void write(Ostream&) const;
209 
210 
211  // Member Operators
213  virtual void operator=(const fvPatchField<Type>&) {}
214  virtual void operator+=(const fvPatchField<Type>&) {}
215  virtual void operator-=(const fvPatchField<Type>&) {}
216  virtual void operator*=(const fvPatchField<Type>&) {}
217  virtual void operator/=(const fvPatchField<Type>&) {}
219  virtual void operator=(const Field<Type>&) {}
220  virtual void operator+=(const Field<Type>&) {}
221  virtual void operator-=(const Field<Type>&) {}
222  virtual void operator*=(const Field<scalar>&) {}
223  virtual void operator/=(const Field<scalar>&) {}
225  virtual void operator=(const Type&) {}
226  virtual void operator+=(const Type&) {}
227  virtual void operator-=(const Type&) {}
228  virtual void operator*=(const scalar) {}
229  virtual void operator/=(const scalar) {}
230 };
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace Foam
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #ifdef NoRepository
241 #endif
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #endif
246 
247 // ************************************************************************* //
directionMixedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
virtual void write(Ostream &) const
Write.
commsTypes
Types of communications.
Definition: UPstream.H:64
TypeName("directionMixed")
Runtime type information.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual void operator*=(const fvPatchField< Type > &)
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Base class for direction-mixed boundary conditions.
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
Pre-declare SubField and related Field type.
Definition: Field.H:56
Foam::fvPatchFieldMapper.
virtual void operator-=(const fvPatchField< Type > &)
virtual bool fixesValue() const
Return true: this patch field fixes a value.
virtual void operator+=(const fvPatchField< Type > &)
virtual void operator=(const fvPatchField< Type > &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Foam::transformFvPatchField.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void operator/=(const fvPatchField< Type > &)
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual symmTensorField & valueFraction()
virtual tmp< Field< Type > > snGradTransformDiag() const
Return face-gradient transform diagonal.
Namespace for OpenFOAM.