1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::syringePressureFvPatchScalarField
29 Pressure boundary condition obtained from a 0-D model of the cylinder
32 The syringe cylinder is defined by its initial volume, piston area and
33 velocity profile specified by regions of constant acceleration, speed
34 and deceleration. The gas in the cylinder is described by its initial
35 pressure and compressibility which is assumed constant, i.e. isothermal
36 expansion/compression.
38 Example of the BC specification:
43 Ap 1.388e-6; // syringe piston area
44 Sp 0.01; // syringe piston speed
45 VsI 1.388e-8; // Initial syringe volume
46 tas 0.001; // Start of piston acceleration
47 tae 0.002; // End of piston acceleration
48 tds 0.005; // Start of piston deceleration
49 tde 0.006; // end of piston deceleration
50 psI 1e5; // Initial syringe pressure
51 psi 1e-5; // Gas compressibility
52 ams 0; // Added (or removed) gas mass
53 // Initially 0 but used for restarting.
58 syringePressureFvPatchScalarField.C
60 \*---------------------------------------------------------------------------*/
62 #ifndef syringePressureFvPatchScalarField_H
63 #define syringePressureFvPatchScalarField_H
65 #include "fixedValueFvPatchFields.H"
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 /*---------------------------------------------------------------------------*\
73 Class syringePressureFvPatch Declaration
74 \*---------------------------------------------------------------------------*/
76 class syringePressureFvPatchScalarField
78 public fixedValueFvPatchScalarField
82 //- syringe piston area
85 //- syringe piston speed
88 //- Initial syringe volume
91 //- Start of piston acceleration
94 //- End of piston acceleration
97 //- Start of piston deceleration
100 //- end of piston deceleration
103 //- Initial syringe pressure
106 //- Gas compressibility
112 //- Added gas mass at previous time step
115 //- Current time index used to store ms0_
119 //- return the volume of the syringe at time t
120 scalar Vs(const scalar t) const;
125 //- Runtime type information
126 TypeName("syringePressure");
131 //- Construct from patch and internal field
132 syringePressureFvPatchScalarField
135 const DimensionedField<scalar, volMesh>&
138 //- Construct from patch, internal field and dictionary
139 syringePressureFvPatchScalarField
142 const DimensionedField<scalar, volMesh>&,
146 //- Construct by mapping given syringePressureFvPatchScalarField
148 syringePressureFvPatchScalarField
150 const syringePressureFvPatchScalarField&,
152 const DimensionedField<scalar, volMesh>&,
153 const fvPatchFieldMapper&
156 //- Construct and return a clone
157 virtual tmp<fvPatchScalarField> clone() const
159 return tmp<fvPatchScalarField>
161 new syringePressureFvPatchScalarField(*this)
165 //- Construct as copy
166 syringePressureFvPatchScalarField
168 const syringePressureFvPatchScalarField&
171 //- Construct as copy setting internal field reference
172 syringePressureFvPatchScalarField
174 const syringePressureFvPatchScalarField&,
175 const DimensionedField<scalar, volMesh>&
178 //- Construct and return a clone setting internal field reference
179 virtual tmp<fvPatchScalarField> clone
181 const DimensionedField<scalar, volMesh>& iF
184 return tmp<fvPatchScalarField>
186 new syringePressureFvPatchScalarField(*this, iF)
193 // Evaluation functions
195 //- Update the coefficients associated with the patch field
196 virtual void updateCoeffs();
200 virtual void write(Ostream&) const;
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 } // End namespace Foam
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 // ************************************************************************* //