directionMixedFvPatchField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2016 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 Group
28  grpGenericBoundaryConditions
29 
30 Description
31  Base class for direction-mixed boundary conditions.
32 
33 SourceFiles
34  directionMixedFvPatchField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef directionMixedFvPatchField_H
39 #define directionMixedFvPatchField_H
40 
41 #include "transformFvPatchField.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class directionMixedFvPatchField Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type>
54 :
55  public transformFvPatchField<Type>
56 {
57  // Private data
58 
59  //- Value field
60  Field<Type> refValue_;
61 
62  //- Normal gradient field
63  Field<Type> refGrad_;
64 
65  //- Fraction (0-1) of value used for boundary condition
66  symmTensorField valueFraction_;
67 
68 
69 public:
70 
71  //- Runtime type information
72  TypeName("directionMixed");
73 
74 
75  // Constructors
76 
77  //- Construct from patch and internal field
79  (
80  const fvPatch&,
82  );
83 
84  //- Construct from patch, internal field and dictionary
86  (
87  const fvPatch&,
89  const dictionary&
90  );
91 
92  //- Construct by mapping given directionMixedFvPatchField onto
93  // a new patch
95  (
97  const fvPatch&,
99  const fvPatchFieldMapper&
100  );
101 
102  //- Construct and return a clone
103  virtual tmp<fvPatchField<Type>> clone() const
104  {
105  return tmp<fvPatchField<Type>>
106  (
108  );
109  }
110 
111  //- Construct as copy setting internal field reference
113  (
116  );
117 
118  //- Construct and return a clone setting internal field reference
120  (
122  ) const
123  {
124  return tmp<fvPatchField<Type>>
125  (
126  new directionMixedFvPatchField<Type>(*this, iF)
127  );
128  }
129 
130 
131  // Member functions
132 
133  // Attributes
134 
135  //- Return true: this patch field fixes a value.
136  // Needed to check if a level has to be specified while solving
137  // Poissons equations.
138  virtual bool fixesValue() const
139  {
140  return true;
141  }
142 
143  //- Return false: this patch field is not altered by assignment
144  virtual bool assignable() const
145  {
146  return false;
147  }
148 
149 
150  // Mapping functions
151 
152  //- Map (and resize as needed) from self given a mapping object
153  virtual void autoMap
154  (
155  const fvPatchFieldMapper&
156  );
157 
158  //- Reverse map the given fvPatchField onto this fvPatchField
159  virtual void rmap
160  (
161  const fvPatchField<Type>&,
162  const labelList&
163  );
164 
165 
166  // Return defining fields
168  virtual Field<Type>& refValue()
169  {
170  return refValue_;
171  }
173  virtual const Field<Type>& refValue() const
174  {
175  return refValue_;
176  }
178  virtual Field<Type>& refGrad()
179  {
180  return refGrad_;
181  }
183  virtual const Field<Type>& refGrad() const
184  {
185  return refGrad_;
186  }
188  virtual symmTensorField& valueFraction()
189  {
190  return valueFraction_;
191  }
193  virtual const symmTensorField& valueFraction() const
194  {
195  return valueFraction_;
196  }
197 
198 
199  // Evaluation functions
200 
201  //- Return gradient at boundary
202  virtual tmp<Field<Type>> snGrad() const;
203 
204  //- Evaluate the patch field
205  virtual void evaluate
206  (
207  const Pstream::commsTypes commsType=Pstream::blocking
208  );
209 
210  //- Return face-gradient transform diagonal
211  virtual tmp<Field<Type>> snGradTransformDiag() const;
212 
213 
214  //- Write
215  virtual void write(Ostream&) const;
216 
217 
218  // Member operators
220  virtual void operator=(const fvPatchField<Type>&) {}
221  virtual void operator+=(const fvPatchField<Type>&) {}
222  virtual void operator-=(const fvPatchField<Type>&) {}
223  virtual void operator*=(const fvPatchField<Type>&) {}
224  virtual void operator/=(const fvPatchField<Type>&) {}
226  virtual void operator=(const Field<Type>&) {}
227  virtual void operator+=(const Field<Type>&) {}
228  virtual void operator-=(const Field<Type>&) {}
229  virtual void operator*=(const Field<scalar>&) {}
230  virtual void operator/=(const Field<scalar>&) {}
232  virtual void operator=(const Type&) {}
233  virtual void operator+=(const Type&) {}
234  virtual void operator-=(const Type&) {}
235  virtual void operator*=(const scalar) {}
236  virtual void operator/=(const scalar) {}
237 };
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace Foam
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #ifdef NoRepository
248 #endif
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 #endif
253 
254 // ************************************************************************* //
directionMixedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual void write(Ostream &) const
Write.
virtual bool fixesValue() const
Return true: this patch field fixes a value.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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:65
virtual void operator*=(const fvPatchField< Type > &)
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Base class for direction-mixed boundary conditions.
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fvPatchFieldMapper.
virtual void operator-=(const fvPatchField< Type > &)
virtual void operator+=(const fvPatchField< Type > &)
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
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 tmp< Field< Type > > snGrad() const
Return gradient at boundary.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void operator/=(const fvPatchField< Type > &)
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::blocking)
Evaluate the patch field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual tmp< Field< Type > > snGradTransformDiag() const
Return face-gradient transform diagonal.
A class for managing temporary objects.
Definition: PtrList.H:54
virtual symmTensorField & valueFraction()
Namespace for OpenFOAM.