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 | Copyright (C) 2011-2016 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 Group
28  grpCoupledBoundaryConditions
29 
30 Description
31  Abstract base class for coupled patches.
32 
33 SourceFiles
34  coupledFvPatchField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef coupledFvPatchField_H
39 #define coupledFvPatchField_H
40 
41 #include "LduInterfaceField.H"
42 #include "fvPatchField.H"
43 #include "coupledFvPatch.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class coupledFvPatch Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class Type>
56 :
57  public LduInterfaceField<Type>,
58  public fvPatchField<Type>
59 {
60 
61 public:
62 
63  //- Runtime type information
64  TypeName(coupledFvPatch::typeName_());
65 
66 
67  // Constructors
68 
69  //- Construct from patch and internal field
71  (
72  const fvPatch&,
74  );
75 
76  //- Construct from patch and internal field and patch field
78  (
79  const fvPatch&,
81  const Field<Type>&
82  );
83 
84  //- Construct from patch, internal field and dictionary
86  (
87  const fvPatch&,
89  const dictionary&,
90  const bool valueRequired=true
91  );
92 
93  //- Construct by mapping the given coupledFvPatchField onto a new patch
95  (
97  const fvPatch&,
99  const fvPatchFieldMapper&
100  );
101 
102  //- Construct as copy
104  (
106  );
107 
108  //- Construct and return a clone
109  virtual tmp<fvPatchField<Type>> clone() const = 0;
110 
111  //- Construct as copy setting internal field reference
113  (
116  );
117 
118  //- Construct and return a clone
120  (
122  ) const = 0;
123 
124 
125  // Member functions
126 
127  // Access
128 
129  //- Return true if this patch field is derived from
130  // coupledFvPatchField<Type>.
131  virtual bool coupled() const
132  {
133  return true;
134  }
135 
136  //- Return neighbour field of internal field
137  virtual tmp<Field<Type>> patchNeighbourField() const = 0;
138 
139 
140  // Evaluation functions
141 
142  //- Return patch-normal gradient
143  virtual tmp<Field<Type>> snGrad
144  (
145  const scalarField& deltaCoeffs
146  ) const;
147 
148  //- Return patch-normal gradient
149  virtual tmp<Field<Type>> snGrad() const
150  {
152  return *this;
153  }
154 
155  //- Initialise the evaluation of the patch field
156  virtual void initEvaluate
157  (
158  const Pstream::commsTypes commsType
159  );
160 
161  //- Evaluate the patch field
162  virtual void evaluate
163  (
164  const Pstream::commsTypes commsType
165  );
166 
167  //- Return the matrix diagonal coefficients corresponding to the
168  // evaluation of the value of this patchField with given weights
170  (
171  const tmp<scalarField>&
172  ) const;
173 
174  //- Return the matrix source coefficients corresponding to the
175  // evaluation of the value of this patchField with given weights
177  (
178  const tmp<scalarField>&
179  ) const;
180 
181  //- Return the matrix diagonal coefficients corresponding to the
182  // evaluation of the gradient of this patchField
184  (
185  const scalarField& deltaCoeffs
186  ) const;
187 
188  //- Return the matrix diagonal coefficients corresponding to the
189  // evaluation of the gradient of this patchField
190  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
191 
192  //- Return the matrix source coefficients corresponding to the
193  // evaluation of the gradient of this patchField
195  (
196  const scalarField& deltaCoeffs
197  ) const;
198 
199  //- Return the matrix source coefficients corresponding to the
200  // evaluation of the gradient of this patchField
201  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
202 
203 
204  // Coupled interface functionality
205 
206  //- Update result field based on interface functionality
207  virtual void updateInterfaceMatrix
208  (
209  scalarField& result,
210  const scalarField& psiInternal,
211  const scalarField& coeffs,
212  const direction,
213  const Pstream::commsTypes commsType
214  ) const = 0;
215 
216  //- Update result field based on interface functionality
217  virtual void updateInterfaceMatrix
218  (
219  Field<Type>&,
220  const Field<Type>&,
221  const scalarField&,
222  const Pstream::commsTypes commsType
223  ) const = 0;
224 
225 
226  //- Write
227  virtual void write(Ostream&) const;
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #ifdef NoRepository
238  #include "coupledFvPatchField.C"
239 #endif
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #endif
244 
245 // ************************************************************************* //
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.