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-2023 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 [m^2] | yes |
41  Sp | syringe piston speed [m/s] | yes |
42  VsI | initial syringe volume [m^3] | 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 [m^2/s^2] | 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, internal field and dictionary
155  (
156  const fvPatch&,
158  const dictionary&
159  );
160 
161  //- Construct by mapping given syringePressureFvPatchScalarField
162  // onto a new patch
164  (
166  const fvPatch&,
168  const fvPatchFieldMapper&
169  );
170 
171  //- Disallow copy without setting internal field reference
173  (
175  ) = delete;
176 
177  //- Copy constructor setting internal field reference
179  (
182  );
183 
184  //- Construct and return a clone setting internal field reference
186  (
188  ) const
189  {
191  (
192  new syringePressureFvPatchScalarField(*this, iF)
193  );
194  }
195 
196 
197  // Member Functions
198 
199  // Evaluation functions
200 
201  //- Update the coefficients associated with the patch field
202  virtual void updateCoeffs();
203 
204 
205  //- Write
206  virtual void write(Ostream&) const;
207 };
208 
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 } // End namespace Foam
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #endif
217 
218 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::fvPatchFieldMapper.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
This boundary condition provides a pressure condition, obtained from a zero-D model of the cylinder o...
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
syringePressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
TypeName("syringePressure")
Runtime type information.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
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