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.txx
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 {
65 
66 public:
67 
68  //- Runtime type information
69  TypeName(coupledFaPatch::typeName_());
70 
71 
72  // Constructors
73 
74  //- Construct from patch and internal field
76  (
77  const faPatch&,
79  );
80 
81  //- Construct from patch and internal field and patch field
83  (
84  const faPatch&,
86  const Field<Type>&
87  );
88 
89  //- Construct from patch, internal field and dictionary
91  (
92  const faPatch&,
94  const dictionary& dict,
97  );
98 
99  //- Construct by mapping onto a new patch
101  (
102  const this_bctype&,
103  const faPatch&,
105  const faPatchFieldMapper&
106  );
107 
108  //- Construct as copy setting internal field reference
110  (
111  const this_bctype&,
113  );
114 
115  //- No copy without an internal field
116  coupledFaPatchField(const this_bctype&) = delete;
117 
118  //- Clone with an internal field reference
120  (
122  ) const = 0;
123 
124 
125  // Member Functions
126 
127  // Access
128 
129  //- True if derived from coupledFaPatchField
130  virtual bool coupled() const { return true; }
131 
132  //- Return neighbour field of internal field
133  virtual tmp<Field<Type>> patchNeighbourField() const = 0;
134 
135  //- Retrieve neighbour coupled field
136  virtual void patchNeighbourField(UList<Type>&) const = 0;
137 
138 
139  // Evaluation functions
140 
141  //- Return patch-normal gradient
142  virtual tmp<Field<Type>> snGrad() const;
144  //- Retrieve patch-normal gradient
145  virtual void snGrad(UList<Type>& result) 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  //- Initialise the evaluation of the patch field after a local
160  // operation
161  virtual void initEvaluateLocal
162  (
163  const Pstream::commsTypes commsType =
165  )
166  {
167  initEvaluate(commsType);
168  }
169 
170  //- Evaluate the patch field after a local operation (e.g. *=)
171  virtual void evaluateLocal
172  (
173  const Pstream::commsTypes commsType =
175  )
176  {
177  evaluate(commsType);
178  }
179 
180  //- Return the matrix diagonal coefficients corresponding to the
181  // evaluation of the value of this patchField with given weights
182  virtual tmp<Field<Type>> valueInternalCoeffs
183  (
184  const tmp<scalarField>&
185  ) const;
186 
187  //- Return the matrix source coefficients corresponding to the
188  // evaluation of the value of this patchField with given weights
189  virtual tmp<Field<Type>> valueBoundaryCoeffs
190  (
191  const tmp<scalarField>&
192  ) const;
193 
194  //- Return the matrix diagonal coefficients corresponding to the
195  // evaluation of the gradient of this patchField
196  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
197 
198  //- Return the matrix source coefficients corresponding to the
199  // evaluation of the gradient of this patchField
200  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
201 
203  // Coupled interface functionality
204 
205  //- Update result field based on interface functionality
206  virtual void updateInterfaceMatrix
207  (
208  solveScalarField& result,
209  const bool add,
210  const lduAddressing& lduAddr,
211  const label patchId,
212  const solveScalarField& psiInternal,
213  const scalarField& coeffs,
214  const direction,
215  const Pstream::commsTypes commsType
216  ) const = 0;
217 
218  //- Update result field based on interface functionality
219  virtual void updateInterfaceMatrix
220  (
221  Field<Type>& result,
222  const bool add,
223  const lduAddressing& lduAddr,
224  const label patchId,
225  const Field<Type>&,
226  const scalarField& coeffs,
227  const Pstream::commsTypes commsType
228  ) const = 0;
229 
230 
231  // Other
232 
233  //- Write
234  virtual void write(Ostream&) const;
235 
236 
237  // Member Operators
238 
239  //- Inherit assignment
241 };
242 
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 } // End namespace Foam
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #ifdef NoRepository
251  #include "coupledFaPatchField.txx"
252 #endif
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 #endif
257 
258 // ************************************************************************* //
label patchId(-1)
dictionary dict
uint8_t direction
Definition: direction.H:46
commsTypes
Communications types.
Definition: UPstream.H:81
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
virtual tmp< faPatchField< Type > > clone() const
No clone without an internal field reference.
Definition: faPatchField.H:534
friend Ostream & operator(Ostream &, const faPatchField< Type > &)
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 void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:41
virtual bool coupled() const
True if derived from coupledFaPatchField.
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition: Field.H:69
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 void write(Ostream &) const
Write.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:73
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.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
"buffered" : (MPI_Bsend, MPI_Recv)
A FieldMapper for finite-area patch fields.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Namespace for OpenFOAM.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
readOption
Enumeration defining read preferences.