coupledFvPatchField.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019 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::coupledFvPatchField
29 
30 Group
31  grpCoupledBoundaryConditions
32 
33 Description
34  Abstract base class for coupled patches.
35 
36 SourceFiles
37  coupledFvPatchField.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef coupledFvPatchField_H
42 #define coupledFvPatchField_H
43 
44 #include "LduInterfaceField.H"
45 #include "fvPatchField.H"
46 #include "coupledFvPatch.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class coupledFvPatch Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type>
59 :
60  public LduInterfaceField<Type>,
61  public fvPatchField<Type>
62 {
63 
64 public:
65 
66  //- Runtime type information
67  TypeName(coupledFvPatch::typeName_());
68 
69 
70  // Constructors
71 
72  //- Construct from patch and internal field
74  (
75  const fvPatch&,
77  );
78 
79  //- Construct from patch and internal field and patch field
81  (
82  const fvPatch&,
84  const Field<Type>&
85  );
86 
87  //- Construct from patch, internal field and dictionary
89  (
90  const fvPatch&,
92  const dictionary&,
93  const bool valueRequired=true
94  );
95 
96  //- Construct by mapping the given coupledFvPatchField onto a new patch
98  (
100  const fvPatch&,
102  const fvPatchFieldMapper&
103  );
104 
105  //- Construct as copy
107  (
109  );
110 
111  //- Construct and return a clone
112  virtual tmp<fvPatchField<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  // coupledFvPatchField<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
147  (
148  const scalarField& deltaCoeffs
149  ) const;
150 
151  //- Return patch-normal gradient
152  virtual tmp<Field<Type>> snGrad() const
153  {
155  return *this;
156  }
157 
158  //- Initialise the evaluation of the patch field
159  virtual void initEvaluate
160  (
161  const Pstream::commsTypes commsType
162  );
163 
164  //- Evaluate the patch field
165  virtual void evaluate
166  (
167  const Pstream::commsTypes commsType
168  );
169 
170  //- Return the matrix diagonal 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 source coefficients corresponding to the
178  // evaluation of the value of this patchField with given weights
180  (
181  const tmp<scalarField>&
182  ) const;
183 
184  //- Return the matrix diagonal coefficients corresponding to the
185  // evaluation of the gradient of this patchField
187  (
188  const scalarField& deltaCoeffs
189  ) const;
190 
191  //- Return the matrix diagonal coefficients corresponding to the
192  // evaluation of the gradient of this patchField
193  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
194 
195  //- Return the matrix source coefficients corresponding to the
196  // evaluation of the gradient of this patchField
198  (
199  const scalarField& deltaCoeffs
200  ) 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>&,
226  const bool add,
227  const lduAddressing& lduAddr,
228  const label patchId,
229  const Field<Type>&,
230  const scalarField&,
231  const Pstream::commsTypes commsType
232  ) const = 0;
233 
234 
235  //- Write
236  virtual void write(Ostream&) const;
237 };
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace Foam
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #ifdef NoRepository
247  #include "coupledFvPatchField.C"
248 #endif
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 #endif
253 
254 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
Foam::coupledFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const =0
Construct and return a clone.
Foam::coupledFvPatchField::coupledFvPatchField
coupledFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: coupledFvPatchField.C:34
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::coupledFvPatchField::initEvaluate
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
Definition: coupledFvPatchField.C:123
coupledFvPatchField.C
Foam::coupledFvPatchField::gradientBoundaryCoeffs
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
Definition: coupledFvPatchField.C:205
Foam::coupledFvPatchField::patchNeighbourField
virtual tmp< Field< Type > > patchNeighbourField() const =0
Return neighbour field of internal field.
coupledFvPatch.H
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::coupledFvPatchField::updateInterfaceMatrix
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.
Foam::coupledFvPatchField::coupled
virtual bool coupled() const
Return true if this patch field is derived from.
Definition: coupledFvPatchField.H:133
Foam::coupledFvPatchField::gradientInternalCoeffs
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
Definition: coupledFvPatchField.C:185
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::coupledFvPatchField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
Definition: coupledFvPatchField.C:133
Foam::LduInterfaceField
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
Definition: LduInterfaceField.H:58
Foam::coupledFvPatchField::valueBoundaryCoeffs
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
Definition: coupledFvPatchField.C:164
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::coupledFvPatchField
Abstract base class for coupled patches.
Definition: coupledFvPatchField.H:57
LduInterfaceField.H
Foam::coupledFvPatchField::TypeName
TypeName(coupledFvPatch::typeName_())
Runtime type information.
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
patchId
label patchId(-1)
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::coupledFvPatchField::snGrad
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Definition: coupledFvPatchField.H:151
Foam::coupledFvPatchField::valueInternalCoeffs
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Definition: coupledFvPatchField.C:153
Foam::coupledFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: coupledFvPatchField.C:213
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
fvPatchField.H