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-2024 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 fieldMapper&
97  );
98 
99  //- Disallow copy without setting internal field reference
101 
102  //- Copy constructor setting internal field reference
104  (
107  );
108 
109  //- Construct and return a clone
111  (
113  ) const = 0;
114 
115 
116  // Member Functions
117 
118  // Access
119 
120  //- Return true if this patch field is derived from
121  // coupledFvPatchField<Type>.
122  virtual bool coupled() const
123  {
124  return true;
125  }
126 
127  //- Return neighbour field of internal field
129  (
130  const Pstream::commsTypes commsType =
132  ) const = 0;
133 
134 
135  // Mapping functions
136 
137  //- Map the given fvPatchField onto this fvPatchField
138  virtual void map(const fvPatchField<Type>&, const fieldMapper&);
139 
140 
141  // Evaluation functions
142 
143  //- Return patch-normal gradient
144  virtual tmp<Field<Type>> snGrad
145  (
146  const scalarField& deltaCoeffs
147  ) const;
148 
149  //- Return patch-normal gradient
150  virtual tmp<Field<Type>> snGrad() const
151  {
153  return *this;
154  }
155 
156  //- Initialise the evaluation of the patch field
157  virtual void initEvaluate
158  (
159  const Pstream::commsTypes commsType
160  );
161 
162  //- Evaluate the patch field, but don't update the coeffs
163  void evaluateNoUpdateCoeffs();
164 
165  //- Evaluate the patch field
166  virtual void evaluate
167  (
168  const Pstream::commsTypes commsType
169  );
170 
171  //- Return the matrix diagonal coefficients corresponding to the
172  // evaluation of the value of this patchField with given weights
174  (
175  const tmp<scalarField>&
176  ) const;
177 
178  //- Return the matrix source coefficients corresponding to the
179  // evaluation of the value of this patchField with given weights
181  (
182  const tmp<scalarField>&
183  ) const;
184 
185  //- Return the matrix diagonal coefficients corresponding to the
186  // evaluation of the gradient of this patchField
188  (
189  const scalarField& deltaCoeffs
190  ) const;
191 
192  //- Return the matrix diagonal coefficients corresponding to the
193  // evaluation of the gradient of this patchField
194  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
195 
196  //- Return the matrix source coefficients corresponding to the
197  // evaluation of the gradient of this patchField
199  (
200  const scalarField& deltaCoeffs
201  ) const;
202 
203  //- Return the matrix source coefficients corresponding to the
204  // evaluation of the gradient of this patchField
205  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
206 
207 
208  // Coupled interface functionality
209 
210  //- Update result field based on interface functionality
211  virtual void updateInterfaceMatrix
212  (
213  scalarField& result,
214  const scalarField& psiInternal,
215  const scalarField& coeffs,
216  const direction,
217  const Pstream::commsTypes commsType
218  ) const = 0;
219 
220  //- Update result field based on interface functionality
221  virtual void updateInterfaceMatrix
222  (
223  Field<Type>&,
224  const Field<Type>&,
225  const scalarField&,
226  const Pstream::commsTypes commsType
227  ) const = 0;
228 
229 
230  //- Write
231  virtual void write(Ostream&) const;
232 };
233 
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #ifdef NoRepository
242  #include "coupledFvPatchField.C"
243 #endif
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #endif
248 
249 // ************************************************************************* //
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:83
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.
void evaluateNoUpdateCoeffs()
Evaluate the patch field, but don't update the coeffs.
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.
virtual void map(const fvPatchField< Type > &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:204
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:381
Namespace for OpenFOAM.
uint8_t direction
Definition: direction.H:45