energyRegionCoupledFvPatchScalarField.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) 2012-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::energyRegionCoupledFvPatchScalarField
26 
27 Description
28  Energy region coupled implicit boundary condition.
29  The fvPatch is treated as uncoupled from the delta point of view.
30  In the mesh the fvPatch is an interface and is incorporated
31  into the matrix implicitly.
32 
33 SourceFiles
34  energyRegionCoupledFvPatchScalarField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef energyRegionCoupledFvPatchScalarField_H
39 #define energyRegionCoupledFvPatchScalarField_H
40 
42 #include "LduInterfaceField.H"
43 #include "fvPatchField.H"
44 #include "NamedEnum.H"
45 #include "basicThermo.H"
46 #include "coupledFvPatchField.H"
47 
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class energyRegionCoupledFvPatchScalarField Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public coupledFvPatchField<scalar>
61 {
62 
63 public:
64 
65  enum kappaMethodType
66  {
69  UNDEFINED
70  };
71 
72 
73 private:
74 
75  // Private data
76 
77  //- Local reference to region couple patch
78  const regionCoupledBaseFvPatch& regionCoupledPatch_;
79 
80  //- Methof to extract kappa
81  static const NamedEnum<kappaMethodType, 3> methodTypeNames_;
82 
83  //- How to get K
84  mutable kappaMethodType method_;
85 
86  //- AutoPtr to nbr thermo
87  mutable const basicThermo* nbrThermoPtr_;
88 
89  //- AutoPtr to my thermo
90  mutable const basicThermo* thermoPtr_;
91 
92 
93  // Private functions
94 
95  //- Local weight for this coupled field
96  tmp<scalarField> weights() const;
97 
98  //- Return nbr temperature internal field
99  tmp<scalarField> patchNeighbourTemperatureField() const;
100 
101  //- Return local temperature internal field
102  tmp<scalarField> patchInternalTemperatureField() const;
103 
104  //- Return kappa
105  tmp<scalarField> kappa() const;
106 
107  //- Set method
108  void setMethod() const;
109 
110 
111 public:
112 
113  //- Runtime type information
114  TypeName("compressible::energyRegionCoupled");
115 
116 
117  // Constructors
118 
119  //- Construct from patch and internal field
121  (
122  const fvPatch&,
124  );
125 
126  //- Construct from patch, internal field and dictionary
128  (
129  const fvPatch&,
131  const dictionary&
132  );
133 
134  //- Construct by mapping given energyRegionCoupledFvPatchScalarField
135  // onto a new patch
137  (
139  const fvPatch&,
141  const fvPatchFieldMapper&
142  );
143 
144  //- Construct as copy
146  (
148  );
149 
150  //- Construct and return a clone
151  virtual tmp<fvPatchField<scalar>> clone() const
152  {
154  (
156  );
157  }
158 
159  //- Construct as copy setting internal field reference
161  (
164  );
165 
166  //- Construct and return a clone setting internal field reference
168  (
170  ) const
171  {
173  (
175  );
176  }
177 
178 
179  //- Destructor
181  {}
182 
183 
184  // Member functions
185 
186  // Access
187 
188  //- Method to obtain K
189  word kappaMethod() const
190  {
191  return methodTypeNames_[method_];
192  }
193 
194 
195  // Evaluation functions
196 
197  //- Return neighbour coupled internal cell data
198  virtual tmp<scalarField> patchNeighbourField() const;
199 
200  //- Return patch-normal gradient
201  virtual tmp<scalarField> snGrad() const;
202 
203  //- Return patch-normal gradient
204  // Note: the deltaCoeffs supplied are not used
205  virtual tmp<scalarField> snGrad
206  (
207  const scalarField& deltaCoeffs
208  ) const;
209 
210 
211  //- Evaluate the patch field
212  virtual void evaluate
213  (
214  const Pstream::commsTypes commsType
215  );
216 
217 
218  // Coupled interface functionality
219 
220  //- Update result field based on interface functionality
221  virtual void updateInterfaceMatrix
222  (
223  Field<scalar>& result,
224  const scalarField& psiInternal,
225  const scalarField& coeffs,
226  const direction cmpt,
227  const Pstream::commsTypes commsType
228  ) const;
229 
230  //- Update result field based on interface functionality
231  virtual void updateInterfaceMatrix
232  (
233  Field<scalar>&,
234  const Field<scalar>&,
235  const scalarField&,
236  const Pstream::commsTypes commsType
237  ) const;
238 
239  //- Return the interface type
240  virtual const word& interfaceFieldType() const
241  {
242  return regionCoupledPatch_.regionCoupleType();
243  }
244 
245 
246  //- Write
247  virtual void write(Ostream&) const;
248 };
249 
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 } // End namespace Foam
254 
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 #endif
259 
260 // ************************************************************************* //
const word & regionCoupleType() const
Return the interface type.
Abstract base-class for fluid and solid thermodynamic properties.
Definition: basicThermo.H:52
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
commsTypes
Types of communications.
Definition: UPstream.H:64
uint8_t direction
Definition: direction.H:45
virtual tmp< fvPatchField< scalar > > clone() const
Construct and return a clone.
virtual void updateInterfaceMatrix(Field< scalar > &result, const scalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
virtual tmp< scalarField > patchNeighbourField() const
Return neighbour coupled internal cell data.
A class for handling words, derived from string.
Definition: word.H:59
Energy region coupled implicit boundary condition. The fvPatch is treated as uncoupled from the delta...
TypeName("compressible::energyRegionCoupled")
Runtime type information.
Foam::fvPatchFieldMapper.
Abstract base class for coupled patches.
virtual tmp< scalarField > snGrad() const
Return patch-normal gradient.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
energyRegionCoupledFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Base class of regionCoupledFvPatch with common functionality for regionCoupledFvPatch and regionCoupl...
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
virtual const word & interfaceFieldType() const
Return the interface type.
Namespace for OpenFOAM.