OpenFOAM logo
Open Source CFD Toolkit

syringePressureFvPatchScalarField.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     syringePressureFvPatchScalarField
00027 
00028 Description
00029     Pressure boundary condition obtained from a 0-D model of the cylinder
00030     of a syringe.  The syringe cylinder is defined by it's initial volume,
00031     piston area and velocity profile specified by regions of constant
00032     acceleration, speed and deceleration.  The gas in the cylinder is
00033     described by it's initial pressure and compressibility which is
00034     assumed constant, i.e. isothermal expansion/compression.
00035 
00036     Example of the BC specification:
00037 
00038     outlet
00039     {
00040         type            syringePressure;
00041         Ap              1.388e-6; // syringe piston area
00042         Sp              0.01;     // syringe piston speed
00043         VsI             1.388e-8; // Initial syringe volume
00044         tas             0.001;    // Start of piston acceleration
00045         tae             0.002;    // End of piston acceleration
00046         tds             0.005;    // Start of piston deceleration
00047         tde             0.006;    // end of piston deceleration
00048         psI             1e5;      // Initial syringe pressure
00049         psi             1e-5;     // Gas compressibility
00050         ams             0;        // Added (or removed) gas mass 
00051                                   // Initially 0 but used for restarting.
00052     }
00053 
00054 SourceFiles
00055     syringePressureFvPatchScalarField.C
00056 
00057 \*---------------------------------------------------------------------------*/
00058 
00059 #ifndef syringePressureFvPatchScalarField_H
00060 #define syringePressureFvPatchScalarField_H
00061 
00062 #include "fixedValueFvPatchFields.H"
00063 
00064 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00065 
00066 namespace Foam
00067 {
00068 
00069 /*---------------------------------------------------------------------------*\
00070                            Class syringePressureFvPatch Declaration
00071 \*---------------------------------------------------------------------------*/
00072 
00073 class syringePressureFvPatchScalarField
00074 :
00075     public fixedValueFvPatchScalarField
00076 {
00077     // Private data
00078 
00079         //- syringe piston area
00080         scalar Ap_;
00081 
00082         //- syringe piston speed
00083         scalar Sp_;
00084 
00085         //- Initial syringe volume
00086         scalar VsI_;
00087 
00088         //- Start of piston acceleration
00089         scalar tas_;
00090 
00091         //- End of piston acceleration
00092         scalar tae_;
00093 
00094         //- Start of piston deceleration
00095         scalar tds_;
00096 
00097         //- end of piston deceleration
00098         scalar tde_;
00099 
00100         //- Initial syringe pressure
00101         scalar psI_;
00102 
00103         //- Gas compressibility
00104         scalar psi_;
00105 
00106         //- Added gas mass
00107         scalar ams_;
00108 
00109         //- Added gas mass at previous time step
00110         scalar ams0_;
00111 
00112         //- Current time index used to store ms0_
00113         label curTimeIndex_;
00114 
00115 
00116         //- return the volume of the syringe at time t
00117         scalar Vs(const scalar t) const;
00118 
00119 
00120 public:
00121 
00122     //- Runtime type information
00123     TypeName("syringePressure");
00124 
00125 
00126     // Constructors
00127 
00128         //- Construct from patch and internal field
00129         syringePressureFvPatchScalarField
00130         (
00131             const fvPatch&,
00132             const scalarField&
00133         );
00134 
00135         //- Construct from patch, internal field and dictionary
00136         syringePressureFvPatchScalarField
00137         (
00138             const fvPatch&,
00139             const scalarField&,
00140             const dictionary&
00141         );
00142 
00143         //- Construct by mapping given syringePressureFvPatchScalarField
00144         //  onto a new patch
00145         syringePressureFvPatchScalarField
00146         (
00147             const syringePressureFvPatchScalarField&,
00148             const fvPatch&,
00149             const scalarField&,
00150             const fvPatchFieldMapper&
00151         );
00152 
00153         //- Construct and return a clone
00154         virtual tmp<fvPatchScalarField> clone() const
00155         {
00156             return tmp<fvPatchScalarField>
00157             (
00158                 new syringePressureFvPatchScalarField(*this)
00159             );
00160         }
00161 
00162         //- Construct as copy setting internal field reference
00163         syringePressureFvPatchScalarField
00164         (
00165             const syringePressureFvPatchScalarField&,
00166             const scalarField&
00167         );
00168 
00169         //- Construct and return a clone setting internal field reference
00170         virtual tmp<fvPatchScalarField> clone(const scalarField& iF) const
00171         {
00172             return tmp<fvPatchScalarField>
00173             (
00174                 new syringePressureFvPatchScalarField(*this, iF)
00175             );
00176         }
00177 
00178 
00179     // Member functions
00180 
00181         // Evaluation functions
00182 
00183             //- Update the coefficients associated with the patch field
00184             virtual void updateCoeffs();
00185 
00186 
00187         //- Write
00188         virtual void write(Ostream&) const;
00189 };
00190 
00191 
00192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00193 
00194 } // End namespace Foam
00195 
00196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00197 
00198 #endif
00199 
00200 // ************************************************************************* //
For further information go to www.openfoam.org