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-2025 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 as copy setting internal field reference
113  (
116  );
117 
118  //- Return clone
119  virtual tmp<faPatchField<Type>> clone() const = 0;
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  //- Retrieve neighbour coupled field
143  virtual void patchNeighbourField(UList<Type>&) const = 0;
144 
145 
146  // Evaluation functions
147 
148  //- Return patch-normal gradient
149  virtual tmp<Field<Type>> snGrad() const;
151  //- Initialise the evaluation of the patch field
152  virtual void initEvaluate
153  (
154  const Pstream::commsTypes commsType
155  );
156 
157  //- Evaluate the patch field
158  virtual void evaluate
159  (
160  const Pstream::commsTypes commsType
161  );
162 
163  //- Initialise the evaluation of the patch field after a local
164  // operation
165  virtual void initEvaluateLocal
166  (
167  const Pstream::commsTypes commsType =
169  )
170  {
171  initEvaluate(commsType);
172  }
173 
174  //- Evaluate the patch field after a local operation (e.g. *=)
175  virtual void evaluateLocal
176  (
177  const Pstream::commsTypes commsType =
179  )
180  {
181  evaluate(commsType);
182  }
183 
184  //- Return the matrix diagonal coefficients corresponding to the
185  // evaluation of the value of this patchField with given weights
186  virtual tmp<Field<Type>> valueInternalCoeffs
187  (
188  const tmp<scalarField>&
189  ) const;
190 
191  //- Return the matrix source coefficients corresponding to the
192  // evaluation of the value of this patchField with given weights
193  virtual tmp<Field<Type>> valueBoundaryCoeffs
194  (
196  ) const;
197 
198  //- Return the matrix diagonal coefficients corresponding to the
199  // evaluation of the gradient of this patchField
200  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
201 
202  //- Return the matrix source coefficients corresponding to the
203  // evaluation of the gradient of this patchField
204  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
205 
206 
207  // Coupled interface functionality
208 
209  //- Update result field based on interface functionality
210  virtual void updateInterfaceMatrix
211  (
212  solveScalarField& result,
213  const bool add,
214  const lduAddressing& lduAddr,
215  const label patchId,
216  const solveScalarField& psiInternal,
217  const scalarField& coeffs,
218  const direction,
219  const Pstream::commsTypes commsType
220  ) const = 0;
221 
222  //- Update result field based on interface functionality
223  virtual void updateInterfaceMatrix
224  (
225  Field<Type>& result,
226  const bool add,
227  const lduAddressing& lduAddr,
228  const label patchId,
229  const Field<Type>&,
230  const scalarField& coeffs,
231  const Pstream::commsTypes commsType
232  ) const = 0;
233 
234  //- Write
235  virtual void write(Ostream&) const;
236 };
237 
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 } // End namespace Foam
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #ifdef NoRepository
246  #include "coupledFaPatchField.C"
247 #endif
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #endif
252 
253 // ************************************************************************* //
label patchId(-1)
dictionary dict
uint8_t direction
Definition: direction.H:46
commsTypes
Communications types.
Definition: UPstream.H:77
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
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 void initEvaluateLocal(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Initialise the evaluation of the patch field after a local.
virtual tmp< faPatchField< Type > > clone() const =0
Return clone.
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:46
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:63
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
virtual void evaluateLocal(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field after a local operation (e.g. *=)
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...
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
"buffered" : (MPI_Bsend, MPI_Recv)
A FieldMapper for finite-area patch fields.
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.