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  //- Initialise the evaluation of the patch field after a local
161  // operation
162  virtual void initEvaluateLocal
163  (
164  const Pstream::commsTypes commsType =
166  )
167  {
168  initEvaluate(commsType);
169  }
170 
171  //- Evaluate the patch field after a local operation (e.g. *=)
172  virtual void evaluateLocal
173  (
174  const Pstream::commsTypes commsType =
176  )
177  {
178  evaluate(commsType);
179  }
180 
181  //- Return the matrix diagonal coefficients corresponding to the
182  // evaluation of the value of this patchField with given weights
183  virtual tmp<Field<Type>> valueInternalCoeffs
184  (
185  const tmp<scalarField>&
186  ) const;
187 
188  //- Return the matrix source coefficients corresponding to the
189  // evaluation of the value of this patchField with given weights
191  (
192  const tmp<scalarField>&
193  ) const;
194 
195  //- Return the matrix diagonal coefficients corresponding to the
196  // evaluation of the gradient of this patchField
197  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
198 
199  //- Return the matrix source coefficients corresponding to the
200  // evaluation of the gradient of this patchField
201  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
203 
204  // Coupled interface functionality
205 
206  //- Update result field based on interface functionality
207  virtual void updateInterfaceMatrix
208  (
209  solveScalarField& result,
210  const bool add,
211  const lduAddressing& lduAddr,
212  const label patchId,
213  const solveScalarField& psiInternal,
214  const scalarField& coeffs,
215  const direction,
216  const Pstream::commsTypes commsType
217  ) const = 0;
218 
219  //- Update result field based on interface functionality
220  virtual void updateInterfaceMatrix
221  (
222  Field<Type>& result,
223  const bool add,
224  const lduAddressing& lduAddr,
225  const label patchId,
226  const Field<Type>&,
227  const scalarField& coeffs,
228  const Pstream::commsTypes commsType
229  ) const = 0;
230 
231  //- Write
232  virtual void write(Ostream&) const;
233 };
234 
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 } // End namespace Foam
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 #ifdef NoRepository
243  #include "coupledFaPatchField.C"
244 #endif
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #endif
249 
250 // ************************************************************************* //
label patchId(-1)
dictionary dict
"blocking" : (MPI_Bsend, MPI_Recv)
uint8_t direction
Definition: direction.H:46
commsTypes
Communications types.
Definition: UPstream.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual void initEvaluateLocal(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Initialise the evaluation of the patch field after a local.
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 evaluateLocal(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field after a local operation (e.g. *=)
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:56
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.