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