1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
25 Foam::syringePressureFvPatchScalarField
28 Pressure boundary condition obtained from a 0-D model of the cylinder
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.
37 Example of the BC specification:
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.
57 syringePressureFvPatchScalarField.C
59 \*---------------------------------------------------------------------------*/
61 #ifndef syringePressureFvPatchScalarField_H
62 #define syringePressureFvPatchScalarField_H
64 #include "fixedValueFvPatchFields.H"
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71 /*---------------------------------------------------------------------------*\
72 Class syringePressureFvPatch Declaration
73 \*---------------------------------------------------------------------------*/
75 class syringePressureFvPatchScalarField
77 public fixedValueFvPatchScalarField
81 //- syringe piston area
84 //- syringe piston speed
87 //- Initial syringe volume
90 //- Start of piston acceleration
93 //- End of piston acceleration
96 //- Start of piston deceleration
99 //- end of piston deceleration
102 //- Initial syringe pressure
105 //- Gas compressibility
111 //- Added gas mass at previous time step
114 //- Current time index used to store ms0_
118 //- return the volume of the syringe at time t
119 scalar Vs(const scalar t) const;
124 //- Runtime type information
125 TypeName("syringePressure");
130 //- Construct from patch and internal field
131 syringePressureFvPatchScalarField
134 const DimensionedField<scalar, volMesh>&
137 //- Construct from patch, internal field and dictionary
138 syringePressureFvPatchScalarField
141 const DimensionedField<scalar, volMesh>&,
145 //- Construct by mapping given syringePressureFvPatchScalarField
147 syringePressureFvPatchScalarField
149 const syringePressureFvPatchScalarField&,
151 const DimensionedField<scalar, volMesh>&,
152 const fvPatchFieldMapper&
155 //- Construct and return a clone
156 virtual tmp<fvPatchScalarField> clone() const
158 return tmp<fvPatchScalarField>
160 new syringePressureFvPatchScalarField(*this)
164 //- Construct as copy
165 syringePressureFvPatchScalarField
167 const syringePressureFvPatchScalarField&
170 //- Construct as copy setting internal field reference
171 syringePressureFvPatchScalarField
173 const syringePressureFvPatchScalarField&,
174 const DimensionedField<scalar, volMesh>&
177 //- Construct and return a clone setting internal field reference
178 virtual tmp<fvPatchScalarField> clone
180 const DimensionedField<scalar, volMesh>& iF
183 return tmp<fvPatchScalarField>
185 new syringePressureFvPatchScalarField(*this, iF)
192 // Evaluation functions
194 //- Update the coefficients associated with the patch field
195 virtual void updateCoeffs();
199 virtual void write(Ostream&) const;
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 } // End namespace Foam
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 // ************************************************************************* //