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

PatchInjection.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) 2009-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::PatchInjection
00027 
00028 Description
00029     Patch injection
00030 
00031     - User specifies
00032       - Total mass to inject
00033       - Name of patch
00034       - Injection duration
00035       - Initial parcel velocity
00036       - Injection volume flow rate
00037     - Parcel diameters obtained by PDF model
00038     - Parcels injected at cell centres adjacent to patch
00039 
00040 SourceFiles
00041     PatchInjection.C
00042 
00043 \*---------------------------------------------------------------------------*/
00044 
00045 #ifndef PatchInjection_H
00046 #define PatchInjection_H
00047 
00048 #include "InjectionModel.H"
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace Foam
00053 {
00054 
00055 template<class Type>
00056 class DataEntry;
00057 
00058 class pdf;
00059 
00060 /*---------------------------------------------------------------------------*\
00061                        Class PatchInjection Declaration
00062 \*---------------------------------------------------------------------------*/
00063 
00064 template<class CloudType>
00065 class PatchInjection
00066 :
00067     public InjectionModel<CloudType>
00068 {
00069     // Private data
00070 
00071         //- Name of patch
00072         const word patchName_;
00073 
00074         //- Injection duration [s]
00075         const scalar duration_;
00076 
00077         //- Number of parcels to introduce per second []
00078         const label parcelsPerSecond_;
00079 
00080         //- Initial parcel velocity [m/s]
00081         const vector U0_;
00082 
00083         //- Volume flow rate of parcels to introduce relative to SOI [m^3/s]
00084         const autoPtr<DataEntry<scalar> > volumeFlowRate_;
00085 
00086         //- Parcel size PDF model
00087         const autoPtr<pdf> parcelPDF_;
00088 
00089         //- Cell owners
00090         labelList cellOwners_;
00091 
00092         //- Fraction of injection controlled by this processor
00093         scalar fraction_;
00094 
00095 
00096 protected:
00097 
00098     // Protected member functions
00099 
00100         //- Number of parcels to introduce over the time step relative to SOI
00101         label parcelsToInject
00102         (
00103             const scalar time0,
00104             const scalar time1
00105         ) const;
00106 
00107         //- Volume of parcels to introduce over the time step relative to SOI
00108         scalar volumeToInject
00109         (
00110             const scalar time0,
00111             const scalar time1
00112         ) const;
00113 
00114 
00115 public:
00116 
00117     //- Runtime type information
00118     TypeName("PatchInjection");
00119 
00120 
00121     // Constructors
00122 
00123         //- Construct from dictionary
00124         PatchInjection
00125         (
00126             const dictionary& dict,
00127             CloudType& owner
00128         );
00129 
00130 
00131     //- Destructor
00132     virtual ~PatchInjection();
00133 
00134 
00135     // Member Functions
00136 
00137         //- Flag to indicate whether model activates injection model
00138         bool active() const;
00139 
00140         //- Return the end-of-injection time
00141         scalar timeEnd() const;
00142 
00143 
00144         // Injection geometry
00145 
00146             //- Set the injection position and owner cell
00147             virtual void setPositionAndCell
00148             (
00149                 const label parcelI,
00150                 const label nParcels,
00151                 const scalar time,
00152                 vector& position,
00153                 label& cellOwner
00154             );
00155 
00156             virtual void setProperties
00157             (
00158                 const label parcelI,
00159                 const label nParcels,
00160                 const scalar time,
00161                 typename CloudType::parcelType& parcel
00162             );
00163 
00164             //- Flag to identify whether model fully describes the parcel
00165             virtual bool fullyDescribed() const;
00166 
00167             //- Return flag to identify whether or not injection of parcelI is
00168             //  permitted
00169             virtual bool validInjection(const label parcelI);
00170 };
00171 
00172 
00173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00174 
00175 } // End namespace Foam
00176 
00177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00178 
00179 #ifdef NoRepository
00180 #   include "PatchInjection.C"
00181 #endif
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 #endif
00186 
00187 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd