buoyancyForce.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 "buoyancyForce.H"
27 #include "fvMatrices.H"
29 
30 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace fv
35 {
36  defineTypeNameAndDebug(buoyancyForce, 0);
37 
39  (
40  option,
41  buoyancyForce,
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  g_
60  (
61  IOobject
62  (
63  "g",
64  mesh.time().constant(),
65  mesh,
66  IOobject::MUST_READ,
67  IOobject::NO_WRITE
68  )
69  )
70 {
71  coeffs_.lookup("fieldNames") >> fieldNames_;
72 
73  if (fieldNames_.size() != 1)
74  {
76  << "settings are:" << fieldNames_ << exit(FatalError);
77  }
78 
79  applied_.setSize(fieldNames_.size(), false);
80 }
81 
82 
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84 
86 (
87  const volScalarField& rho,
88  fvMatrix<vector>& eqn,
89  const label fieldI
90 )
91 {
92  eqn += rho*g_;
93 }
94 
95 
96 // ************************************************************************* //
Foam::fv::buoyancyForce::buoyancyForce
buoyancyForce(const buoyancyForce &)
Disallow default bitwise copy construct.
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
buoyancyForce.H
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
fvMatrices.H
A special matrix type and solver, designed for finite volume solutions of scalar equations.
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)
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
Foam::fv::buoyancyForce::addSup
virtual void addSup(const volScalarField &rho, fvMatrix< vector > &eqn, const label fieldI)
Add explicit contribution to compressible momentum equation.
Definition: buoyancyForce.C:86