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 | Copyright (C) 2015 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 \*---------------------------------------------------------------------------*/
25 
26 #include "buoyancyEnergy.H"
27 #include "fvMatrices.H"
29 
30 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace fv
35 {
36  defineTypeNameAndDebug(buoyancyEnergy, 0);
37 
39  (
40  option,
41  buoyancyEnergy,
42  dictionary
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
51 (
52  const word& sourceName,
53  const word& modelType,
54  const dictionary& dict,
55  const fvMesh& mesh
56 )
57 :
58  option(sourceName, modelType, dict, mesh),
59  UName_(coeffs_.lookupOrDefault<word>("UName", "U"))
60 {
61  coeffs_.lookup("fieldNames") >> fieldNames_;
62 
63  if (fieldNames_.size() != 1)
64  {
66  << "settings are:" << fieldNames_ << exit(FatalError);
67  }
68 
69  applied_.setSize(fieldNames_.size(), false);
70 }
71 
72 
73 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 
76 (
77  const volScalarField& rho,
78  fvMatrix<scalar>& eqn,
79  const label fieldI
80 )
81 {
83  mesh_.lookupObject<uniformDimensionedVectorField>("g");
84 
85  const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
86 
87  eqn += rho*(U&g);
88 }
89 
90 
91 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fv::buoyancyEnergy::buoyancyEnergy
buoyancyEnergy(const buoyancyEnergy &)
Disallow default bitwise copy construct.
g
const dimensionedVector & g
Definition: setRegionFluidFields.H:33
U
U
Definition: pEqn.H:46
fvMatrices.H
A special matrix type and solver, designed for finite volume solutions of scalar equations.
buoyancyEnergy.H
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:59
Foam::fv::option
Finite volume options abtract base class. Provides a base set of controls, e.g.
Definition: fvOption.H:65
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
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:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
rho
rho
Definition: pEqn.H:3
fv
labelList fv(nPoints)
Foam::fv::defineTypeNameAndDebug
defineTypeNameAndDebug(option, 0)
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:76
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
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:68
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52