mixedFaPatchField.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2017 Wikki Ltd
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::mixedFaPatchField
28 
29 Description
30 
31 Author
32  Zeljko Tukovic, FMENA
33  Hrvoje Jasak, Wikki Ltd.
34 
35 SourceFiles
36  mixedFaPatchField.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef mixedFaPatchField_H
41 #define mixedFaPatchField_H
42 
43 #include "faPatchField.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class mixedFaPatchField Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class Type>
56 :
57  public faPatchField<Type>
58 {
59  // Private data
60 
61  //- Value field
62  Field<Type> refValue_;
63 
64  //- Normal gradient field
65  Field<Type> refGrad_;
66 
67  //- Fraction (0-1) of value used for boundary condition
68  scalarField valueFraction_;
69 
70 
71 public:
72 
73  //- Runtime type information
74  TypeName("mixed");
75 
76 
77  // Constructors
78 
79  //- Construct from patch and internal field
81  (
82  const faPatch&,
84  );
85 
86  //- Construct from patch, internal field and dictionary
88  (
89  const faPatch&,
91  const dictionary&
92  );
93 
94  //- Construct by mapping the given mixedFaPatchField onto a new patch
96  (
98  const faPatch&,
100  const faPatchFieldMapper&
101  );
102 
103  //- Construct as copy
105  (
107  );
108 
109  //- Construct and return a clone
110  virtual tmp<faPatchField<Type>> clone() const
111  {
112  return tmp<faPatchField<Type>>
113  (
114  new mixedFaPatchField<Type>(*this)
115  );
116  }
117 
118  //- Construct as copy setting internal field reference
120  (
123  );
124 
125  //- Construct and return a clone setting internal field reference
127  (
129  ) const
130  {
131  return tmp<faPatchField<Type>>
132  (
133  new mixedFaPatchField<Type>(*this, iF)
134  );
135  }
136 
137 
138  // Member functions
139 
140  // Access
141 
142  //- Return true if this patch field fixes a value.
143  // Needed to check if a level has to be specified while solving
144  // Poissons equations.
145  virtual bool fixesValue() const
146  {
147  return true;
148  }
149 
150 
151  // Return defining fields
152 
153  virtual Field<Type>& refValue()
154  {
155  return refValue_;
156  }
157 
158  virtual const Field<Type>& refValue() const
159  {
160  return refValue_;
161  }
162 
163  virtual Field<Type>& refGrad()
164  {
165  return refGrad_;
166  }
167 
168  virtual const Field<Type>& refGrad() const
169  {
170  return refGrad_;
171  }
172 
173  virtual scalarField& valueFraction()
174  {
175  return valueFraction_;
176  }
177 
178  virtual const scalarField& valueFraction() const
179  {
180  return valueFraction_;
181  }
182 
183 
184  // Mapping functions
185 
186  //- Map (and resize as needed) from self given a mapping object
187  virtual void autoMap
188  (
189  const faPatchFieldMapper&
190  );
191 
192  //- Reverse map the given faPatchField onto this faPatchField
193  virtual void rmap
194  (
195  const faPatchField<Type>&,
196  const labelList&
197  );
198 
199 
200  // Evaluation functions
201 
202  //- Return gradient at boundary
203  virtual tmp<Field<Type>> snGrad() const;
204 
205  //- Evaluate the patch field
206  virtual void evaluate
207  (
209  );
210 
211  //- Return the matrix diagonal coefficients corresponding to the
212  // evaluation of the value of this patchField with given weights
214  (
215  const tmp<scalarField>&
216  ) const;
217 
218  //- Return the matrix source coefficients corresponding to the
219  // evaluation of the value of this patchField with given weights
221  (
222  const tmp<scalarField>&
223  ) const;
224 
225  //- Return the matrix diagonal coefficients corresponding to the
226  // evaluation of the gradient of this patchField
227  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
228 
229  //- Return the matrix source coefficients corresponding to the
230  // evaluation of the gradient of this patchField
231  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
232 
233 
234  //- Write
235  virtual void write(Ostream&) const;
236 
237 
238  // Member operators
239 
240  virtual void operator=(const UList<Type>&) {}
241 
242  virtual void operator=(const faPatchField<Type>&) {}
243  virtual void operator+=(const faPatchField<Type>&) {}
244  virtual void operator-=(const faPatchField<Type>&) {}
245  virtual void operator*=(const faPatchField<scalar>&) {}
246  virtual void operator/=(const faPatchField<scalar>&) {}
247 
248  virtual void operator+=(const Field<Type>&) {}
249  virtual void operator-=(const Field<Type>&) {}
250 
251  virtual void operator*=(const Field<scalar>&) {}
252  virtual void operator/=(const Field<scalar>&) {}
253 
254  virtual void operator=(const Type&) {}
255  virtual void operator+=(const Type&) {}
256  virtual void operator-=(const Type&) {}
257  virtual void operator*=(const scalar) {}
258  virtual void operator/=(const scalar) {}
259 };
260 
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 } // End namespace Foam
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 #ifdef NoRepository
269  #include "mixedFaPatchField.C"
270 #endif
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 #endif
275 
276 // ************************************************************************* //
Foam::mixedFaPatchField::valueFraction
virtual scalarField & valueFraction()
Definition: mixedFaPatchField.H:172
Foam::faPatchField
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:50
Foam::mixedFaPatchField::operator+=
virtual void operator+=(const Type &)
Definition: mixedFaPatchField.H:254
Foam::mixedFaPatchField::operator/=
virtual void operator/=(const scalar)
Definition: mixedFaPatchField.H:257
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::mixedFaPatchField::refValue
virtual Field< Type > & refValue()
Definition: mixedFaPatchField.H:152
Foam::mixedFaPatchField::valueFraction
virtual const scalarField & valueFraction() const
Definition: mixedFaPatchField.H:177
Foam::mixedFaPatchField::valueInternalCoeffs
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Definition: mixedFaPatchField.C:175
Foam::mixedFaPatchField::operator*=
virtual void operator*=(const Field< scalar > &)
Definition: mixedFaPatchField.H:250
Foam::mixedFaPatchField::operator=
virtual void operator=(const Type &)
Definition: mixedFaPatchField.H:253
Foam::mixedFaPatchField::operator*=
virtual void operator*=(const faPatchField< scalar > &)
Definition: mixedFaPatchField.H:244
faPatchField.H
Foam::mixedFaPatchField::autoMap
virtual void autoMap(const faPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: mixedFaPatchField.C:110
Foam::mixedFaPatchField::refGrad
virtual Field< Type > & refGrad()
Definition: mixedFaPatchField.H:162
Foam::faPatchFieldMapper
Definition: faPatchFieldMapper.H:44
Foam::mixedFaPatchField::clone
virtual tmp< faPatchField< Type > > clone() const
Construct and return a clone.
Definition: mixedFaPatchField.H:109
Foam::mixedFaPatchField::valueBoundaryCoeffs
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
Definition: mixedFaPatchField.C:185
Foam::mixedFaPatchField::rmap
virtual void rmap(const faPatchField< Type > &, const labelList &)
Reverse map the given faPatchField onto this faPatchField.
Definition: mixedFaPatchField.C:123
Foam::mixedFaPatchField::refGrad
virtual const Field< Type > & refGrad() const
Definition: mixedFaPatchField.H:167
Foam::mixedFaPatchField::operator+=
virtual void operator+=(const faPatchField< Type > &)
Definition: mixedFaPatchField.H:242
Foam::mixedFaPatchField::operator/=
virtual void operator/=(const faPatchField< scalar > &)
Definition: mixedFaPatchField.H:245
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::mixedFaPatchField::gradientBoundaryCoeffs
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
Definition: mixedFaPatchField.C:205
Foam::mixedFaPatchField::mixedFaPatchField
mixedFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
Definition: mixedFaPatchField.C:34
Foam::mixedFaPatchField::gradientInternalCoeffs
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
Definition: mixedFaPatchField.C:197
Foam::mixedFaPatchField::operator*=
virtual void operator*=(const scalar)
Definition: mixedFaPatchField.H:256
Foam::mixedFaPatchField::write
virtual void write(Ostream &) const
Write.
Definition: mixedFaPatchField.C:214
Foam::mixedFaPatchField
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
Definition: mixedFaPatchField.H:54
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::mixedFaPatchField::refValue
virtual const Field< Type > & refValue() const
Definition: mixedFaPatchField.H:157
Foam::mixedFaPatchField::fixesValue
virtual bool fixesValue() const
Return true if this patch field fixes a value.
Definition: mixedFaPatchField.H:144
Foam::mixedFaPatchField::operator+=
virtual void operator+=(const Field< Type > &)
Definition: mixedFaPatchField.H:247
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::mixedFaPatchField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
Definition: mixedFaPatchField.C:140
Foam::List< label >
Foam::mixedFaPatchField::operator/=
virtual void operator/=(const Field< scalar > &)
Definition: mixedFaPatchField.H:251
Foam::mixedFaPatchField::operator-=
virtual void operator-=(const Field< Type > &)
Definition: mixedFaPatchField.H:248
mixedFaPatchField.C
Foam::mixedFaPatchField::operator=
virtual void operator=(const UList< Type > &)
Definition: mixedFaPatchField.H:239
Foam::UList< Type >
Foam::mixedFaPatchField::operator=
virtual void operator=(const faPatchField< Type > &)
Definition: mixedFaPatchField.H:241
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::mixedFaPatchField::operator-=
virtual void operator-=(const faPatchField< Type > &)
Definition: mixedFaPatchField.H:243
Foam::mixedFaPatchField::TypeName
TypeName("mixed")
Runtime type information.
Foam::faPatch
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:69
Foam::mixedFaPatchField::snGrad
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
Definition: mixedFaPatchField.C:163
Foam::mixedFaPatchField::operator-=
virtual void operator-=(const Type &)
Definition: mixedFaPatchField.H:255
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::UPstream::commsTypes::blocking