OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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