From ee06cc84cb64a40189744f98f3dc83d41d9ca596 Mon Sep 17 00:00:00 2001 From: danielque Date: Wed, 14 Jun 2017 09:32:50 +0200 Subject: [PATCH] construct field as copy resetting name --- .../explicitCouple/explicitCouple.C | 41 +++++------------ .../implicitCouple/implicitCouple.C | 46 ++++++------------- .../voidFractionModel/voidFractionModel.C | 38 +++++---------- 3 files changed, 38 insertions(+), 87 deletions(-) diff --git a/src/lagrangian/cfdemParticle/subModels/momCoupleModel/explicitCouple/explicitCouple.C b/src/lagrangian/cfdemParticle/subModels/momCoupleModel/explicitCouple/explicitCouple.C index 99e2b906..190b6c85 100644 --- a/src/lagrangian/cfdemParticle/subModels/momCoupleModel/explicitCouple/explicitCouple.C +++ b/src/lagrangian/cfdemParticle/subModels/momCoupleModel/explicitCouple/explicitCouple.C @@ -108,32 +108,9 @@ explicitCouple::~explicitCouple() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // tmp explicitCouple::expMomSource() const { - tmp tsource - ( - new volVectorField - ( - IOobject - ( - "f_explicitCouple", - particleCloud_.mesh().time().timeName(), - particleCloud_.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - particleCloud_.mesh(), - dimensionedVector - ( - "zero", - dimensionSet(1, -2, -2, 0, 0), // N/m3 - vector::zero - ), - "zeroGradient" - ) - ); - scalar tsf = particleCloud_.dataExchangeM().timeStepFraction(); - if(1-tsf < 1e-4) //tsf==1 + if (1. - tsf < 1e-4) //tsf==1 { // calc fNext forAll(fNext_,cellI) @@ -147,12 +124,18 @@ tmp explicitCouple::expMomSource() const if (magF > fLimit_[i]) fNext_[cellI][i] *= fLimit_[i]/magF; } } - tsource.ref() = fPrev_; - }else - { - tsource.ref() = (1 - tsf) * fPrev_ + tsf * fNext_; + return tmp + ( + new volVectorField("f_explicitCouple", fPrev_) + ); + } + else + { + return tmp + ( + new volVectorField("f_explicitCouple", (1. - tsf) * fPrev_ + tsf * fNext_) + ); } - return tsource; } void explicitCouple::resetMomSourceField() const diff --git a/src/lagrangian/cfdemParticle/subModels/momCoupleModel/implicitCouple/implicitCouple.C b/src/lagrangian/cfdemParticle/subModels/momCoupleModel/implicitCouple/implicitCouple.C index 90b1c955..124b7e9b 100644 --- a/src/lagrangian/cfdemParticle/subModels/momCoupleModel/implicitCouple/implicitCouple.C +++ b/src/lagrangian/cfdemParticle/subModels/momCoupleModel/implicitCouple/implicitCouple.C @@ -122,40 +122,19 @@ implicitCouple::~implicitCouple() tmp implicitCouple::impMomSource() const { - tmp tsource - ( - new volScalarField - ( - IOobject - ( - "Ksl_implicitCouple", - particleCloud_.mesh().time().timeName(), - particleCloud_.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - particleCloud_.mesh(), - dimensionedScalar - ( - "zero", - dimensionSet(1, -3, -1, 0, 0), // N/m3 / m/s - 0 - ) - ) - ); - scalar tsf = particleCloud_.dataExchangeM().timeStepFraction(); // calc Ksl - scalar Ur; - if(1-tsf < 1e-4) //tsf==1 + if (1. - tsf < 1e-4) //tsf==1 { + scalar Ur; + forAll(KslNext_,cellI) { Ur = mag(U_[cellI] - Us_[cellI]); - if(Ur > SMALL && alpha_[cellI] < maxAlpha_) //momentum exchange switched off if alpha too big + if (Ur > SMALL && alpha_[cellI] < maxAlpha_) //momentum exchange switched off if alpha too big { KslNext_[cellI] = mag(particleCloud_.forceM(0).impParticleForces()[cellI]) / Ur @@ -166,13 +145,18 @@ tmp implicitCouple::impMomSource() const // limiter if (KslNext_[cellI] > KslLimit_) KslNext_[cellI] = KslLimit_; } - tsource.ref() = KslPrev_; - }else - { - tsource.ref() = (1 - tsf) * KslPrev_ + tsf * KslNext_; + return tmp + ( + new volScalarField("Ksl_implicitCouple", KslPrev_) + ); + } + else + { + return tmp + ( + new volScalarField("Ksl_implicitCouple", (1. - tsf) * KslPrev_ + tsf * KslNext_) + ); } - - return tsource; } void implicitCouple::resetMomSourceField() const diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/voidFractionModel/voidFractionModel.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/voidFractionModel/voidFractionModel.C index a3afcf94..bee8547b 100644 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/voidFractionModel/voidFractionModel.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/voidFractionModel/voidFractionModel.C @@ -102,44 +102,28 @@ voidFractionModel::~voidFractionModel() // * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * // tmp voidFractionModel::voidFractionInterp() const { - tmp tsource - ( - new volScalarField - ( - IOobject - ( - "alpha_voidFractionModel", - particleCloud_.mesh().time().timeName(), - particleCloud_.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - particleCloud_.mesh(), - dimensionedScalar - ( - "zero", - dimensionSet(0, 0, 0, 0, 0), - 0 - ) - ) - ); - scalar tsf = particleCloud_.dataExchangeM().timeStepFraction(); - if(1-tsf < 1e-4 && particleCloud_.dataExchangeM().couplingStep() > 1) //tsf==1 + + if (1. - tsf < 1e-4 && particleCloud_.dataExchangeM().couplingStep() > 1) //tsf==1 { - tsource.ref() = voidfractionPrev_; + return tmp + ( + new volScalarField("alpha_voidFractionModel", voidfractionPrev_) + ); } else { - tsource.ref() = (1 - tsf) * voidfractionPrev_ + tsf * voidfractionNext_; + return tmp + ( + new volScalarField("alpha_voidFractionModel", (1. - tsf) * voidfractionPrev_ + tsf * voidfractionNext_) + ); } - return tsource; } void voidFractionModel::resetVoidFractions() const { voidfractionPrev_.ref() = voidfractionNext_.ref(); - voidfractionNext_.ref() = 1; + voidfractionNext_.ref() = 1.; } /*void voidFractionModel::undoVoidFractions(double**const& mask) const