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

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