velocityRamping.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) 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 
26 #include "fvMesh.H"
27 #include "fvMatrix.H"
28 #include "geometricOneField.H"
29 #include "velocityRamping.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace fv
37 {
38  defineTypeNameAndDebug(velocityRamping, 0);
39  addToRunTimeSelectionTable(option, velocityRamping, dictionary);
40 }
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
47 (
48  const word& name,
49  const word& modelType,
50  const dictionary& dict,
51  const fvMesh& mesh
52 )
53 :
54  cellSetOption(name, modelType, dict, mesh),
55  velocity_(vector::zero),
56  ramp_(nullptr)
57 {
58  read(dict);
59 }
60 
61 
62 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
63 
65 (
66  fvMatrix<vector>& eqn,
67  const label fieldi
68 )
69 {
70  add(geometricOneField(), eqn, fieldi);
71 }
72 
73 
75 (
76  const volScalarField& rho,
77  fvMatrix<vector>& eqn,
78  const label fieldi
79 )
80 {
81  add(rho, eqn, fieldi);
82 }
83 
84 
86 (
87  const volScalarField& alpha,
88  const volScalarField& rho,
89  fvMatrix<vector>& eqn,
90  const label fieldi
91 )
92 {
93  add((alpha*rho)(), eqn, fieldi);
94 }
95 
96 
98 {
99  if (cellSetOption::read(dict))
100  {
101  fieldNames_ = wordList(1, coeffs_.lookupOrDefault<word>("U", "U"));
102 
103  applied_.setSize(1, false);
104 
105  velocity_ = dict.lookupType<vector>("velocity");
106 
107  ramp_ = Function1<scalar>::New("ramp", dict);
108 
109  return true;
110  }
111  else
112  {
113  return false;
114  }
115 }
116 
117 
118 // ************************************************************************* //
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:137
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
virtual bool read(const dictionary &dict)
Read source dictionary.
Macros for easy insertion into run-time selection tables.
T lookupType(const word &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
bool read(const char *, int32_t &)
Definition: int32IO.C:85
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)
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
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
virtual bool read(const dictionary &dict)
Read dictionary.
List< word > wordList
A List of words.
Definition: fileName.H:54
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Cell-set options abtract base class. Provides a base set of controls, e.g.:
Definition: cellSetOption.H:69
velocityRamping(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Source term to momentum equation.
static autoPtr< Function1< Type > > New(const word &entryName, const dictionary &dict)
Selector.
Definition: Function1New.C:32
Namespace for OpenFOAM.