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-2018 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  );
98 
99  //- Construct as copy
101  (
103  );
104 
105  //- Construct and return a clone
106  virtual tmp<fvPatchField<Type>> clone() const = 0;
107 
108  //- Construct as copy setting internal field reference
110  (
113  );
114 
115  //- Construct and return a clone
117  (
119  ) const = 0;
120 
121 
122  // Member functions
123 
124  // Access
125 
126  //- Return true if this patch field is derived from
127  // coupledFvPatchField<Type>.
128  virtual bool coupled() const
129  {
130  return true;
131  }
132 
133  //- Return neighbour field of internal field
134  virtual tmp<Field<Type>> patchNeighbourField() const = 0;
135 
136 
137  // Evaluation functions
138 
139  //- Return patch-normal gradient
140  virtual tmp<Field<Type>> snGrad
141  (
142  const scalarField& deltaCoeffs
143  ) const;
144 
145  //- Return patch-normal gradient
146  virtual tmp<Field<Type>> snGrad() const
147  {
149  return *this;
150  }
151 
152  //- Initialise the evaluation of the patch field
153  virtual void initEvaluate
154  (
155  const Pstream::commsTypes commsType
156  );
157 
158  //- Evaluate the patch field
159  virtual void evaluate
160  (
161  const Pstream::commsTypes commsType
162  );
163 
164  //- Return the matrix diagonal coefficients corresponding to the
165  // evaluation of the value of this patchField with given weights
167  (
168  const tmp<scalarField>&
169  ) const;
170 
171  //- Return the matrix source 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 diagonal coefficients corresponding to the
179  // evaluation of the gradient of this patchField
181  (
182  const scalarField& deltaCoeffs
183  ) const;
184 
185  //- Return the matrix diagonal coefficients corresponding to the
186  // evaluation of the gradient of this patchField
187  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
188 
189  //- Return the matrix source coefficients corresponding to the
190  // evaluation of the gradient of this patchField
192  (
193  const scalarField& deltaCoeffs
194  ) const;
195 
196  //- Return the matrix source coefficients corresponding to the
197  // evaluation of the gradient of this patchField
198  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
199 
200 
201  // Coupled interface functionality
202 
203  //- Update result field based on interface functionality
204  virtual void updateInterfaceMatrix
205  (
206  scalarField& result,
207  const scalarField& psiInternal,
208  const scalarField& coeffs,
209  const direction,
210  const Pstream::commsTypes commsType
211  ) const = 0;
212 
213  //- Update result field based on interface functionality
214  virtual void updateInterfaceMatrix
215  (
216  Field<Type>&,
217  const Field<Type>&,
218  const scalarField&,
219  const Pstream::commsTypes commsType
220  ) const = 0;
221 
222 
223  //- Write
224  virtual void write(Ostream&) const;
225 };
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #ifdef NoRepository
235  #include "coupledFvPatchField.C"
236 #endif
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #endif
241 
242 // ************************************************************************* //
virtual void updateInterfaceMatrix(scalarField &result, const scalarField &psiInternal, const scalarField &coeffs, const direction, const Pstream::commsTypes commsType) const =0
Update result field based on interface functionality.
virtual tmp< fvPatchField< Type > > clone() const =0
Construct and return a clone.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
commsTypes
Types of communications.
Definition: UPstream.H:64
uint8_t direction
Definition: direction.H:45
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual bool coupled() const
Return true if this patch field is derived from.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual void write(Ostream &) const
Write.
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fvPatchFieldMapper.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
virtual tmp< Field< Type > > patchNeighbourField() const =0
Return neighbour field of internal field.
Abstract base class for coupled patches.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
TypeName(coupledFvPatch::typeName_())
Runtime type information.
coupledFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: PtrList.H:53
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Namespace for OpenFOAM.