FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::syringePressureFvPatchScalarField
00026 
00027 Description
00028     Pressure boundary condition obtained from a 0-D model of the cylinder
00029     of a syringe.
00030 
00031     The syringe cylinder is defined by its initial volume, piston area and
00032     velocity profile specified by regions of constant acceleration, speed
00033     and deceleration.  The gas in the cylinder is described by its initial
00034     pressure and compressibility which is assumed constant, i.e. isothermal
00035     expansion/compression.
00036 
00037     Example of the BC specification:
00038     @verbatim
00039         outlet
00040         {
00041             type            syringePressure;
00042             Ap              1.388e-6; // syringe piston area
00043             Sp              0.01;     // syringe piston speed
00044             VsI             1.388e-8; // Initial syringe volume
00045             tas             0.001;    // Start of piston acceleration
00046             tae             0.002;    // End of piston acceleration
00047             tds             0.005;    // Start of piston deceleration
00048             tde             0.006;    // end of piston deceleration
00049             psI             1e5;      // Initial syringe pressure
00050             psi             1e-5;     // Gas compressibility
00051             ams             0;        // Added (or removed) gas mass
00052                                       // Initially 0 but used for restarting.
00053         }
00054     @endverbatim
00055 
00056 SourceFiles
00057     syringePressureFvPatchScalarField.C
00058 
00059 \*---------------------------------------------------------------------------*/
00060 
00061 #ifndef syringePressureFvPatchScalarField_H
00062 #define syringePressureFvPatchScalarField_H
00063 
00064 #include <finiteVolume/fixedValueFvPatchFields.H>
00065 
00066 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00067 
00068 namespace Foam
00069 {
00070 
00071 /*---------------------------------------------------------------------------*\
00072                            Class syringePressureFvPatch Declaration
00073 \*---------------------------------------------------------------------------*/
00074 
00075 class syringePressureFvPatchScalarField
00076 :
00077     public fixedValueFvPatchScalarField
00078 {
00079     // Private data
00080 
00081         //- syringe piston area
00082         scalar Ap_;
00083 
00084         //- syringe piston speed
00085         scalar Sp_;
00086 
00087         //- Initial syringe volume
00088         scalar VsI_;
00089 
00090         //- Start of piston acceleration
00091         scalar tas_;
00092 
00093         //- End of piston acceleration
00094         scalar tae_;
00095 
00096         //- Start of piston deceleration
00097         scalar tds_;
00098 
00099         //- end of piston deceleration
00100         scalar tde_;
00101 
00102         //- Initial syringe pressure
00103         scalar psI_;
00104 
00105         //- Gas compressibility
00106         scalar psi_;
00107 
00108         //- Added gas mass
00109         scalar ams_;
00110 
00111         //- Added gas mass at previous time step
00112         scalar ams0_;
00113 
00114         //- Current time index used to store ms0_
00115         label curTimeIndex_;
00116 
00117 
00118         //- return the volume of the syringe at time t
00119         scalar Vs(const scalar t) const;
00120 
00121 
00122 public:
00123 
00124     //- Runtime type information
00125     TypeName("syringePressure");
00126 
00127 
00128     // Constructors
00129 
00130         //- Construct from patch and internal field
00131         syringePressureFvPatchScalarField
00132         (
00133             const fvPatch&,
00134             const DimensionedField<scalar, volMesh>&
00135         );
00136 
00137         //- Construct from patch, internal field and dictionary
00138         syringePressureFvPatchScalarField
00139         (
00140             const fvPatch&,
00141             const DimensionedField<scalar, volMesh>&,
00142             const dictionary&
00143         );
00144 
00145         //- Construct by mapping given syringePressureFvPatchScalarField
00146         //  onto a new patch
00147         syringePressureFvPatchScalarField
00148         (
00149             const syringePressureFvPatchScalarField&,
00150             const fvPatch&,
00151             const DimensionedField<scalar, volMesh>&,
00152             const fvPatchFieldMapper&
00153         );
00154 
00155         //- Construct and return a clone
00156         virtual tmp<fvPatchScalarField> clone() const
00157         {
00158             return tmp<fvPatchScalarField>
00159             (
00160                 new syringePressureFvPatchScalarField(*this)
00161             );
00162         }
00163 
00164         //- Construct as copy
00165         syringePressureFvPatchScalarField
00166         (
00167             const syringePressureFvPatchScalarField&
00168         );
00169 
00170         //- Construct as copy setting internal field reference
00171         syringePressureFvPatchScalarField
00172         (
00173             const syringePressureFvPatchScalarField&,
00174             const DimensionedField<scalar, volMesh>&
00175         );
00176 
00177         //- Construct and return a clone setting internal field reference
00178         virtual tmp<fvPatchScalarField> clone
00179         (
00180             const DimensionedField<scalar, volMesh>& iF
00181         ) const
00182         {
00183             return tmp<fvPatchScalarField>
00184             (
00185                 new syringePressureFvPatchScalarField(*this, iF)
00186             );
00187         }
00188 
00189 
00190     // Member functions
00191 
00192         // Evaluation functions
00193 
00194             //- Update the coefficients associated with the patch field
00195             virtual void updateCoeffs();
00196 
00197 
00198         //- Write
00199         virtual void write(Ostream&) const;
00200 };
00201 
00202 
00203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00204 
00205 } // End namespace Foam
00206 
00207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00208 
00209 #endif
00210 
00211 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines