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-2018 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  virtual void autoMap
151  (
152  const fvPatchFieldMapper&
153  );
154 
155  //- Reverse map the given fvPatchField onto this fvPatchField
156  virtual void rmap
157  (
158  const fvPatchField<Type>&,
159  const labelList&
160  );
161 
162 
163  // Return defining fields
165  virtual Field<Type>& refValue()
166  {
167  return refValue_;
168  }
170  virtual const Field<Type>& refValue() const
171  {
172  return refValue_;
173  }
175  virtual Field<Type>& refGrad()
176  {
177  return refGrad_;
178  }
180  virtual const Field<Type>& refGrad() const
181  {
182  return refGrad_;
183  }
185  virtual symmTensorField& valueFraction()
186  {
187  return valueFraction_;
188  }
190  virtual const symmTensorField& valueFraction() const
191  {
192  return valueFraction_;
193  }
194 
195 
196  // Evaluation functions
197 
198  //- Return gradient at boundary
199  virtual tmp<Field<Type>> snGrad() const;
200 
201  //- Evaluate the patch field
202  virtual void evaluate
203  (
204  const Pstream::commsTypes commsType =
206  );
207 
208  //- Return face-gradient transform diagonal
209  virtual tmp<Field<Type>> snGradTransformDiag() const;
210 
211 
212  //- Write
213  virtual void write(Ostream&) const;
214 
215 
216  // Member operators
218  virtual void operator=(const fvPatchField<Type>&) {}
219  virtual void operator+=(const fvPatchField<Type>&) {}
220  virtual void operator-=(const fvPatchField<Type>&) {}
221  virtual void operator*=(const fvPatchField<Type>&) {}
222  virtual void operator/=(const fvPatchField<Type>&) {}
224  virtual void operator=(const Field<Type>&) {}
225  virtual void operator+=(const Field<Type>&) {}
226  virtual void operator-=(const Field<Type>&) {}
227  virtual void operator*=(const Field<scalar>&) {}
228  virtual void operator/=(const Field<scalar>&) {}
230  virtual void operator=(const Type&) {}
231  virtual void operator+=(const Type&) {}
232  virtual void operator-=(const Type&) {}
233  virtual void operator*=(const scalar) {}
234  virtual void operator/=(const scalar) {}
235 };
236 
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 } // End namespace Foam
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #ifdef NoRepository
246 #endif
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #endif
251 
252 // ************************************************************************* //
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:137
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:57
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:53
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.