From 0820d99e858e622eb2081aa56dacdb640cd7b02c Mon Sep 17 00:00:00 2001 From: danielque Date: Wed, 16 Feb 2022 14:58:23 +0100 Subject: [PATCH] move calculation of Us field to separate function in cfdemCloudIB refactoring, use same name as the function doing Us field calculations in cfdemCloudIBContinuousForcing; note that cfdemCloudIB is considering angular velocities of particles while cfdemCloudIBContinuousForcing does not --- .../derived/cfdemCloudIB/cfdemCloudIB.C | 48 +++++++++++-------- .../derived/cfdemCloudIB/cfdemCloudIB.H | 2 + 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.C b/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.C index 42e46cda..9f6ab534 100644 --- a/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.C +++ b/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.C @@ -154,27 +154,7 @@ bool cfdemCloudIB::evolve(volVectorField& Us) // set particle velocity field if(verbose_) Info << "- setVelocity(velocities_)" << endl; - label cell = 0; - vector uP(0,0,0); - vector rVec(0,0,0); - vector velRot(0,0,0); - vector angVel(0,0,0); - for (int index = 0; index < numberOfParticles(); ++index){ - for(int subCell = 0; subCell < voidFractionM().cellsPerParticle()[index][0]; subCell++) - { - cell = cellIDs()[index][subCell]; - - if(cell >=0){ - // calc particle velocity - for(int i=0;i<3;i++) rVec[i]=Us.mesh().C()[cell][i]-position(index)[i]; - for(int i=0;i<3;i++) angVel[i]=angularVelocities()[index][i]; - velRot=angVel^rVec; - for(int i=0;i<3;i++) uP[i] = velocities()[index][i]+velRot[i]; - Us[cell] = (1-voidfractions_[index][subCell])*uP; - } - } - } - if(verbose_) Info << "setVelocity done." << endl; + calcForcingTerm(Us); // only needed for continuous forcing // write DEM data if(verbose_) Info << " -giveDEMdata()" << endl; @@ -194,6 +174,32 @@ bool cfdemCloudIB::evolve(volVectorField& Us) return doCouple; } +void cfdemCloudIB::calcForcingTerm(volVectorField& Us) +{ + label cell = 0; + vector uP(0,0,0); + vector rVec(0,0,0); + vector velRot(0,0,0); + vector angVel(0,0,0); + for (int index = 0; index < numberOfParticles(); ++index) + { + for (int subCell = 0; subCell < voidFractionM().cellsPerParticle()[index][0]; subCell++) + { + cell = cellIDs()[index][subCell]; + + if (cell >=0) + { + // calc particle velocity + for (int i=0;i<3;i++) rVec[i]=Us.mesh().C()[cell][i]-position(index)[i]; + for (int i=0;i<3;i++) angVel[i]=angularVelocities()[index][i]; + velRot=angVel^rVec; + for (int i=0;i<3;i++) uP[i] = velocities()[index][i]+velRot[i]; + Us[cell] = (1-voidfractions_[index][subCell])*uP; + } + } + } +} + void cfdemCloudIB::calcVelocityCorrection ( volScalarField& p, diff --git a/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.H b/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.H index 598a0d71..99439d44 100644 --- a/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.H +++ b/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.H @@ -93,6 +93,8 @@ public: bool evolve(volVectorField&); + void calcForcingTerm(volVectorField&); + void calcVelocityCorrection(volScalarField&,volVectorField&,volScalarField&,volScalarField&); // this could be moved to an IB mom couple model // Access