coupledFvPatchField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::coupledFvPatchField
26 
27 Description
28  Abstract base class for coupled patches.
29 
30 SourceFiles
31  coupledFvPatchField.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef coupledFvPatchField_H
36 #define coupledFvPatchField_H
37 
38 #include "LduInterfaceField.H"
39 #include "fvPatchField.H"
40 #include "coupledFvPatch.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class coupledFvPatch Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class Type>
53 :
54  public LduInterfaceField<Type>,
55  public fvPatchField<Type>
56 {
57 
58 public:
59 
60  //- Runtime type information
61  TypeName(coupledFvPatch::typeName_());
62 
63 
64  // Constructors
65 
66  //- Construct from patch and internal field
68  (
69  const fvPatch&,
71  );
72 
73  //- Construct from patch and internal field and patch field
75  (
76  const fvPatch&,
78  const Field<Type>&
79  );
80 
81  //- Construct from patch, internal field and dictionary
83  (
84  const fvPatch&,
86  const dictionary&,
87  const bool valueRequired=true
88  );
89 
90  //- Construct by mapping the given coupledFvPatchField onto a new patch
92  (
94  const fvPatch&,
96  const fvPatchFieldMapper&,
97  const bool mappingRequired=true
98  );
99 
100  //- Disallow copy without setting internal field reference
102 
103  //- Copy constructor setting internal field reference
105  (
108  );
109 
110  //- Construct and return a clone
112  (
114  ) const = 0;
115 
116 
117  // Member Functions
118 
119  // Access
120 
121  //- Return true if this patch field is derived from
122  // coupledFvPatchField<Type>.
123  virtual bool coupled() const
124  {
125  return true;
126  }
127 
128  //- Return neighbour field of internal field
130  (
131  const Pstream::commsTypes commsType =
133  ) const = 0;
134 
135 
136  // Evaluation functions
137 
138  //- Return patch-normal gradient
139  virtual tmp<Field<Type>> snGrad
140  (
141  const scalarField& deltaCoeffs
142  ) const;
143 
144  //- Return patch-normal gradient
145  virtual tmp<Field<Type>> snGrad() const
146  {
148  return *this;
149  }
150 
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  //- Return the matrix diagonal coefficients corresponding to the
164  // evaluation of the value of this patchField with given weights
166  (
167  const tmp<scalarField>&
168  ) const;
169 
170  //- Return the matrix source coefficients corresponding to the
171  // evaluation of the value of this patchField with given weights
173  (
174  const tmp<scalarField>&
175  ) const;
176 
177  //- Return the matrix diagonal coefficients corresponding to the
178  // evaluation of the gradient of this patchField
180  (
181  const scalarField& deltaCoeffs
182  ) const;
183 
184  //- Return the matrix diagonal coefficients corresponding to the
185  // evaluation of the gradient of this patchField
186  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
187 
188  //- Return the matrix source coefficients corresponding to the
189  // evaluation of the gradient of this patchField
191  (
192  const scalarField& deltaCoeffs
193  ) const;
194 
195  //- Return the matrix source coefficients corresponding to the
196  // evaluation of the gradient of this patchField
197  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
198 
199 
200  // Coupled interface functionality
201 
202  //- Update result field based on interface functionality
203  virtual void updateInterfaceMatrix
204  (
205  scalarField& result,
206  const scalarField& psiInternal,
207  const scalarField& coeffs,
208  const direction,
209  const Pstream::commsTypes commsType
210  ) const = 0;
211 
212  //- Update result field based on interface functionality
213  virtual void updateInterfaceMatrix
214  (
215  Field<Type>&,
216  const Field<Type>&,
217  const scalarField&,
218  const Pstream::commsTypes commsType
219  ) const = 0;
220 
221 
222  //- Write
223  virtual void write(Ostream&) const;
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #ifdef NoRepository
234  #include "coupledFvPatchField.C"
235 #endif
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #endif
240 
241 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Definition: Field.H:82
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
virtual void updateInterfaceMatrix(scalarField &, const scalarField &, const scalarField &, const direction, const Pstream::commsTypes commsType) const=0
Inherit updateInterfaceMatrix from lduInterfaceField.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
commsTypes
Types of communications.
Definition: UPstream.H:65
Abstract base class for coupled patches.
virtual void write(Ostream &) const
Write.
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.
virtual tmp< Field< Type > > patchNeighbourField(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking) const =0
Return neighbour field of internal field.
TypeName(coupledFvPatch::typeName_())
Runtime type information.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
coupledFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:203
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
Namespace for OpenFOAM.
uint8_t direction
Definition: direction.H:45