coupledFaPatchField.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  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::coupledFaPatchField
29 
30 Description
31 
32 Author
33  Zeljko Tukovic, FMENA
34  Hrvoje Jasak, Wikki Ltd.
35 
36 SourceFiles
37  coupledFaPatchField.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef coupledFaPatchField_H
42 #define coupledFaPatchField_H
43 
44 #include "lduInterfaceField.H"
45 #include "faPatchField.H"
46 #include "coupledFaPatch.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class coupledFaPatchField Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type>
59 :
60  public lduInterfaceField,
61  public faPatchField<Type>
62 {
63 
64 public:
65 
66  //- Runtime type information
67  TypeName(coupledFaPatch::typeName_());
68 
69 
70  // Constructors
71 
72  //- Construct from patch and internal field
74  (
75  const faPatch&,
77  );
78 
79  //- Construct from patch and internal field and patch field
81  (
82  const faPatch&,
84  const Field<Type>&
85  );
86 
87  //- Construct from patch, internal field and dictionary
89  (
90  const faPatch&,
92  const dictionary&
93  );
94 
95  //- Construct by mapping the given coupledFaPatchField onto a new patch
97  (
99  const faPatch&,
101  const faPatchFieldMapper&
102  );
103 
104  //- Construct as copy
106  (
108  );
109 
110  //- Construct and return a clone
111  virtual tmp<faPatchField<Type>> clone() const = 0;
112 
113  //- Construct as copy setting internal field reference
115  (
118  );
119 
120  //- Construct and return a clone
122  (
124  ) const = 0;
125 
126 
127  // Member functions
128 
129  // Access
130 
131  //- Return true if this patch field is derived from
132  // coupledFaPatchField<Type>.
133  virtual bool coupled() const
134  {
135  return true;
136  }
137 
138  //- Return neighbour field of internal field
139  virtual tmp<Field<Type>> patchNeighbourField() const = 0;
140 
141 
142  // Evaluation functions
143 
144  //- Return patch-normal gradient
145  virtual tmp<Field<Type>> snGrad() const;
146 
147  //- Initialise the evaluation of the patch field
148  virtual void initEvaluate
149  (
150  const Pstream::commsTypes commsType
151  );
152 
153  //- Evaluate the patch field
154  virtual void evaluate
155  (
156  const Pstream::commsTypes commsType
157  );
158 
159  //- Return the matrix diagonal coefficients corresponding to the
160  // evaluation of the value of this patchField with given weights
162  (
163  const tmp<scalarField>&
164  ) const;
165 
166  //- Return the matrix source coefficients corresponding to the
167  // evaluation of the value of this patchField with given weights
169  (
170  const tmp<scalarField>&
171  ) const;
172 
173  //- Return the matrix diagonal coefficients corresponding to the
174  // evaluation of the gradient of this patchField
175  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
176 
177  //- Return the matrix source coefficients corresponding to the
178  // evaluation of the gradient of this patchField
179  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
180 
181 
182  // Coupled interface functionality
183 
184  //- Transform given patch component field
185  virtual void transformCoupleField
186  (
188  const direction cmpt
189  ) const = 0;
190 
191  //- Update result field based on interface functionality
192  virtual void updateInterfaceMatrix
193  (
194  solveScalarField& result,
195  const bool add,
196  const lduAddressing& lduAddr,
197  const label patchId,
198  const solveScalarField& psiInternal,
199  const scalarField& coeffs,
200  const direction,
201  const Pstream::commsTypes commsType
202  ) const = 0;
203 
204  //- Update result field based on interface functionality
205  virtual void updateInterfaceMatrix
206  (
207  Field<Type>& result,
208  const bool add,
209  const lduAddressing& lduAddr,
210  const label patchId,
211  const Field<Type>&,
212  const scalarField& coeffs,
213  const Pstream::commsTypes commsType
214  ) const = 0;
215 
216  //- Write
217  virtual void write(Ostream&) const;
218 };
219 
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 } // End namespace Foam
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #ifdef NoRepository
228  #include "coupledFaPatchField.C"
229 #endif
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #endif
234 
235 // ************************************************************************* //
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
Foam::faPatchField
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:50
coupledFaPatch.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::coupledFaPatchField::initEvaluate
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
Definition: coupledFaPatchField.C:119
faPatchField.H
Foam::coupledFaPatchField::coupledFaPatchField
coupledFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
Definition: coupledFaPatchField.C:34
Foam::faPatchFieldMapper
Definition: faPatchFieldMapper.H:44
Foam::coupledFaPatchField::gradientBoundaryCoeffs
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
Definition: coupledFaPatchField.C:171
Foam::coupledFaPatchField::patchNeighbourField
virtual tmp< Field< Type > > patchNeighbourField() const =0
Return neighbour field of internal field.
Foam::coupledFaPatchField::TypeName
TypeName(coupledFaPatch::typeName_())
Runtime type information.
Foam::coupledFaPatchField::gradientInternalCoeffs
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
Definition: coupledFaPatchField.C:163
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::coupledFaPatchField::coupled
virtual bool coupled() const
Return true if this patch field is derived from.
Definition: coupledFaPatchField.H:132
Foam::coupledFaPatchField::updateInterfaceMatrix
virtual void updateInterfaceMatrix(solveScalarField &result, const bool add, const lduAddressing &lduAddr, const label patchId, const solveScalarField &psiInternal, const scalarField &coeffs, const direction, const Pstream::commsTypes commsType) const =0
Update result field based on interface functionality.
Foam::coupledFaPatchField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
Definition: coupledFaPatchField.C:129
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
Foam::coupledFaPatchField::valueBoundaryCoeffs
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
Definition: coupledFaPatchField.C:153
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::lduInterfaceField
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
Definition: lduInterfaceField.H:58
Foam::coupledFaPatchField::snGrad
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Definition: coupledFaPatchField.C:110
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::coupledFaPatchField::clone
virtual tmp< faPatchField< Type > > clone() const =0
Construct and return a clone.
Foam::coupledFaPatchField
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
Definition: coupledFaPatchField.H:57
f
labelList f(nPoints)
lduInterfaceField.H
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::coupledFaPatchField::valueInternalCoeffs
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Definition: coupledFaPatchField.C:142
patchId
label patchId(-1)
Foam::coupledFaPatchField::write
virtual void write(Ostream &) const
Write.
Definition: coupledFaPatchField.C:178
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
coupledFaPatchField.C
Foam::faPatch
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:69
Foam::coupledFaPatchField::transformCoupleField
virtual void transformCoupleField(solveScalarField &f, const direction cmpt) const =0
Transform given patch component field.
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54