From 611959fae118edb259fe38bf766d24c758c74723 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 12 Jul 2013 13:14:55 +0100 Subject: [PATCH] ENH: PatchflowRateInjection model - refactored and improved --- .../PatchFlowRateInjection.C | 192 ++++++------------ .../PatchFlowRateInjection.H | 49 ++--- 2 files changed, 81 insertions(+), 160 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C index af9fd37d03..8499589784 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,7 @@ License #include "TimeDataEntry.H" #include "distributionModel.H" #include "mathematicalConstants.H" +#include "surfaceFields.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -39,19 +40,23 @@ Foam::PatchFlowRateInjection::PatchFlowRateInjection ) : InjectionModel(dict, owner, modelName,typeName), - patchName_(this->coeffDict().lookup("patchName")), - patchId_(owner.mesh().boundaryMesh().findPatchID(patchName_)), - patchArea_(0.0), - patchNormal_(vector::zero), + patchInjectionBase(owner.mesh(), this->coeffDict().lookup("patchName")), phiName_(this->coeffDict().template lookupOrDefault("phi", "phi")), rhoName_(this->coeffDict().template lookupOrDefault("rho", "rho")), duration_(readScalar(this->coeffDict().lookup("duration"))), - concentration_(readScalar(this->coeffDict().lookup("concentration"))), - parcelsPerSecond_ + concentration_ ( - readScalar(this->coeffDict().lookup("parcelsPerSecond")) + TimeDataEntry + ( + owner.db().time(), + "concentration", + this->coeffDict() + ) + ), + parcelConcentration_ + ( + readScalar(this->coeffDict().lookup("parcelConcentration")) ), - U0_(vector::zero), sizeDistribution_ ( distributionModels::distributionModel::New @@ -59,45 +64,11 @@ Foam::PatchFlowRateInjection::PatchFlowRateInjection this->coeffDict().subDict("sizeDistribution"), owner.rndGen() ) - ), - cellOwners_(), - fraction_(1.0), - pMeanVolume_(0.0) + ) { - if (patchId_ < 0) - { - FatalErrorIn - ( - "PatchFlowRateInjection::PatchFlowRateInjection" - "(" - "const dictionary&, " - "CloudType&" - ")" - ) << "Requested patch " << patchName_ << " not found" << nl - << "Available patches are: " << owner.mesh().boundaryMesh().names() - << nl << exit(FatalError); - } - - const polyPatch& patch = owner.mesh().boundaryMesh()[patchId_]; - duration_ = owner.db().time().userTimeToTime(duration_); - updateMesh(); - - // TODO: retrieve mean diameter from distrution model - scalar pMeanDiameter = - readScalar(this->coeffDict().lookup("meanParticleDiameter")); - pMeanVolume_ = constant::mathematical::pi*pow3(pMeanDiameter)/6.0; - - // patch geometry - label patchSize = cellOwners_.size(); - label totalPatchSize = patchSize; - reduce(totalPatchSize, sumOp