tabulatedAccelerationSource.C
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) 2015-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 \*---------------------------------------------------------------------------*/
25 
27 #include "fvMesh.H"
28 #include "fvMatrices.H"
29 #include "geometricOneField.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace fv
37 {
38  defineTypeNameAndDebug(tabulatedAccelerationSource, 0);
40  (
41  option,
42  tabulatedAccelerationSource,
43  dictionary
44  );
45 }
46 }
47 
48 
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 
52 (
53  const word& name,
54  const word& modelType,
55  const dictionary& dict,
56  const fvMesh& mesh
57 )
58 :
59  option(name, modelType, dict, mesh),
60  motion_(coeffs_, mesh.time()),
61  UName_(coeffs_.lookupOrDefault<word>("U", "U")),
62  g0_("g0", dimAcceleration, Zero)
63 {
64  fieldNames_.setSize(1, UName_);
65  applied_.setSize(1, false);
66 
68  {
70  }
71 }
72 
73 
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75 
76 void Foam::fv::tabulatedAccelerationSource::addSup
77 (
78  fvMatrix<vector>& eqn,
79  const label fieldi
80 )
81 {
82  addSup<geometricOneField>(geometricOneField(), eqn, fieldi);
83 }
84 
85 
86 void Foam::fv::tabulatedAccelerationSource::addSup
87 (
88  const volScalarField& rho,
89  fvMatrix<vector>& eqn,
90  const label fieldi
91 )
92 {
93  addSup<volScalarField>(rho, eqn, fieldi);
94 }
95 
96 
98 {
99  if (option::read(dict))
100  {
101  return motion_.read(coeffs_);
102  }
103  else
104  {
105  return false;
106  }
107 }
108 
109 
110 // ************************************************************************* //
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
tabulatedAccelerationSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
bool foundObject(const word &name) const
Is the named Type found?
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:239
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Macros for easy insertion into run-time selection tables.
const dimensionSet dimAcceleration
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: fvOptionIO.C:53
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
static const zero Zero
Definition: zero.H:97
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.
Namespace for OpenFOAM.
Finite volume options abstract base class. Provides a base set of controls, e.g.: ...
Definition: fvOption.H:66
virtual bool read(const dictionary &dict)
Read dictionary.