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

FieldActivatedInjection.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) 2008-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::FieldActivatedInjection
00027 
00028 Description
00029     Injection at specified positions, with the conditions:
00030 
00031     - for injection to be allowed
00032 
00033         factor*referenceField[cellI] >= thresholdField[cellI]
00034 
00035         where:
00036           - referenceField is the field used to supply the look-up values
00037           - thresholdField supplies the values beyond which the injection is
00038             permitted
00039 
00040     - limited to a user-supllied number of injections per injector location
00041 
00042 SourceFiles
00043     FieldActivatedInjection.C
00044 
00045 \*---------------------------------------------------------------------------*/
00046 
00047 #ifndef FieldActivatedInjection_H
00048 #define FieldActivatedInjection_H
00049 
00050 #include "InjectionModel.H"
00051 #include "pdf.H"
00052 #include "volFieldsFwd.H"
00053 
00054 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00055 
00056 namespace Foam
00057 {
00058 
00059 /*---------------------------------------------------------------------------*\
00060                     Class FieldActivatedInjection Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 template<class CloudType>
00064 class FieldActivatedInjection
00065 :
00066     public InjectionModel<CloudType>
00067 {
00068     // Private data
00069 
00070         // Model parameters
00071 
00072             //- Factor to apply to reference field
00073             const scalar factor_;
00074 
00075             //- Reference field
00076             const volScalarField& referenceField_;
00077 
00078             //- Threshold field
00079             const volScalarField& thresholdField_;
00080 
00081 
00082         // Injector properties
00083 
00084             //- Name of file containing positions data
00085             const word positionsFile_;
00086 
00087             //- Field of injector (x,y,z) positions
00088             vectorIOField positions_;
00089 
00090             //- Field of cell labels corresponding to injector positions
00091             labelList injectorCells_;
00092 
00093             //- Number of parcels per injector
00094             const label nParcelsPerInjector_;
00095 
00096             //- Field of number of parcels injected for each injector
00097             labelList nParcelsInjected_;
00098 
00099 
00100         // Parcel properties
00101 
00102             //- Initial parcel velocity
00103             const vector U0_;
00104 
00105             //- Field of parcel diameters
00106             scalarList diameters_;
00107 
00108             //- Parcel size PDF model
00109             const autoPtr<pdf> parcelPDF_;
00110 
00111 
00112 protected:
00113 
00114     // Protected member functions
00115 
00116         //- Number of parcels to introduce over the time step relative to SOI
00117         label parcelsToInject
00118         (
00119             const scalar time0,
00120             const scalar time1
00121         ) const;
00122 
00123         //- Volume of parcels to introduce over the time step relative to SOI
00124         scalar volumeToInject
00125         (
00126             const scalar time0,
00127             const scalar time1
00128         ) const;
00129 
00130 
00131 public:
00132 
00133     //- Runtime type information
00134     TypeName("FieldActivatedInjection");
00135 
00136 
00137     // Constructors
00138 
00139         //- Construct from dictionary
00140         FieldActivatedInjection
00141         (
00142             const dictionary& dict,
00143             CloudType& owner
00144         );
00145 
00146 
00147     // Destructor
00148     virtual ~FieldActivatedInjection();
00149 
00150 
00151     // Member Functions
00152 
00153         //- Flag to indicate whether model activates injection model
00154         bool active() const;
00155 
00156         //- Return the end-of-injection time
00157         scalar timeEnd() const;
00158 
00159 
00160         // Injection geometry
00161 
00162             //- Set the injection position and owner cell
00163             virtual void setPositionAndCell
00164             (
00165                 const label parcelI,
00166                 const label nParcels,
00167                 const scalar time,
00168                 vector& position,
00169                 label& cellOwner
00170             );
00171 
00172             //- Set the parcel properties
00173             virtual void setProperties
00174             (
00175                 const label parcelI,
00176                 const label nParcels,
00177                 const scalar time,
00178                 typename CloudType::parcelType& parcel
00179             );
00180 
00181             //- Flag to identify whether model fully describes the parcel
00182             virtual bool fullyDescribed() const;
00183 
00184             //- Return flag to identify whether or not injection of parcelI is
00185             //  permitted
00186             virtual bool validInjection(const label parcelI);
00187 };
00188 
00189 
00190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00191 
00192 } // End namespace Foam
00193 
00194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00195 
00196 #ifdef NoRepository
00197 #   include "FieldActivatedInjection.C"
00198 #endif
00199 
00200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00201 
00202 #endif
00203 
00204 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd