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