diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelInjectionModels.H b/src/lagrangian/intermediate/parcels/include/makeParcelInjectionModels.H index b673d3d84cc2fd75ef476b54ed41866d6ea25f59..e235a96aaae36e086a5e49d858f00171ef29e911 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelInjectionModels.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelInjectionModels.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,7 +31,6 @@ License #include "KinematicCloud.H" #include "ConeInjection.H" -#include "ConeInjectionMP.H" #include "FieldActivatedInjection.H" #include "InflationInjection.H" #include "KinematicLookupTableInjection.H" @@ -53,12 +52,6 @@ License ParcelType \ ); \ makeInjectionModelType \ - ( \ - ConeInjectionMP, \ - KinematicCloud, \ - ParcelType \ - ); \ - makeInjectionModelType \ ( \ FieldActivatedInjection, \ KinematicCloud, \ diff --git a/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelInjectionModels.H b/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelInjectionModels.H index 6bdc55f3bc47d318d2e7ef46bfece13d9659b9e7..b0042f5e44f52235234d3700166ebb7eab418de8 100644 --- a/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelInjectionModels.H +++ b/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelInjectionModels.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,7 +32,6 @@ License #include "KinematicCloud.H" #include "ConeInjection.H" -#include "ConeInjectionMP.H" #include "FieldActivatedInjection.H" #include "ManualInjection.H" #include "NoInjection.H" @@ -52,12 +51,6 @@ License ParcelType \ ); \ makeInjectionModelType \ - ( \ - ConeInjectionMP, \ - KinematicCloud, \ - ParcelType \ - ); \ - makeInjectionModelType \ ( \ FieldActivatedInjection, \ KinematicCloud, \ diff --git a/src/lagrangian/intermediate/parcels/include/makeReactingParcelInjectionModels.H b/src/lagrangian/intermediate/parcels/include/makeReactingParcelInjectionModels.H index c68403914c467e665b44a92db92b37f81c69c80f..88ff47a40ce17f9aab33c825990ea3e123cbf4f4 100644 --- a/src/lagrangian/intermediate/parcels/include/makeReactingParcelInjectionModels.H +++ b/src/lagrangian/intermediate/parcels/include/makeReactingParcelInjectionModels.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,7 +31,6 @@ License #include "KinematicCloud.H" #include "ConeInjection.H" -#include "ConeInjectionMP.H" #include "FieldActivatedInjection.H" #include "ManualInjection.H" #include "NoInjection.H" @@ -51,12 +50,6 @@ License ParcelType \ ); \ makeInjectionModelType \ - ( \ - ConeInjectionMP, \ - KinematicCloud, \ - ParcelType \ - ); \ - makeInjectionModelType \ ( \ FieldActivatedInjection, \ KinematicCloud, \ diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C index 711c41e87b24ba692137e2aaf311779ea486119c..439989e88b10d3b609cac2aeeb1bb1efb0add0db 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,16 @@ Foam::label Foam::ConeInjection<CloudType>::parcelsToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return round((time1 - time0)*parcelsPerSecond_); + const scalar targetVolume = flowRateProfile_().integrate(0, time1); + + const label targetParcels = + parcelsPerInjector_*targetVolume/this->volumeTotal_; + + const label nToInject = targetParcels - nInjected_; + + nInjected_ += nToInject; + + return positionAxis_.size()*nToInject; } else { @@ -78,15 +87,14 @@ Foam::ConeInjection<CloudType>::ConeInjection ) : InjectionModel<CloudType>(dict, owner, typeName), + positionAxis_(this->coeffDict().lookup("positionAxis")), + injectorCells_(positionAxis_.size()), + injectorTetFaces_(positionAxis_.size()), + injectorTetPts_(positionAxis_.size()), duration_(readScalar(this->coeffDict().lookup("duration"))), - position_(this->coeffDict().lookup("position")), - injectorCell_(-1), - injectorTetFace_(-1), - injectorTetPt_(-1), - direction_(this->coeffDict().lookup("direction")), - parcelsPerSecond_ + parcelsPerInjector_ ( - readScalar(this->coeffDict().lookup("parcelsPerSecond")) + readScalar(this->coeffDict().lookup("parcelsPerInjector")) ), flowRateProfile_ ( @@ -102,39 +110,48 @@ Foam::ConeInjection<CloudType>::ConeInjection this->coeffDict().subDict("sizeDistribution"), owner.rndGen() ) ), - tanVec1_(vector::zero), - tanVec2_(vector::zero) + nInjected_(this->parcelsAddedTotal()), + tanVec1_(positionAxis_.size()), + tanVec2_(positionAxis_.size()) { - // Normalise direction vector - direction_ /= mag(direction_); + // Normalise direction vector and determine direction vectors + // tangential to injector axis direction + forAll(positionAxis_, i) + { + vector& axis = positionAxis_[i].second(); - // Determine direction vectors tangential to direction - vector tangent = vector::zero; - scalar magTangent = 0.0; + axis /= mag(axis); - cachedRandom& rnd = this->owner().rndGen(); - while (magTangent < SMALL) - { - vector v = rnd.sample01<vector>(); + vector tangent = vector::zero; + scalar magTangent = 0.0; - tangent = v - (v & direction_)*direction_; - magTangent = mag(tangent); - } + cachedRandom& rnd = this->owner().rndGen(); + while (magTangent < SMALL) + { + vector v = rnd.sample01<vector>(); + + tangent = v - (v & axis)*axis; + magTangent = mag(tangent); + } - tanVec1_ = tangent/magTangent; - tanVec2_ = direction_^tanVec1_; + tanVec1_[i] = tangent/magTangent; + tanVec2_[i] = axis^tanVec1_[i]; + } // Set total volume to inject this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_); - // Set/cache the injector cell - this->findCellAtPosition - ( - injectorCell_, - injectorTetFace_, - injectorTetPt_, - position_ - ); + // Set/cache the injector cells + forAll(positionAxis_, i) + { + this->findCellAtPosition + ( + injectorCells_[i], + injectorTetFaces_[i], + injectorTetPts_[i], + positionAxis_[i].first() + ); + } } @@ -145,18 +162,18 @@ Foam::ConeInjection<CloudType>::ConeInjection ) : InjectionModel<CloudType>(im), + positionAxis_(im.positionAxis_), + injectorCells_(im.injectorCells_), + injectorTetFaces_(im.injectorTetFaces_), + injectorTetPts_(im.injectorTetPts_), duration_(im.duration_), - position_(im.position_), - injectorCell_(im.injectorCell_), - injectorTetFace_(im.injectorTetFace_), - injectorTetPt_(im.injectorTetPt_), - direction_(im.direction_), - parcelsPerSecond_(im.parcelsPerSecond_), + parcelsPerInjector_(im.parcelsPerInjector_), flowRateProfile_(im.flowRateProfile_().clone().ptr()), Umag_(im.Umag_().clone().ptr()), thetaInner_(im.thetaInner_().clone().ptr()), thetaOuter_(im.thetaOuter_().clone().ptr()), sizeDistribution_(im.sizeDistribution_().clone().ptr()), + nInjected_(im.nInjected_), tanVec1_(im.tanVec1_), tanVec2_(im.tanVec2_) {} @@ -181,7 +198,7 @@ Foam::scalar Foam::ConeInjection<CloudType>::timeEnd() const template<class CloudType> void Foam::ConeInjection<CloudType>::setPositionAndCell ( - const label, + const label parcelI, const label, const scalar, vector& position, @@ -190,17 +207,19 @@ void Foam::ConeInjection<CloudType>::setPositionAndCell label& tetPtI ) { - position = position_; - cellOwner = injectorCell_; - tetFaceI = injectorTetFace_; - tetPtI = injectorTetPt_; + const label i = parcelI % positionAxis_.size(); + + position = positionAxis_[i].first(); + cellOwner = injectorCells_[i]; + tetFaceI = injectorTetFaces_[i]; + tetPtI = injectorTetPts_[i]; } template<class CloudType> void Foam::ConeInjection<CloudType>::setProperties ( - const label, + const label parcelI, const label, const scalar time, typename CloudType::parcelType& parcel @@ -208,6 +227,9 @@ void Foam::ConeInjection<CloudType>::setProperties { cachedRandom& rnd = this->owner().rndGen(); + // set particle velocity + const label i = parcelI % positionAxis_.size(); + scalar t = time - this->SOI_; scalar ti = thetaInner_().value(t); scalar to = thetaOuter_().value(t); @@ -217,8 +239,8 @@ void Foam::ConeInjection<CloudType>::setProperties scalar dcorr = cos(coneAngle); scalar beta = twoPi*rnd.sample01<scalar>(); - vector normal = alpha*(tanVec1_*cos(beta) + tanVec2_*sin(beta)); - vector dirVec = dcorr*direction_; + vector normal = alpha*(tanVec1_[i]*cos(beta) + tanVec2_[i]*sin(beta)); + vector dirVec = dcorr*positionAxis_[i].second(); dirVec += normal; dirVec /= mag(dirVec); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H index 140010870097d65624391c875bd177d84b12e755..c76fcf11b9932b3602c4e46a97f6606b4c1b888e 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,13 +25,12 @@ Class Foam::ConeInjection Description - Cone injection + Multi-point cone injection model - User specifies - time of start of injection - - injector position - - direction (along injection axis) - - parcel flow rate - - parcel velocity + - list of injector positions and directions (along injection axes) + - number of parcels to inject per injector + - parcel velocities - inner and outer cone angles - Parcel diameters obtained by distribution model model @@ -45,6 +44,7 @@ SourceFiles #include "InjectionModel.H" #include "distributionModel.H" +#include "vectorList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -67,26 +67,23 @@ class ConeInjection { // Private data - //- Injection duration [s] - const scalar duration_; - - //- Injector position [m] - vector position_; + //- List of position and axis for each injector + List<Tuple2<vector, vector> > positionAxis_; - //- Cell containing injector position [] - label injectorCell_; + //- List of cell labels corresponding to injector positions + labelList injectorCells_; - //- tetFace of tet containing injector position [] - label injectorTetFace_; + //- List of tetFace labels corresponding to injector positions + labelList injectorTetFaces_; - //- tetPt of tet containing injector position [] - label injectorTetPt_; + //- List of tetPt labels corresponding to injector positions + labelList injectorTetPts_; - //- Injector direction [] - vector direction_; + //- Injection duration [s] + const scalar duration_; - //- Number of parcels to introduce per second [] - const label parcelsPerSecond_; + //- Number of parcels to introduce per injector + const label parcelsPerInjector_; //- Flow rate profile relative to SOI [] const autoPtr<DataEntry<scalar> > flowRateProfile_; @@ -103,14 +100,17 @@ class ConeInjection //- Parcel size distribution model model const autoPtr<distributionModels::distributionModel> sizeDistribution_; + //- Number of parcels per injector already injected + mutable label nInjected_; + // Tangential vectors to the direction vector //- First tangential vector - vector tanVec1_; + vectorList tanVec1_; //- Second tangential vector - vector tanVec2_; + vectorList tanVec2_; protected: diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C deleted file mode 100644 index a7645b0bc2b0305240f3e4cc8ae872ef11bdd859..0000000000000000000000000000000000000000 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C +++ /dev/null @@ -1,292 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. - \\/ 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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "ConeInjectionMP.H" -#include "DataEntry.H" -#include "mathematicalConstants.H" -#include "unitConversion.H" - -using namespace Foam::constant::mathematical; - -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template<class CloudType> -Foam::label Foam::ConeInjectionMP<CloudType>::parcelsToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((time0 >= 0.0) && (time0 < duration_)) - { - const scalar targetVolume = flowRateProfile_().integrate(0, time1); - - const label targetParcels = - parcelsPerInjector_*targetVolume/this->volumeTotal_; - - const label nToInject = targetParcels - nInjected_; - - nInjected_ += nToInject; - - return positions_.size()*nToInject; - } - else - { - return 0; - } -} - - -template<class CloudType> -Foam::scalar Foam::ConeInjectionMP<CloudType>::volumeToInject -( - const scalar time0, - const scalar time1 -) -{ - if ((time0 >= 0.0) && (time0 < duration_)) - { - return flowRateProfile_().integrate(time0, time1); - } - else - { - return 0.0; - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class CloudType> -Foam::ConeInjectionMP<CloudType>::ConeInjectionMP -( - const dictionary& dict, - CloudType& owner -) -: - InjectionModel<CloudType>(dict, owner, typeName), - positionsFile_(this->coeffDict().lookup("positionsFile")), - positions_ - ( - IOobject - ( - positionsFile_, - owner.db().time().constant(), - owner.mesh(), - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ), - injectorCells_(positions_.size()), - injectorTetFaces_(positions_.size()), - injectorTetPts_(positions_.size()), - axesFile_(this->coeffDict().lookup("axesFile")), - axes_ - ( - IOobject - ( - axesFile_, - owner.db().time().constant(), - owner.mesh(), - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ), - duration_(readScalar(this->coeffDict().lookup("duration"))), - parcelsPerInjector_ - ( - readScalar(this->coeffDict().lookup("parcelsPerInjector")) - ), - flowRateProfile_ - ( - DataEntry<scalar>::New("flowRateProfile", this->coeffDict()) - ), - Umag_(DataEntry<scalar>::New("Umag", this->coeffDict())), - thetaInner_(DataEntry<scalar>::New("thetaInner", this->coeffDict())), - thetaOuter_(DataEntry<scalar>::New("thetaOuter", this->coeffDict())), - sizeDistribution_ - ( - distributionModels::distributionModel::New - ( - this->coeffDict().subDict("sizeDistribution"), owner.rndGen() - ) - ), - nInjected_(this->parcelsAddedTotal()), - tanVec1_(positions_.size()), - tanVec2_(positions_.size()) -{ - // Normalise direction vector and determine direction vectors - // tangential to direction - forAll(axes_, i) - { - axes_[i] /= mag(axes_[i]); - - vector tangent = vector::zero; - scalar magTangent = 0.0; - - cachedRandom& rnd = this->owner().rndGen(); - while (magTangent < SMALL) - { - vector v = rnd.sample01<vector>(); - - tangent = v - (v & axes_[i])*axes_[i]; - magTangent = mag(tangent); - } - - tanVec1_[i] = tangent/magTangent; - tanVec2_[i] = axes_[i]^tanVec1_[i]; - } - - // Set total volume to inject - this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_); - - // Set/cache the injector cells - forAll(positions_, i) - { - this->findCellAtPosition - ( - injectorCells_[i], - injectorTetFaces_[i], - injectorTetPts_[i], - positions_[i] - ); - } -} - - -template<class CloudType> -Foam::ConeInjectionMP<CloudType>::ConeInjectionMP -( - const ConeInjectionMP<CloudType>& im -) -: - InjectionModel<CloudType>(im), - positionsFile_(im.positionsFile_), - positions_(im.positions_), - injectorCells_(im.injectorCells_), - injectorTetFaces_(im.injectorTetFaces_), - injectorTetPts_(im.injectorTetPts_), - axesFile_(im.axesFile_), - axes_(im.axes_), - duration_(im.duration_), - parcelsPerInjector_(im.parcelsPerInjector_), - flowRateProfile_(im.flowRateProfile_().clone().ptr()), - Umag_(im.Umag_().clone().ptr()), - thetaInner_(im.thetaInner_().clone().ptr()), - thetaOuter_(im.thetaOuter_().clone().ptr()), - sizeDistribution_(im.sizeDistribution_().clone().ptr()), - nInjected_(im.nInjected_), - tanVec1_(im.tanVec1_), - tanVec2_(im.tanVec2_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class CloudType> -Foam::ConeInjectionMP<CloudType>::~ConeInjectionMP() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class CloudType> -Foam::scalar Foam::ConeInjectionMP<CloudType>::timeEnd() const -{ - return this->SOI_ + duration_; -} - - -template<class CloudType> -void Foam::ConeInjectionMP<CloudType>::setPositionAndCell -( - const label parcelI, - const label, - const scalar, - vector& position, - label& cellOwner, - label& tetFaceI, - label& tetPtI -) -{ - const label i = parcelI % positions_.size(); - - position = positions_[i]; - cellOwner = injectorCells_[i]; - tetFaceI = injectorTetFaces_[i]; - tetPtI = injectorTetPts_[i]; -} - - -template<class CloudType> -void Foam::ConeInjectionMP<CloudType>::setProperties -( - const label parcelI, - const label, - const scalar time, - typename CloudType::parcelType& parcel -) -{ - cachedRandom& rnd = this->owner().rndGen(); - - // set particle velocity - const label i = parcelI%positions_.size(); - - scalar t = time - this->SOI_; - scalar ti = thetaInner_().value(t); - scalar to = thetaOuter_().value(t); - scalar coneAngle = degToRad(rnd.position<scalar>(ti, to)); - - scalar alpha = sin(coneAngle); - scalar dcorr = cos(coneAngle); - scalar beta = twoPi*rnd.sample01<scalar>(); - - vector normal = alpha*(tanVec1_[i]*cos(beta) + tanVec2_[i]*sin(beta)); - vector dirVec = dcorr*axes_[i]; - dirVec += normal; - dirVec /= mag(dirVec); - - parcel.U() = Umag_().value(t)*dirVec; - - // set particle diameter - parcel.d() = sizeDistribution_().sample(); -} - - -template<class CloudType> -bool Foam::ConeInjectionMP<CloudType>::fullyDescribed() const -{ - return false; -} - - -template<class CloudType> -bool Foam::ConeInjectionMP<CloudType>::validInjection(const label) -{ - return true; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.H deleted file mode 100644 index 2707e9cbc66212a05162eb4e0249482f4e17b92a..0000000000000000000000000000000000000000 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.H +++ /dev/null @@ -1,217 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. - \\/ 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 <http://www.gnu.org/licenses/>. - -Class - Foam::ConeInjectionMP - -Description - Cone injection multi-point - - User specifies - - time of start of injection - - injector positions - - directions (along injection axes) - - parcel flow rate - - parcel velocities - - inner and outer cone angles - - Parcel diameters obtained by distribution model model - -SourceFiles - ConeInjectionMP.C - -\*---------------------------------------------------------------------------*/ - -#ifndef ConeInjectionMP_H -#define ConeInjectionMP_H - -#include "InjectionModel.H" -#include "distributionModel.H" -#include "vectorList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes - -template<class Type> -class DataEntry; - -/*---------------------------------------------------------------------------*\ - Class ConeInjectionMP Declaration -\*---------------------------------------------------------------------------*/ - -template<class CloudType> -class ConeInjectionMP -: - public InjectionModel<CloudType> -{ - // Private data - - //- Name of file containing positions data - const word positionsFile_; - - //- Field of injector positions - vectorIOField positions_; - - //- List of cell labels corresponding to injector positions - labelList injectorCells_; - - //- List of tetFace labels corresponding to injector positions - labelList injectorTetFaces_; - - //- List of tetPt labels corresponding to injector positions - labelList injectorTetPts_; - - //- Name of file containing axes data - const word axesFile_; - - //- Field of injector positions - vectorIOField axes_; - - //- Injection duration [s] - const scalar duration_; - - //- Number of parcels to introduce per injector - const label parcelsPerInjector_; - - //- Flow rate profile relative to SOI [] - const autoPtr<DataEntry<scalar> > flowRateProfile_; - - //- Parcel velocity magnitude relative to SOI [m/s] - const autoPtr<DataEntry<scalar> > Umag_; - - //- Inner cone angle relative to SOI [deg] - const autoPtr<DataEntry<scalar> > thetaInner_; - - //- Outer cone angle relative to SOI [deg] - const autoPtr<DataEntry<scalar> > thetaOuter_; - - //- Parcel size distribution model model - const autoPtr<distributionModels::distributionModel> sizeDistribution_; - - //- Number of parcels per injector already injected - mutable label nInjected_; - - - // Tangential vectors to the direction vector - - //- First tangential vector - vectorList tanVec1_; - - //- Second tangential vector - vectorList tanVec2_; - - -protected: - - // Protected Member Functions - - //- Number of parcels to introduce over the time step relative to SOI - virtual label parcelsToInject(const scalar time0, const scalar time1); - - //- Volume of parcels to introduce over the time step relative to SOI - virtual scalar volumeToInject(const scalar time0, const scalar time1); - - -public: - - //- Runtime type information - TypeName("ConeInjectionMP"); - - - // Constructors - - //- Construct from dictionary - ConeInjectionMP(const dictionary& dict, CloudType& owner); - - //- Construct copy - ConeInjectionMP(const ConeInjectionMP<CloudType>& im); - - //- Construct and return a clone - virtual autoPtr<InjectionModel<CloudType> > clone() const - { - return autoPtr<InjectionModel<CloudType> > - ( - new ConeInjectionMP<CloudType>(*this) - ); - } - - - //- Destructor - virtual ~ConeInjectionMP(); - - - // Member Functions - - //- Return the end-of-injection time - scalar timeEnd() const; - - - // Injection geometry - - //- Set the injection position and owner cell, tetFace and tetPt - virtual void setPositionAndCell - ( - const label parcelI, - const label nParcels, - const scalar time, - vector& position, - label& cellOwner, - label& tetFaceI, - label& tetPtI - ); - - //- Set the parcel properties - virtual void setProperties - ( - const label parcelI, - const label nParcels, - const scalar time, - typename CloudType::parcelType& parcel - ); - - //- Flag to identify whether model fully describes the parcel - virtual bool fullyDescribed() const; - - //- Return flag to identify whether or not injection of parcelI is - // permitted - virtual bool validInjection(const label parcelI); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "ConeInjectionMP.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C index 719393b252b4779edb29e66f1167b8e17e99dd38..77bcb857376e8b7abb3026ff3b03f5dc9d3d6205 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -72,32 +72,32 @@ Type Foam::fieldValues::cellSource::processValues { case opSum: { - result = sum(values); + result = gSum(values); break; } case opVolAverage: { - result = sum(values*V)/sum(V); + result = gSum(values*V)/gSum(V); break; } case opVolIntegrate: { - result = sum(values*V); + result = gSum(values*V); break; } case opWeightedAverage: { - result = sum(values*weightField)/sum(weightField); + result = gSum(values*weightField)/gSum(weightField); break; } case opMin: { - result = min(values); + result = gMin(values); break; } case opMax: { - result = max(values); + result = gMax(values); break; } default: @@ -128,10 +128,10 @@ bool Foam::fieldValues::cellSource::writeValues(const word& fieldName) combineFields(setFieldValues<scalar>(weightFieldName_)) ); + Type result = processValues(values, V, weightField); + if (Pstream::master()) { - Type result = processValues(values, V, weightField); - if (valueOutput_) { IOField<Type> diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C index d8ab9fac28f2fa127d44592af2baba9ba8d6f191..34ad992c0c8ae60e2c672fc9beab4170ddbb4ee9 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -91,32 +91,32 @@ Type Foam::fieldValues::faceSource::processValues { case opSum: { - result = sum(values); + result = gSum(values); break; } case opAreaAverage: { - result = sum(values*magSf)/sum(magSf); + result = gSum(values*magSf)/gSum(magSf); break; } case opAreaIntegrate: { - result = sum(values*magSf); + result = gSum(values*magSf); break; } case opWeightedAverage: { - result = sum(values*weightField)/sum(weightField); + result = gSum(values*weightField)/gSum(weightField); break; } case opMin: { - result = min(values); + result = gMin(values); break; } case opMax: { - result = max(values); + result = gMax(values); break; } default: @@ -158,11 +158,10 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) magSf = combineFields(magSf); weightField = combineFields(weightField); + Type result = processValues(values, magSf, weightField); if (Pstream::master()) { - Type result = processValues(values, magSf, weightField); - if (valueOutput_) { IOField<Type> diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Axes b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Axes deleted file mode 100644 index a254f7f2b43e4a23ef4723a46abf296886c63b22..0000000000000000000000000000000000000000 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Axes +++ /dev/null @@ -1,21 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class vectorField; - location "constant"; - object reactingCloud1Axes; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -( - (0 0 -1) - (0 0 -1) -) -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Positions b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Positions deleted file mode 100644 index af3a75c15bb8d9665765521b4e635a340edbc751..0000000000000000000000000000000000000000 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Positions +++ /dev/null @@ -1,21 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class vectorField; - location "constant"; - object reactingCloud1Positions; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -( - (0.3 0.35 1.45) - (0.6 0.35 1.45) -) -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties index ff99c3fba903835933e76540c29aa06ffdc2fcec..b17b2b0c558f93c7d5366b4f840ad9c2177857cc 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties @@ -120,8 +120,11 @@ subModels { SOI 0.000; duration 20.000; - positionsFile "reactingCloud1Positions"; - axesFile "reactingCloud1Axes"; + positionAxis + ( + (0.3 0.35 1.45) (0 0 -1) + (0.6 0.35 1.45) (0 0 -1) + ); massTotal 10; parcelsPerInjector 20000; parcelsPerSecond 500; diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/constant/reactingCloud1Axes b/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/constant/reactingCloud1Axes deleted file mode 100644 index d85dd70dbc25bffe9c4397f78f96a9c38c5edfcb..0000000000000000000000000000000000000000 --- a/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/constant/reactingCloud1Axes +++ /dev/null @@ -1,21 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class vectorField; - location "constant"; - object reactingCloud1Axes; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -( - (0 0 -1) - (0 0 -1) -) -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/constant/reactingCloud1Positions b/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/constant/reactingCloud1Positions deleted file mode 100644 index 79f7d3a454c41fc8dab38c5ce34a981a27923c9c..0000000000000000000000000000000000000000 --- a/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/constant/reactingCloud1Positions +++ /dev/null @@ -1,21 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class vectorField; - location "constant"; - object reactingCloud1Positions; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -( - (0.3 0.35 1.45) - (0.6 0.35 1.45) -) -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/constant/reactingCloud1Properties index 2b4877e8d15362c6c48c3407d9e32062a2ebf2cb..a7fd06ba49e115a18c41fc4bb30aa7b381d66289 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/constant/reactingCloud1Properties @@ -120,8 +120,11 @@ subModels { SOI 0.000; duration 20.000; - positionsFile "reactingCloud1Positions"; - axesFile "reactingCloud1Axes"; + positionAxis + ( + (0.3 0.35 1.45) (0 0 -1) + (0.6 0.35 1.45) (0 0 -1) + ); massTotal 10; parcelsPerInjector 20000; parcelsPerSecond 500;