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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::syringePressureFvPatchScalarField
28 
29 Group
30  grpInletBoundaryConditions
31 
32 Description
33  This boundary condition provides a pressure condition, obtained from a
34  zero-D model of the cylinder of a syringe.
35 
36  The syringe cylinder is defined by its initial volume, piston area and
37  velocity profile specified by regions of constant acceleration, speed
38  and deceleration. The gas in the cylinder is described by its initial
39  pressure and compressibility which is assumed constant, i.e. isothermal
40  expansion/compression.
41 
42 Usage
43  \table
44  Property | Description | Required | Default value
45  Ap | syringe piston area [m2] | yes |
46  Sp | syringe piston speed [m/s] | yes |
47  VsI | initial syringe volume [m3] | yes |
48  tas | start of piston acceleration [s] | yes |
49  tae | end of piston acceleration [s] | yes |
50  tds | start of piston deceleration [s] | yes |
51  tde | end of piston deceleration [s] | yes |
52  psI | initial syringe pressure [Pa] | yes |
53  psi | gas compressibility [m2/s2] | yes |
54  ams | added (or removed) gas mass [kg] | yes |
55  \endtable
56 
57  Example of the BC specification:
58  \verbatim
59  <patchName>
60  {
61  type syringePressure;
62  Ap 1.388e-6;
63  Sp 0.01;
64  VsI 1.388e-8;
65  tas 0.001;
66  tae 0.002;
67  tds 0.005;
68  tde 0.006;
69  psI 1e5;
70  psi 1e-5;
71  ams 0;
72  value uniform 0;
73  }
74  \endverbatim
75 
76 See also
77  Foam::fixedValueFvPatchField
78 
79 SourceFiles
80  syringePressureFvPatchScalarField.C
81 
82 \*---------------------------------------------------------------------------*/
83 
84 #ifndef syringePressureFvPatchScalarField_H
85 #define syringePressureFvPatchScalarField_H
86 
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 namespace Foam
92 {
93 
94 /*---------------------------------------------------------------------------*\
95  Class syringePressureFvPatchScalarField Declaration
96 \*---------------------------------------------------------------------------*/
97 
98 class syringePressureFvPatchScalarField
99 :
100  public fixedValueFvPatchScalarField
101 {
102  // Private data
103 
104  //- Syringe piston area
105  scalar Ap_;
106 
107  //- Syringe piston speed
108  scalar Sp_;
109 
110  //- Initial syringe volume
111  scalar VsI_;
112 
113  //- Start of piston acceleration
114  scalar tas_;
115 
116  //- End of piston acceleration
117  scalar tae_;
118 
119  //- Start of piston deceleration
120  scalar tds_;
121 
122  //- End of piston deceleration
123  scalar tde_;
124 
125  //- Initial syringe pressure
126  scalar psI_;
127 
128  //- Gas compressibility
129  scalar psi_;
130 
131  //- Added gas mass
132  scalar ams_;
133 
134  //- Added gas mass at previous time step
135  scalar ams0_;
136 
137  //- Name of the flux transporting the field
138  word phiName_;
139 
140  //- Current time index used to store ms0_
141  label curTimeIndex_;
142 
143 
144  // Private Functions
145 
146  //- Return the volume of the syringe at time t
147  scalar Vs(const scalar t) const;
149 
150 public:
151 
152  //- Runtime type information
153  TypeName("syringePressure");
154 
155 
156  // Constructors
157 
158  //- Construct from patch and internal field
160  (
161  const fvPatch&,
163  );
164 
165  //- Construct from patch, internal field and dictionary
167  (
168  const fvPatch&,
170  const dictionary&
171  );
172 
173  //- Construct by mapping given syringePressureFvPatchScalarField
174  // onto a new patch
176  (
178  const fvPatch&,
180  const fvPatchFieldMapper&
181  );
182 
183  //- Construct as copy
185  (
187  );
188 
189  //- Construct as copy setting internal field reference
191  (
194  );
195 
196  //- Return a clone
197  virtual tmp<fvPatchField<scalar>> clone() const
198  {
199  return fvPatchField<scalar>::Clone(*this);
200  }
201 
202  //- Clone with an internal field reference
204  (
206  ) const
207  {
208  return fvPatchField<scalar>::Clone(*this, iF);
209  }
210 
211 
212  // Member functions
213 
214  // Evaluation functions
215 
216  //- Update the coefficients associated with the patch field
217  virtual void updateCoeffs();
218 
219 
220  //- Write
221  virtual void write(Ostream&) const;
222 };
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #endif
232 
233 // ************************************************************************* //
TypeName("syringePressure")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
A FieldMapper for finite-volume patch fields.
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: HashPtrTable.H:50
Namespace for OpenFOAM.