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-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 \*---------------------------------------------------------------------------*/
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 
50 Foam::fv::buoyancyForce::buoyancyForce
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,
68  )
69  )
70 {
71  coeffs_.lookup("fields") >> 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 // ************************************************************************* //
defineTypeNameAndDebug(option, 0)
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
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
Macros for easy insertion into run-time selection tables.
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
const word & constant() const
Return constant name.
Definition: TimePaths.H:124
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
A special matrix type and solver, designed for finite volume solutions of scalar equations.
virtual void addSup(const volScalarField &rho, fvMatrix< vector > &eqn, const label fieldi)
Add explicit contribution to compressible momentum equation.
Definition: buoyancyForce.C:86
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.
Finite volume options abstract base class. Provides a base set of controls, e.g.: ...
Definition: fvOption.H:66