sixDoFAccelerationSource.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-2021 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 "fvMatrices.H"
28 #include "geometricOneField.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace fv
36 {
37  defineTypeNameAndDebug(sixDoFAccelerationSource, 0);
39  (
40  fvModel,
41  sixDoFAccelerationSource,
42  dictionary
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 #include "None.H"
51 #include "Constant.H"
52 #include "Uniform.H"
53 #include "ZeroConstant.H"
54 #include "OneConstant.H"
55 #include "Polynomial1.H"
56 #include "Sine.H"
57 #include "Square.H"
58 #include "Table.H"
59 #include "UniformTable1.H"
60 #include "NonUniformTable1.H"
61 #include "EmbeddedTableReader.H"
62 #include "FoamTableReader.H"
63 #include "Scale.H"
64 #include "CodedFunction1.H"
65 
67 
68 template<>
69 const char* const avType::vsType::typeName = "vectorVector";
70 
71 template<>
72 const char* const avType::vsType::componentNames[] = {"x", "y", "z"};
73 
74 template<>
76 
77 template<>
79 
80 template<>
82 
83 template<>
85 
86 template<>
87 const avType avType::vsType::rootMax
88 (
89  avType::uniform(vector::uniform(rootVGreat))
90 );
91 
92 template<>
93 const avType avType::vsType::rootMin
94 (
95  avType::uniform(vector::uniform(-rootVGreat))
96 );
97 
98 namespace Foam
99 {
100 
101  makeFunction1s(avType);
102 
103  defineTableReader(avType);
104  makeTableReader(Embedded, avType);
105  makeTableReader(Foam, avType);
106 }
107 
108 
109 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
110 
111 void Foam::fv::sixDoFAccelerationSource::readCoeffs()
112 {
113  UName_ = coeffs().lookupOrDefault<word>("U", "U");
114 
115  accelerations_.reset
116  (
118  (
119  "accelerations",
120  coeffs()
121  ).ptr()
122  );
123 }
124 
125 
126 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
127 
129 (
130  const word& name,
131  const word& modelType,
132  const dictionary& dict,
133  const fvMesh& mesh
134 )
135 :
136  fvModel(name, modelType, dict, mesh),
137  UName_(coeffs().lookupOrDefault<word>("U", "U")),
138  accelerations_(nullptr),
139  g_
140  (
144  )
145 {
146  readCoeffs();
147 }
148 
149 
150 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
151 
153 {
154  return wordList(1, UName_);
155 }
156 
157 
158 void Foam::fv::sixDoFAccelerationSource::addSup
159 (
160  fvMatrix<vector>& eqn,
161  const word& fieldName
162 ) const
163 {
164  addSup<geometricOneField>(geometricOneField(), eqn, fieldName);
165 }
166 
167 
168 void Foam::fv::sixDoFAccelerationSource::addSup
169 (
170  const volScalarField& rho,
171  fvMatrix<vector>& eqn,
172  const word& fieldName
173 ) const
174 {
175  addSup<volScalarField>(rho, eqn, fieldName);
176 }
177 
178 
180 {
181  if (fvModel::read(dict))
182  {
183  readCoeffs();
184  return true;
185  }
186  else
187  {
188  return false;
189  }
190 }
191 
192 
193 // ************************************************************************* //
static const char *const typeName
Definition: VectorSpace.H:111
defineTypeNameAndDebug(fixedTemperatureConstraint, 0)
static const Form max
Definition: VectorSpace.H:115
makeFunction1s(trvType)
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: fvModel.C:158
static const char *const componentNames[]
Definition: VectorSpace.H:112
static const Form rootMin
Definition: VectorSpace.H:118
bool foundObject(const word &name) const
Is the named Type found?
Finite volume model abstract base class.
Definition: fvModel.H:55
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.
static const Form min
Definition: VectorSpace.H:116
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
const dimensionSet dimAcceleration
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
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
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross product operators.
Definition: Vector.H:57
makeTableReader(Embedded, trvType)
addToRunTimeSelectionTable(fvConstraint, fixedTemperatureConstraint, dictionary)
List< word > wordList
A List of words.
Definition: fileName.H:54
sixDoFAccelerationSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
static const Form rootMax
Definition: VectorSpace.H:117
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.
static const Form one
Definition: VectorSpace.H:114
static Vector< vector > uniform(const vector &s)
Return a VectorSpace with all elements = s.
Definition: VectorSpaceI.H:168
Foam::fv::sixDoFAccelerationSource::accelerationVectors avType
defineTableReader(trvType)
static const Form zero
Definition: VectorSpace.H:113
Namespace for OpenFOAM.
static autoPtr< Function1< Type > > New(const word &name, const dictionary &dict)
Selector.
Definition: Function1New.C:32
virtual bool read(const dictionary &dict)
Read dictionary.