syringePressureFvPatchScalarField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2016 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 Class
25  Foam::syringePressureFvPatchScalarField
26 
27 Group
28  grpInletBoundaryConditions
29 
30 Description
31  This boundary condition provides a pressure condition, obtained from a
32  zero-D model of the cylinder of a syringe.
33 
34  The syringe cylinder is defined by its initial volume, piston area and
35  velocity profile specified by regions of constant acceleration, speed
36  and deceleration. The gas in the cylinder is described by its initial
37  pressure and compressibility which is assumed constant, i.e. isothermal
38  expansion/compression.
39 
40 Usage
41  \table
42  Property | Description | Required | Default value
43  Ap | syringe piston area [m2] | yes |
44  Sp | syringe piston speed [m/s] | yes |
45  VsI | initial syringe volume [m3] | yes |
46  tas | start of piston acceleration [s] | yes |
47  tae | end of piston acceleration [s] | yes |
48  tds | start of piston deceleration [s] | yes |
49  tde | end of piston deceleration [s] | yes |
50  psI | initial syringe pressure [Pa] | yes |
51  psi | gas compressibility [m2/s2] | yes |
52  ams | added (or removed) gas mass [kg] | yes |
53  \endtable
54 
55  Example of the BC specification:
56  \verbatim
57  <patchName>
58  {
59  type syringePressure;
60  Ap 1.388e-6;
61  Sp 0.01;
62  VsI 1.388e-8;
63  tas 0.001;
64  tae 0.002;
65  tds 0.005;
66  tde 0.006;
67  psI 1e5;
68  psi 1e-5;
69  ams 0;
70  value uniform 0;
71  }
72  \endverbatim
73 
74 See also
75  Foam::fixedValueFvPatchField
76 
77 SourceFiles
78  syringePressureFvPatchScalarField.C
79 
80 \*---------------------------------------------------------------------------*/
81 
82 #ifndef syringePressureFvPatchScalarField_H
83 #define syringePressureFvPatchScalarField_H
84 
86 
87 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88 
89 namespace Foam
90 {
91 
92 /*---------------------------------------------------------------------------*\
93  Class syringePressureFvPatchScalarField Declaration
94 \*---------------------------------------------------------------------------*/
95 
96 class syringePressureFvPatchScalarField
97 :
98  public fixedValueFvPatchScalarField
99 {
100  // Private data
101 
102  //- Syringe piston area
103  scalar Ap_;
104 
105  //- Syringe piston speed
106  scalar Sp_;
107 
108  //- Initial syringe volume
109  scalar VsI_;
110 
111  //- Start of piston acceleration
112  scalar tas_;
113 
114  //- End of piston acceleration
115  scalar tae_;
116 
117  //- Start of piston deceleration
118  scalar tds_;
119 
120  //- End of piston deceleration
121  scalar tde_;
122 
123  //- Initial syringe pressure
124  scalar psI_;
125 
126  //- Gas compressibility
127  scalar psi_;
128 
129  //- Added gas mass
130  scalar ams_;
131 
132  //- Added gas mass at previous time step
133  scalar ams0_;
134 
135  //- Name of the flux transporting the field
136  word phiName_;
137 
138  //- Current time index used to store ms0_
139  label curTimeIndex_;
140 
141 
142  // Private Functions
143 
144  //- Return the volume of the syringe at time t
145  scalar Vs(const scalar t) const;
146 
147 
148 public:
149 
150  //- Runtime type information
151  TypeName("syringePressure");
152 
153 
154  // Constructors
155 
156  //- Construct from patch and internal field
158  (
159  const fvPatch&,
161  );
162 
163  //- Construct from patch, internal field and dictionary
165  (
166  const fvPatch&,
168  const dictionary&
169  );
170 
171  //- Construct by mapping given syringePressureFvPatchScalarField
172  // onto a new patch
174  (
176  const fvPatch&,
178  const fvPatchFieldMapper&
179  );
180 
181  //- Construct and return a clone
182  virtual tmp<fvPatchScalarField> clone() const
183  {
185  (
187  );
188  }
189 
190  //- Construct as copy
192  (
194  );
195 
196  //- Construct as copy setting internal field reference
198  (
201  );
202 
203  //- Construct and return a clone setting internal field reference
205  (
207  ) const
208  {
210  (
211  new syringePressureFvPatchScalarField(*this, iF)
212  );
213  }
214 
215 
216  // Member functions
217 
218  // Evaluation functions
219 
220  //- Update the coefficients associated with the patch field
221  virtual void updateCoeffs();
222 
223 
224  //- Write
225  virtual void write(Ostream&) const;
226 };
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 } // End namespace Foam
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
237 // ************************************************************************* //
TypeName("syringePressure")
Runtime type information.
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
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
syringePressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
This boundary condition provides a pressure condition, obtained from a zero-D model of the cylinder o...
A class for managing temporary objects.
Definition: PtrList.H:54
Namespace for OpenFOAM.