FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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  Pressure boundary condition obtained from a 0-D model of the cylinder
29  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  Example of the BC specification:
38  @verbatim
39  outlet
40  {
41  type syringePressure;
42  Ap 1.388e-6; // syringe piston area
43  Sp 0.01; // syringe piston speed
44  VsI 1.388e-8; // Initial syringe volume
45  tas 0.001; // Start of piston acceleration
46  tae 0.002; // End of piston acceleration
47  tds 0.005; // Start of piston deceleration
48  tde 0.006; // end of piston deceleration
49  psI 1e5; // Initial syringe pressure
50  psi 1e-5; // Gas compressibility
51  ams 0; // Added (or removed) gas mass
52  // Initially 0 but used for restarting.
53  }
54  @endverbatim
55 
56 SourceFiles
57  syringePressureFvPatchScalarField.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef syringePressureFvPatchScalarField_H
62 #define syringePressureFvPatchScalarField_H
63 
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 
71 /*---------------------------------------------------------------------------*\
72  Class syringePressureFvPatch Declaration
73 \*---------------------------------------------------------------------------*/
74 
76 :
77  public fixedValueFvPatchScalarField
78 {
79  // Private data
80 
81  //- syringe piston area
82  scalar Ap_;
83 
84  //- syringe piston speed
85  scalar Sp_;
86 
87  //- Initial syringe volume
88  scalar VsI_;
89 
90  //- Start of piston acceleration
91  scalar tas_;
92 
93  //- End of piston acceleration
94  scalar tae_;
95 
96  //- Start of piston deceleration
97  scalar tds_;
98 
99  //- end of piston deceleration
100  scalar tde_;
101 
102  //- Initial syringe pressure
103  scalar psI_;
104 
105  //- Gas compressibility
106  scalar psi_;
107 
108  //- Added gas mass
109  scalar ams_;
110 
111  //- Added gas mass at previous time step
112  scalar ams0_;
113 
114  //- Current time index used to store ms0_
115  label curTimeIndex_;
116 
117 
118  //- return the volume of the syringe at time t
119  scalar Vs(const scalar t) const;
120 
121 
122 public:
123 
124  //- Runtime type information
125  TypeName("syringePressure");
126 
127 
128  // Constructors
129 
130  //- Construct from patch and internal field
132  (
133  const fvPatch&,
135  );
136 
137  //- Construct from patch, internal field and dictionary
139  (
140  const fvPatch&,
142  const dictionary&
143  );
144 
145  //- Construct by mapping given syringePressureFvPatchScalarField
146  // onto a new patch
148  (
150  const fvPatch&,
152  const fvPatchFieldMapper&
153  );
154 
155  //- Construct and return a clone
157  {
159  (
161  );
162  }
163 
164  //- Construct as copy
166  (
168  );
169 
170  //- Construct as copy setting internal field reference
172  (
175  );
176 
177  //- Construct and return a clone setting internal field reference
179  (
181  ) const
182  {
184  (
185  new syringePressureFvPatchScalarField(*this, iF)
186  );
187  }
188 
189 
190  // Member functions
191 
192  // Evaluation functions
193 
194  //- Update the coefficients associated with the patch field
195  virtual void updateCoeffs();
196 
197 
198  //- Write
199  virtual void write(Ostream&) const;
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************ vim: set sw=4 sts=4 et: ************************ //