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 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);
43  (
44  option,
45  tabulatedAccelerationSource,
46  dictionary
47  );
48 }
49 }
50 
51 
52 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
53 
54 Foam::fv::tabulatedAccelerationSource::tabulatedAccelerationSource
55 (
56  const word& name,
57  const word& modelType,
58  const dictionary& dict,
59  const fvMesh& mesh
60 )
61 :
62  option(name, modelType, dict, mesh),
63  motion_(coeffs_, mesh.time()),
64  UName_(coeffs_.getOrDefault<word>("U", "U")),
65  g0_("g0", dimAcceleration, Zero)
66 {
67  fieldNames_.setSize(1, UName_);
68  applied_.setSize(1, false);
69 
70  if (mesh.time().foundObject<uniformDimensionedVectorField>("g"))
71  {
72  g0_ = mesh.time().lookupObject<uniformDimensionedVectorField>("g");
73  }
74 }
75 
76 
77 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78 
79 void Foam::fv::tabulatedAccelerationSource::addSup
80 (
81  fvMatrix<vector>& eqn,
82  const label fieldi
83 )
84 {
85  addSup<geometricOneField>(geometricOneField(), eqn, fieldi);
86 }
87 
88 
89 void Foam::fv::tabulatedAccelerationSource::addSup
90 (
91  const volScalarField& rho,
92  fvMatrix<vector>& eqn,
93  const label fieldi
94 )
95 {
96  addSup<volScalarField>(rho, eqn, fieldi);
97 }
98 
99 
101 {
102  if (option::read(dict))
103  {
104  return motion_.read(coeffs_);
105  }
106 
107  return false;
108 }
109 
110 
111 // ************************************************************************* //
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 (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:54
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
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)
geometricOneField.H
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
Foam::fv::defineTypeNameAndDebug
defineTypeNameAndDebug(atmAmbientTurbSource, 0)
Foam::fv::tabulatedAccelerationSource::motion_
tabulated6DoFAcceleration motion_
Run-time selectable acceleration model.
Definition: tabulatedAccelerationSource.H:78
Foam::fv::addToRunTimeSelectionTable
addToRunTimeSelectionTable(option, atmAmbientTurbSource, dictionary)
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::tabulatedAccelerationSource::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: tabulatedAccelerationSource.C:100