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