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;
148 
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 and return a clone
184  virtual tmp<fvPatchScalarField> clone() const
185  {
187  (
189  );
190  }
191 
192  //- Construct as copy
194  (
196  );
197 
198  //- Construct as copy setting internal field reference
200  (
203  );
204 
205  //- Construct and return a clone setting internal field reference
207  (
209  ) const
210  {
212  (
213  new syringePressureFvPatchScalarField(*this, iF)
214  );
215  }
216 
217 
218  // Member functions
219 
220  // Evaluation functions
221 
222  //- Update the coefficients associated with the patch field
223  virtual void updateCoeffs();
224 
225 
226  //- Write
227  virtual void write(Ostream&) const;
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #endif
238 
239 // ************************************************************************* //
Foam::syringePressureFvPatchScalarField
This boundary condition provides a pressure condition, obtained from a zero-D model of the cylinder o...
Definition: syringePressureFvPatchScalarField.H:152
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::syringePressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: syringePressureFvPatchScalarField.C:235
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
syringePressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: syringePressureFvPatchScalarField.C:38
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::syringePressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: syringePressureFvPatchScalarField.C:187
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fixedValueFvPatchFields.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::syringePressureFvPatchScalarField::TypeName
TypeName("syringePressure")
Runtime type information.
Foam::syringePressureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: syringePressureFvPatchScalarField.H:238
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54