From 4d4c5910eddbd67d51467e468e9ee1b0702da2b9 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Fri, 23 Feb 2018 12:00:14 +0000 Subject: [PATCH] ENH: lagrangian injection - exposed minimum number of particles per parcel. See #728 The minimum number of particles per parcel can now be set in the injection model input, e.g.: model1 { type ...; massTotal ...; parcelBasisType ...; minParticlesPerParcel 1; <-- new optional entry SOI ...; ... Uses a value of 1 by default if the entry is not present. The value of 1 is generally recommended and beneficial for coupled cases where small time steps can lead to the injection of too many parcels and subsequently greatly over-predict the particle source contributions (momentum, heat, mass transfer etc) --- .../InjectionModel/InjectionModel/InjectionModel.C | 11 +++++++++-- .../InjectionModel/InjectionModel/InjectionModel.H | 14 +++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 37dd01da99..48286f170d 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.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) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -275,6 +275,7 @@ Foam::InjectionModel::InjectionModel(CloudType& owner) nParticleFixed_(0.0), time0_(0.0), timeStep0_(this->template getModelProperty("timeStep0")), + minParticlesPerParcel_(1), delayedVolume_(0.0), injectorID_(-1) {} @@ -304,6 +305,11 @@ Foam::InjectionModel::InjectionModel nParticleFixed_(0.0), time0_(owner.db().time().value()), timeStep0_(this->template getModelProperty("timeStep0")), + minParticlesPerParcel_ + ( + this->coeffDict().template + lookupOrDefault("minParticlesPerParcel", 1) + ), delayedVolume_(0.0), injectorID_(this->coeffDict().lookupOrDefault("injectorID", -1)) { @@ -382,6 +388,7 @@ Foam::InjectionModel::InjectionModel nParticleFixed_(im.nParticleFixed_), time0_(im.time0_), timeStep0_(im.timeStep0_), + minParticlesPerParcel_(im.minParticlesPerParcel_), delayedVolume_(im.delayedVolume_), injectorID_(im.injectorID_) {} @@ -517,7 +524,7 @@ void Foam::InjectionModel::inject pPtr->rho() ); - if (pPtr->nParticle() >= 1.0) + if (pPtr->nParticle() >= minParticlesPerParcel_) { parcelsAdded++; massAdded += pPtr->nParticle()*pPtr->mass(); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H index f235314642..952fa334c5 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. @@ -81,7 +81,7 @@ public: // Enumerations //- Parcel basis representation options - // i.e constant number of particles OR constant mass per parcel + //- i.e constant number of particles OR constant mass per parcel enum parcelBasis { pbNumber, @@ -100,7 +100,7 @@ protected: scalar SOI_; //- Total volume of particles introduced by this injector [m^3] - // - scaled to ensure massTotal is achieved + //- Note: scaled to ensure massTotal is achieved scalar volumeTotal_; //- Total mass to inject [kg] @@ -128,7 +128,7 @@ protected: parcelBasis parcelBasis_; //- nParticle to assign to parcels when the 'fixed' basis - // is selected + //- is selected scalar nParticleFixed_; //- Continuous phase time at start of injection time step [s] @@ -137,8 +137,12 @@ protected: //- Time at start of injection time step [s] scalar timeStep0_; + //- Minimum number of particles used to represent each parcel + //- default = 1 + scalar minParticlesPerParcel_; + //- Volume that should have been injected, but would lead to - // less than 1 particle per parcel + //- less than minParticlesPerParcel_ particle per parcel scalar delayedVolume_; //- Optional injector ID