buoyancyEnergy.C
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) 2015-2016 OpenFOAM Foundation
9  Copyright (C) 2018 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 \*---------------------------------------------------------------------------*/
28 
29 #include "buoyancyEnergy.H"
30 #include "fvMatrices.H"
31 #include "gravityMeshObject.H"
33 
34 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace fv
39 {
40  defineTypeNameAndDebug(buoyancyEnergy, 0);
41 
43  (
44  option,
45  buoyancyEnergy,
46  dictionary
47  );
48 }
49 }
50 
51 
52 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
53 
54 Foam::fv::buoyancyEnergy::buoyancyEnergy
55 (
56  const word& sourceName,
57  const word& modelType,
58  const dictionary& dict,
59  const fvMesh& mesh
60 )
61 :
62  option(sourceName, modelType, dict, mesh),
63  UName_(coeffs_.lookupOrDefault<word>("U", "U"))
64 {
65  coeffs_.readEntry("fields", fieldNames_);
66 
67  if (fieldNames_.size() != 1)
68  {
70  << "settings are:" << fieldNames_ << exit(FatalError);
71  }
72 
73  applied_.setSize(fieldNames_.size(), false);
74 }
75 
76 
77 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78 
80 (
81  const volScalarField& rho,
82  fvMatrix<scalar>& eqn,
83  const label fieldi
84 )
85 {
87  meshObjects::gravity::New(mesh_.time());
88 
89  const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
90 
91  eqn += rho*(U&g);
92 }
93 
94 
96 {
98 
99  return false;
100 }
101 
102 
103 // ************************************************************************* //
Foam::fv::buoyancyEnergy::addSup
virtual void addSup(const volScalarField &rho, fvMatrix< scalar > &eqn, const label fieldi)
Add explicit contribution to compressible momentum equation.
Definition: buoyancyEnergy.C:80
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
gravityMeshObject.H
Foam::fv::buoyancyEnergy::read
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: buoyancyEnergy.C:95
rho
rho
Definition: readInitialConditions.H:96
fvMatrices.H
A special matrix type and solver, designed for finite volume solutions of scalar equations.
buoyancyEnergy.H
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:419
Foam::UniformDimensionedField< vector >
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::fv::option
Finite volume options abstract base class. Provides a base set of controls, e.g.:
Definition: fvOption.H:69
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
g
const uniformDimensionedVectorField & g
Definition: createFluidFields.H:24
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
fv
labelList fv(nPoints)
Foam::fv::defineTypeNameAndDebug
defineTypeNameAndDebug(option, 0)
U
U
Definition: pEqn.H:72
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
Foam::fv::addToRunTimeSelectionTable
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
Foam::GeometricField< scalar, fvPatchField, volMesh >