diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H index f235314642..718f595e14 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -274,6 +274,9 @@ public: //- Return mass of particles injected (cumulative) inline scalar massInjected() const; + //- Return injectorID + inline label injectorID() const; + //- Return the end-of-injection time virtual scalar timeEnd() const = 0; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelI.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelI.H index 06245309da..fd26db534b 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelI.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -55,6 +55,13 @@ Foam::scalar Foam::InjectionModel::massInjected() const } +template +Foam::label Foam::InjectionModel::injectorID() const +{ + return injectorID_; +} + + template Foam::label Foam::InjectionModel::nInjections() const { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C index 190e4a61ac..b5e7d162db 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,11 +36,13 @@ Foam::LocalInteraction::LocalInteraction : PatchInteractionModel(dict, cloud, typeName), patchData_(cloud.mesh(), this->coeffDict()), - nEscape_(patchData_.size(), 0), - massEscape_(patchData_.size(), 0.0), - nStick_(patchData_.size(), 0), - massStick_(patchData_.size(), 0.0), + nEscape_(patchData_.size()), + massEscape_(patchData_.size()), + nStick_(patchData_.size()), + massStick_(patchData_.size()), writeFields_(this->coeffDict().lookupOrDefault("writeFields", false)), + outputByInjectorId_(this->coeffDict().lookupOrDefault("outputByInjectorId", false)), + injIdToIndex_(cloud.injectors().size()), massEscapePtr_(nullptr), massStickPtr_(nullptr) { @@ -77,6 +79,21 @@ Foam::LocalInteraction::LocalInteraction << this->PatchInteractionModel::interactionTypeNames_ << nl << exit(FatalError); } + + label nInjectors(1); + if (outputByInjectorId_) + { + nInjectors = cloud.injectors().size(); + for (label i=0; i::LocalInteraction nStick_(pim.nStick_), massStick_(pim.massStick_), writeFields_(pim.writeFields_), + outputByInjectorId_(pim.outputByInjectorId_), + injIdToIndex_(pim.injIdToIndex_), massEscapePtr_(nullptr), massStickPtr_(nullptr) {} @@ -199,8 +218,16 @@ bool Foam::LocalInteraction::correct keepParticle = false; p.active(false); U = Zero; - nEscape_[patchi]++; - massEscape_[patchi] += dm; + if (outputByInjectorId_) + { + nEscape_[patchi][injIdToIndex_[p.typeId()]]++; + massEscape_[patchi][injIdToIndex_[p.typeId()]] += dm; + } + else + { + nEscape_[patchi][0]++; + massEscape_[patchi][0] += dm; + } if (writeFields_) { label pI = pp.index(); @@ -216,8 +243,16 @@ bool Foam::LocalInteraction::correct keepParticle = true; p.active(false); U = Zero; - nStick_[patchi]++; - massStick_[patchi] += dm; + if (outputByInjectorId_) + { + nStick_[patchi][injIdToIndex_[p.typeId()]]++; + massStick_[patchi][injIdToIndex_[p.typeId()]] += dm; + } + else + { + nStick_[patchi][0]++; + massStick_[patchi][0] += dm; + } if (writeFields_) { label pI = pp.index(); @@ -279,59 +314,91 @@ void Foam::LocalInteraction::info(Ostream& os) PatchInteractionModel::info(os); // retrieve any stored data - labelList npe0(patchData_.size(), 0); + labelListList npe0(nEscape_); this->getModelProperty("nEscape", npe0); - scalarList mpe0(patchData_.size(), 0.0); + scalarListList mpe0(massEscape_); this->getModelProperty("massEscape", mpe0); - labelList nps0(patchData_.size(), 0); + labelListList nps0(nStick_); this->getModelProperty("nStick", nps0); - scalarList mps0(patchData_.size(), 0.0); + scalarListList mps0(massStick_); this->getModelProperty("massStick", mps0); // accumulate current data - labelList npe(nEscape_); - Pstream::listCombineGather(npe, plusEqOp