diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.C new file mode 100644 index 0000000000..072addac22 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.C @@ -0,0 +1,207 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "InjectionModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::InjectionModelList::InjectionModelList(CloudType& owner) +: + PtrList >() +{} + + +template +Foam::InjectionModelList::InjectionModelList +( + const dictionary& dict, + CloudType& owner +) +: + PtrList >() +{ + wordList modelNames(dict.toc()); + + Info<< "Constructing particle injection models" << endl; + + if (modelNames.size() > 0) + { + this->setSize(modelNames.size()); + + label i = 0; + forAllConstIter(IDLList, dict, iter) + { + const word& model = iter().keyword(); + Info<< "Creating injector: " << model << endl; + const dictionary& props = iter().dict(); + + this->set + ( + i++, + InjectionModel::New + ( + props, + model, + props.lookup("type"), + owner + ) + ); + } + } + else + { + this->setSize(1); + + this->set + ( + 0, + InjectionModel::New + ( + dict, + "none", + "none", + owner + ) + ); + } +} + + +template +Foam::InjectionModelList::InjectionModelList +( + const InjectionModelList& iml +) +: + PtrList >(iml) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::InjectionModelList::~InjectionModelList() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar Foam::InjectionModelList::timeStart() const +{ + scalar minTime = GREAT; + forAll(*this, i) + { + minTime = min(minTime, this->operator[](i).timeStart()); + } + + return minTime; +} + + +template +Foam::scalar Foam::InjectionModelList::timeEnd() const +{ + scalar maxTime = -GREAT; + forAll(*this, i) + { + maxTime = max(maxTime, this->operator[](i).timeEnd()); + } + + return maxTime; +} + + +template +Foam::scalar Foam::InjectionModelList::volumeToInject +( + const scalar time0, + const scalar time1 +) +{ + scalar vol = 0.0; + forAll(*this, i) + { + vol += this->operator[](i).volumeToInject(time0, time1); + } + + return vol; +} + + +template +Foam::scalar Foam::InjectionModelList::averageParcelMass() +{ + scalar mass = 0.0; + scalar massTotal = 0.0; + forAll(*this, i) + { + scalar mt = this->operator[](i).massTotal(); + mass += mt*this->operator[](i).averageParcelMass(); + massTotal += mt; + } + + return mass/massTotal; +} + + +template +template +void Foam::InjectionModelList::inject(TrackData& td) +{ + forAll(*this, i) + { + this->operator[](i).inject(td); + } +} + + +template +template +void Foam::InjectionModelList::injectSteadyState +( + TrackData& td, + const scalar trackTime +) +{ + forAll(*this, i) + { + this->operator[](i).injectSteadyState(td, trackTime); + } +} + + +template +void Foam::InjectionModelList::info(Ostream& os) +{ + forAll(*this, i) + { + this->operator[](i).info(os); + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.H new file mode 100644 index 0000000000..1d67801e7d --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.H @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::InjectionModelList + +Description + List of injection models + +SourceFiles + InjectionModelListList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef InjectionModelList_H +#define InjectionModelList_H + +#include "PtrList.H" +#include "InjectionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class InjectionModelList Declaration +\*---------------------------------------------------------------------------*/ + +template +class InjectionModelList +: + public PtrList > +{ +public: + + // Constructors + + //- Construct null from owner + InjectionModelList(CloudType& owner); + + //- Construct from dictionary and cloud owner + InjectionModelList(const dictionary& dict, CloudType& owner); + + //- Construct copy + InjectionModelList(const InjectionModelList& im); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new InjectionModelList(*this) + ); + } + + + //- Destructor + virtual ~InjectionModelList(); + + + + // Member Functions + + // Access + + //- Return the minimum start-of-injection time + scalar timeStart() const; + + //- Return the maximum end-of-injection time + scalar timeEnd() const; + + //- Volume of parcels to introduce relative to SOI + scalar volumeToInject(const scalar time0, const scalar time1); + + //- Return the average parcel mass + scalar averageParcelMass(); + + + // Per-injection event functions + + //- Main injection loop + template + void inject(TrackData& td); + + //- Main injection loop - steady-state + template + void injectSteadyState(TrackData& td, const scalar trackTime); + + + + // I-O + + //- Write injection info to stream + virtual void info(Ostream& os); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "InjectionModelList.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //