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-2023 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 Foam_coupledFaPatchField_H
42 #define Foam_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 public:
64 
65  //- Runtime type information
66  TypeName(coupledFaPatch::typeName_());
67 
68 
69  // Constructors
70 
71  //- Construct from patch and internal field
73  (
74  const faPatch&,
76  );
77 
78  //- Construct from patch and internal field and patch field
80  (
81  const faPatch&,
83  const Field<Type>&
84  );
85 
86  //- Construct from patch, internal field and dictionary
88  (
89  const faPatch&,
91  const dictionary& dict,
94  );
95 
96  //- Construct by mapping the given coupledFaPatchField onto a new patch
98  (
100  const faPatch&,
102  const faPatchFieldMapper&
103  );
104 
105  //- Construct as copy
107  (
109  );
110 
111  //- Construct and return a clone
112  virtual tmp<faPatchField<Type>> clone() const = 0;
113 
114  //- Construct as copy setting internal field reference
116  (
119  );
120 
121  //- Construct and return a clone
123  (
125  ) const = 0;
126 
127 
128  // Member functions
129 
130  // Access
131 
132  //- Return true if this patch field is derived from
133  // coupledFaPatchField<Type>.
134  virtual bool coupled() const
135  {
136  return true;
137  }
138 
139  //- Return neighbour field of internal field
140  virtual tmp<Field<Type>> patchNeighbourField() const = 0;
141 
142 
143  // Evaluation functions
144 
145  //- Return patch-normal gradient
146  virtual tmp<Field<Type>> snGrad() const;
147 
148  //- Initialise the evaluation of the patch field
149  virtual void initEvaluate
150  (
151  const Pstream::commsTypes commsType
152  );
153 
154  //- Evaluate the patch field
155  virtual void evaluate
156  (
157  const Pstream::commsTypes commsType
158  );
159 
160  //- Return the matrix diagonal coefficients corresponding to the
161  // evaluation of the value of this patchField with given weights
163  (
164  const tmp<scalarField>&
165  ) const;
166 
167  //- Return the matrix source coefficients corresponding to the
168  // evaluation of the value of this patchField with given weights
170  (
171  const tmp<scalarField>&
172  ) const;
173 
174  //- Return the matrix diagonal coefficients corresponding to the
175  // evaluation of the gradient of this patchField
176  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
177 
178  //- Return the matrix source coefficients corresponding to the
179  // evaluation of the gradient of this patchField
180  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
181 
182 
183  // Coupled interface functionality
184 
185  //- Update result field based on interface functionality
186  virtual void updateInterfaceMatrix
187  (
188  solveScalarField& result,
189  const bool add,
190  const lduAddressing& lduAddr,
191  const label patchId,
192  const solveScalarField& psiInternal,
193  const scalarField& coeffs,
194  const direction,
195  const Pstream::commsTypes commsType
196  ) const = 0;
197 
198  //- Update result field based on interface functionality
199  virtual void updateInterfaceMatrix
200  (
201  Field<Type>& result,
202  const bool add,
203  const lduAddressing& lduAddr,
204  const label patchId,
205  const Field<Type>&,
206  const scalarField& coeffs,
207  const Pstream::commsTypes commsType
208  ) const = 0;
209 
210  //- Write
211  virtual void write(Ostream&) const;
212 };
213 
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #ifdef NoRepository
222  #include "coupledFaPatchField.C"
223 #endif
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************************************************************* //
label patchId(-1)
dictionary dict
uint8_t direction
Definition: direction.H:48
commsTypes
Communications types.
Definition: UPstream.H:74
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
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.
virtual tmp< faPatchField< Type > > clone() const =0
Construct and return a clone.
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:56
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual bool coupled() const
Return true if this patch field is derived from.
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
virtual void write(Ostream &) const
Write.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
Generic templated field type.
Definition: Field.H:62
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
virtual tmp< Field< Type > > patchNeighbourField() const =0
Return neighbour field of internal field.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
TypeName(coupledFaPatch::typeName_())
Runtime type information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
The class contains the addressing required by the lduMatrix: upper, lower and losort.
coupledFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
A FieldMapper for finite-area patch fields.
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.