initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / derived / syringePressure / syringePressureFvPatchScalarField.H
blob73d11e59cf3be1854e152af676a9fff823079a9b
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::syringePressureFvPatchScalarField
28 Description
29     Pressure boundary condition obtained from a 0-D model of the cylinder
30     of a syringe.
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:
39     @verbatim
40         outlet
41         {
42             type            syringePressure;
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.
54         }
55     @endverbatim
57 SourceFiles
58     syringePressureFvPatchScalarField.C
60 \*---------------------------------------------------------------------------*/
62 #ifndef syringePressureFvPatchScalarField_H
63 #define syringePressureFvPatchScalarField_H
65 #include "fixedValueFvPatchFields.H"
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 namespace Foam
72 /*---------------------------------------------------------------------------*\
73                            Class syringePressureFvPatch Declaration
74 \*---------------------------------------------------------------------------*/
76 class syringePressureFvPatchScalarField
78     public fixedValueFvPatchScalarField
80     // Private data
82         //- syringe piston area
83         scalar Ap_;
85         //- syringe piston speed
86         scalar Sp_;
88         //- Initial syringe volume
89         scalar VsI_;
91         //- Start of piston acceleration
92         scalar tas_;
94         //- End of piston acceleration
95         scalar tae_;
97         //- Start of piston deceleration
98         scalar tds_;
100         //- end of piston deceleration
101         scalar tde_;
103         //- Initial syringe pressure
104         scalar psI_;
106         //- Gas compressibility
107         scalar psi_;
109         //- Added gas mass
110         scalar ams_;
112         //- Added gas mass at previous time step
113         scalar ams0_;
115         //- Current time index used to store ms0_
116         label curTimeIndex_;
119         //- return the volume of the syringe at time t
120         scalar Vs(const scalar t) const;
123 public:
125     //- Runtime type information
126     TypeName("syringePressure");
129     // Constructors
131         //- Construct from patch and internal field
132         syringePressureFvPatchScalarField
133         (
134             const fvPatch&,
135             const DimensionedField<scalar, volMesh>&
136         );
138         //- Construct from patch, internal field and dictionary
139         syringePressureFvPatchScalarField
140         (
141             const fvPatch&,
142             const DimensionedField<scalar, volMesh>&,
143             const dictionary&
144         );
146         //- Construct by mapping given syringePressureFvPatchScalarField
147         //  onto a new patch
148         syringePressureFvPatchScalarField
149         (
150             const syringePressureFvPatchScalarField&,
151             const fvPatch&,
152             const DimensionedField<scalar, volMesh>&,
153             const fvPatchFieldMapper&
154         );
156         //- Construct and return a clone
157         virtual tmp<fvPatchScalarField> clone() const
158         {
159             return tmp<fvPatchScalarField>
160             (
161                 new syringePressureFvPatchScalarField(*this)
162             );
163         }
165         //- Construct as copy
166         syringePressureFvPatchScalarField
167         (
168             const syringePressureFvPatchScalarField&
169         );
171         //- Construct as copy setting internal field reference
172         syringePressureFvPatchScalarField
173         (
174             const syringePressureFvPatchScalarField&,
175             const DimensionedField<scalar, volMesh>&
176         );
178         //- Construct and return a clone setting internal field reference
179         virtual tmp<fvPatchScalarField> clone
180         (
181             const DimensionedField<scalar, volMesh>& iF
182         ) const
183         {
184             return tmp<fvPatchScalarField>
185             (
186                 new syringePressureFvPatchScalarField(*this, iF)
187             );
188         }
191     // Member functions
193         // Evaluation functions
195             //- Update the coefficients associated with the patch field
196             virtual void updateCoeffs();
199         //- Write
200         virtual void write(Ostream&) const;
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 } // End namespace Foam
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 #endif
212 // ************************************************************************* //