tabulatedAccelerationSource.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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "fvMesh.H"
30 #include "fvMatrices.H"
31 #include "geometricOneField.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace fv
39 {
40  defineTypeNameAndDebug(tabulatedAccelerationSource, 0);
42  (
43  option,
44  tabulatedAccelerationSource,
45  dictionary
46  );
47 }
48 }
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
53 Foam::fv::tabulatedAccelerationSource::tabulatedAccelerationSource
54 (
55  const word& name,
56  const word& modelType,
57  const dictionary& dict,
58  const fvMesh& mesh
59 )
60 :
61  option(name, modelType, dict, mesh),
62  motion_(coeffs_, mesh.time()),
63  UName_(coeffs_.lookupOrDefault<word>("U", "U")),
64  g0_("g0", dimAcceleration, Zero)
65 {
66  fieldNames_.setSize(1, UName_);
67  applied_.setSize(1, false);
68 
69  if (mesh.time().foundObject<uniformDimensionedVectorField>("g"))
70  {
71  g0_ = mesh.time().lookupObject<uniformDimensionedVectorField>("g");
72  }
73 }
74 
75 
76 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
77 
78 void Foam::fv::tabulatedAccelerationSource::addSup
79 (
80  fvMatrix<vector>& eqn,
81  const label fieldi
82 )
83 {
84  addSup<geometricOneField>(geometricOneField(), eqn, fieldi);
85 }
86 
87 
88 void Foam::fv::tabulatedAccelerationSource::addSup
89 (
90  const volScalarField& rho,
91  fvMatrix<vector>& eqn,
92  const label fieldi
93 )
94 {
95  addSup<volScalarField>(rho, eqn, fieldi);
96 }
97 
98 
100 {
101  if (option::read(dict))
102  {
103  return motion_.read(coeffs_);
104  }
105 
106  return false;
107 }
108 
109 
110 // ************************************************************************* //
tabulatedAccelerationSource.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
Foam::geometricOneField
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
Definition: geometricOneField.H:54
rho
rho
Definition: readInitialConditions.H:96
fvMatrices.H
A special matrix type and solver, designed for finite volume solutions of scalar equations.
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
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::fv::option::coeffs_
dictionary coeffs_
Dictionary containing source coefficients.
Definition: fvOption.H:88
Foam::tabulated6DoFAcceleration::read
virtual bool read(const dictionary &accelerationCoeffs)
Update properties from given dictionary.
Definition: tabulated6DoFAcceleration.C:96
dict
dictionary dict
Definition: searchingEngine.H:14
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
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fv::option::read
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: fvOptionIO.C:55
Foam::dimAcceleration
const dimensionSet dimAcceleration
fv
labelList fv(nPoints)
Foam::fv::defineTypeNameAndDebug
defineTypeNameAndDebug(option, 0)
Foam::fv::addToRunTimeSelectionTable
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
geometricOneField.H
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
Foam::fv::tabulatedAccelerationSource::motion_
tabulated6DoFAcceleration motion_
Run-time selectable acceleration model.
Definition: tabulatedAccelerationSource.H:78
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::tabulatedAccelerationSource::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: tabulatedAccelerationSource.C:99