void noDrag::setForce() const { if(forceSubM(0).verbose()) { Info << "noDrag::setForce:" << endl; Info << "noDEMForce=" << noDEMForce_ << endl; Info << "keepCFDForce=" << keepCFDForce_ << endl; } label cellI=0; for(int index = 0;index < particleCloud_.numberOfParticles(); ++index) { cellI = particleCloud_.cellIDs()[index][0]; if (cellI > -1) // particle Found { //========================== // set force on particle (proposed new code) // write particle based data to global array //forceSubM(0).partToArray(index,drag,dragExplicit); //========================== // set force on particle (old code) if(!keepCFDForce_) { for(int j=0;j<3;j++) { expForces()[index][j] = 0.; impForces()[index][j] = 0.; } } if(noDEMForce_) { for(int j=0;j<3;j++) DEMForces()[index][j] = 0.; if(particleCloud_.impDEMdrag()) { Cds()[index][0] = 0.; for(int j=0;j<3;j++) fluidVel()[index][j] = 0.; } } //========================== } } }
void BeetstraDrag::setForce() const { scale_=cg(); Info << "BeetstraDrag using scale from liggghts cg = " << scale_ << endl; // get viscosity field #ifdef comp const volScalarField nufField = particleCloud_.turbulence().mu()/rho_; #else const volScalarField& nufField = particleCloud_.turbulence().nu(); #endif vector position(0,0,0); scalar voidfraction(1); vector Ufluid(0,0,0); vector drag(0,0,0); label cellI=0; scalar beta(0); vector Us(0,0,0); vector Ur(0,0,0); scalar ds(0); scalar nuf(0); scalar rho(0); scalar magUr(0); scalar Rep(0); scalar Vs(0); scalar localPhiP(0); scalar filterDragPrefactor(1.0); scalar cCorrParcelSize_(1.0) ; scalar vCell(0); scalar FfFilterPrime(1); scalar F0=0.; scalar G0=0.; interpolationCellPoint<scalar> voidfractionInterpolator_(voidfraction_); interpolationCellPoint<vector> UInterpolator_(U_); #include "setupProbeModel.H" for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { //if(mask[index][0]) //{ cellI = particleCloud_.cellIDs()[index][0]; drag = vector(0,0,0); Ufluid= vector(0,0,0); if (cellI > -1) // particle Found { if(interpolation_) { position = particleCloud_.position(index); voidfraction = voidfractionInterpolator_.interpolate(position,cellI); Ufluid = UInterpolator_.interpolate(position,cellI); //Ensure interpolated void fraction to be meaningful // Info << " --> voidfraction: " << voidfraction << endl; if(voidfraction>1.00) voidfraction = 1.00; if(voidfraction<0.10) voidfraction = 0.10; } else { voidfraction = voidfraction_[cellI]; Ufluid = U_[cellI]; } Us = particleCloud_.velocity(index); Ur = Ufluid-Us; ds = 2*particleCloud_.radius(index); dPrim_ = ds/scale_; nuf = nufField[cellI]; rho = rho_[cellI]; magUr = mag(Ur); Rep = 0; Vs = ds*ds*ds*M_PI/6; localPhiP = 1-voidfraction+SMALL; vCell = U_.mesh().V()[cellI]; if (magUr > 0) { // calc particle Re Nr Rep = dPrim_*voidfraction*magUr/(nuf+SMALL); // 3 - C - 1 - In this section we could insert parameters // or functions // that come from a database // calc model coefficient F0 F0 = 10.f * localPhiP / voidfraction / voidfraction + voidfraction * voidfraction * ( 1.0+1.5*sqrt(localPhiP) ); // calc model coefficient G0 G0 = 0.01720833 * Rep / voidfraction / voidfraction //0.0172083 = 0.413/24 * ( 1.0 / voidfraction + 3.0 * localPhiP * voidfraction + 8.4 * powf(Rep,-0.343) ) / ( 1.0 + powf( 10., 3.0* localPhiP ) * powf( Rep,-(1.0+4.0*localPhiP)/2.0 ) ); // calc model coefficient beta beta = 18.*nuf*rho/(dPrim_*dPrim_) *voidfraction *(F0 + G0); //Apply filtered drag correction if(useFilteredDragModel_) { FfFilterPrime = FfFilterFunc( filtDragParamsLChar2_, vCell, 0 ); filterDragPrefactor = 1 - fFuncFilteredDrag(FfFilterPrime, localPhiP) * hFuncFilteredDrag(localPhiP); beta *= filterDragPrefactor; } if(useParcelSizeDependentFilteredDrag_) //Apply filtered drag correction { scalar dParceldPrim = scale_; cCorrParcelSize_ = cCorrFunctionFilteredDrag( filtDragParamsK_, filtDragParamsALimit_, filtDragParamsAExponent_, localPhiP, dParceldPrim ); beta *= cCorrParcelSize_; } // calc particle's drag drag = Vs * beta * Ur; if (modelType_=="B") drag /= voidfraction; } // 3 - C - 2 - This is a standardized debug and report section if( verbose_ ) //&& index>100 && index < 105) { Info << "index / cellI = " << index << tab << cellI << endl; Info << "position = " << particleCloud_.position(index) << endl; Info << "Us = " << Us << endl; Info << "Ur = " << Ur << endl; Info << "ds = " << ds << endl; Info << "rho = " << rho << endl; Info << "nuf = " << nuf << endl; Info << "voidfraction = " << voidfraction << endl; Info << "voidfraction_[cellI]: " << voidfraction_[cellI] << endl; Info << "Rep = " << Rep << endl; Info << "filterDragPrefactor = " << filterDragPrefactor << endl; Info << "fFuncFilteredDrag: " << fFuncFilteredDrag(FfFilterPrime, localPhiP) << endl; Info << "hFuncFilteredDrag: " << hFuncFilteredDrag(localPhiP) << endl; Info << "cCorrParcelSize: " << cCorrParcelSize_ << endl; Info << "F0 / G0: " << F0 << tab << G0 << endl; Info << "beta: " << beta << endl; Info << "drag = " << drag << endl; Info << "\nBeetstra drag model settings: treatExplicit " << treatExplicit_ << tab << "verbose: " << verbose_ << tab << "dPrim: " << dPrim_ << tab << "interpolation: " << interpolation_ << tab << "filteredDragM: " << useFilteredDragModel_ << tab << "parcelSizeDepDrag: " << useParcelSizeDependentFilteredDrag_ << endl << endl; } //Set value fields and write the probe if(probeIt_) { #include "setupProbeModelfields.H" vValues.append(drag); //first entry must the be the force vValues.append(Ur); sValues.append(Rep); sValues.append(beta); sValues.append(voidfraction); sValues.append(filterDragPrefactor); particleCloud_.probeM().writeProbe(index, sValues, vValues); } } // set force on particle if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] += drag[j]; else for(int j=0;j<3;j++) impForces()[index][j] += drag[j]; // set Cd if(implDEM_) { for(int j=0;j<3;j++) fluidVel()[index][j]=Ufluid[j]; if (modelType_=="B") Cds()[index][0] = Vs*beta/voidfraction; else Cds()[index][0] = Vs*beta; }else{ for(int j=0;j<3;j++) DEMForces()[index][j] += drag[j]; } //} } }
void GidaspowDrag::setForce() const { if (scaleDia_ > 1) Info << "Gidaspow using scale = " << scaleDia_ << endl; else if (particleCloud_.cg() > 1){ scaleDia_=particleCloud_.cg(); Info << "Gidaspow using scale from liggghts cg = " << scaleDia_ << endl; } // get viscosity field #ifdef comp const volScalarField nufField = particleCloud_.turbulence().mu() / rho_; #else const volScalarField& nufField = particleCloud_.turbulence().nu(); #endif vector position(0,0,0); scalar voidfraction(1); vector Ufluid(0,0,0); vector drag(0,0,0); label cellI=0; vector Us(0,0,0); vector Uturb(0,0,0); vector Ur(0,0,0); scalar ds(0); scalar nuf(0); scalar rho(0); scalar magUr(0); scalar Rep(0); scalar Vs(0); scalar localPhiP(0); scalar CdMagUrLag(0); //Cd of the very particle scalar KslLag(0); //momentum exchange of the very particle (per unit volume) scalar betaP(0); //momentum exchange of the very particle interpolationCellPoint<scalar> voidfractionInterpolator_(voidfraction_); interpolationCellPoint<vector> UInterpolator_(U_); #include "setupProbeModel.H" for(int index = 0;index < particleCloud_.numberOfParticles(); ++index) { //if(mask[index][0]) //{ cellI = particleCloud_.cellIDs()[index][0]; drag = vector(0,0,0); betaP = 0; Vs = 0; Ufluid =vector(0,0,0); voidfraction=0; if (cellI > -1) // particle Found { position = particleCloud_.position(index); if(interpolation_) { //position = particleCloud_.position(index); voidfraction = voidfractionInterpolator_.interpolate(position,cellI); Ufluid = UInterpolator_.interpolate(position,cellI); //Ensure interpolated void fraction to be meaningful // Info << " --> voidfraction: " << voidfraction << endl; if(voidfraction>1.00) voidfraction = 1.0; if(voidfraction<0.10) voidfraction = 0.10; } else { voidfraction = voidfraction_[cellI]; Ufluid = U_[cellI]; } Us = particleCloud_.velocity(index); Ur = Ufluid-Us; //accounting for turbulent dispersion if(particleCloud_.dispersionM().isActive()) { Uturb=particleCloud_.fluidTurbVel(index); Ur=(Ufluid+Uturb)-Us; } magUr = mag(Ur); ds = 2*particleCloud_.radius(index)*phi_; rho = rho_[cellI]; nuf = nufField[cellI]; Rep=0.0; localPhiP = 1.0f-voidfraction+SMALL; Vs = ds*ds*ds*M_PI/6; //Compute specific drag coefficient (i.e., Force per unit slip velocity and per m³ SUSPENSION) //Wen and Yu, 1966 if(voidfraction > 0.8) //dilute { Rep=ds/scaleDia_*voidfraction*magUr/nuf; CdMagUrLag = (24.0*nuf/(ds/scaleDia_*voidfraction)) //1/magUr missing here, but compensated in expression for KslLag! *(scalar(1)+0.15*Foam::pow(Rep, 0.687)); KslLag = 0.75*( rho*localPhiP*voidfraction*CdMagUrLag / (ds/scaleDia_*Foam::pow(voidfraction,2.65)) ); } //Ergun, 1952 else //dense { KslLag = (150*Foam::pow(localPhiP,2)*nuf*rho)/ (voidfraction*ds/scaleDia_*ds/scaleDia_+SMALL) + (1.75*(localPhiP) * magUr * rho)/ ((ds/scaleDia_)); } // calc particle's drag coefficient (i.e., Force per unit slip velocity and per m³ PARTICLE) betaP = KslLag / localPhiP; // calc particle's drag drag = Vs * betaP * Ur * scaleDrag_; if (modelType_=="B") drag /= voidfraction; if(verbose_ && index >=0 && index <1) { Pout << " "<< endl; Pout << "Gidaspow drag force verbose: " << endl; Pout << "magUr = " << magUr << endl; Pout << "localPhiP = " << localPhiP << endl; Pout << "CdMagUrLag = " << CdMagUrLag << endl; Pout << "treatExplicit_ = " << treatExplicit_ << endl; Pout << "implDEM_ = " << implDEM_ << endl; Pout << "modelType_ = " << modelType_ << endl; Pout << "KslLag = " << KslLag << endl; Pout << "cellI = " << cellI << endl; Pout << "index = " << index << endl; Pout << "Ufluid = " << Ufluid << endl; Pout << "Uturb = " << Uturb << endl; Pout << "Us = " << Us << endl; Pout << "Ur = " << Ur << endl; Pout << "Vs = " << Vs << endl; Pout << "ds = " << ds << endl; Pout << "ds/scale = " << ds/scaleDia_ << endl; Pout << "phi = " << phi_ << endl; Pout << "rho = " << rho << endl; Pout << "nuf = " << nuf << endl; Pout << "voidfraction = " << voidfraction << endl; Pout << "Rep = " << Rep << endl; Pout << "localPhiP = " << localPhiP << endl; Pout << "betaP = " << betaP << endl; Pout << "drag = " << drag << endl; Pout << "position = " << position << endl; Pout << " "<< endl; } //Set value fields and write the probe if(probeIt_) { #include "setupProbeModelfields.H" vValues.append(drag); //first entry must the be the force vValues.append(Ur); sValues.append(Rep); sValues.append(betaP); sValues.append(voidfraction); particleCloud_.probeM().writeProbe(index, sValues, vValues); } } // set force on particle //treatExplicit_ = false by default if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] += drag[j]; else for(int j=0;j<3;j++) impForces()[index][j] += drag[j]; // set Cd //implDEM_ = false by default if(implDEM_) { for(int j=0;j<3;j++) fluidVel()[index][j]=Ufluid[j]; if (modelType_=="B" && cellI > -1) Cds()[index][0] = Vs*betaP/voidfraction*scaleDrag_; else Cds()[index][0] = Vs*betaP*scaleDrag_; }else{ for(int j=0;j<3;j++) DEMForces()[index][j] += drag[j]; } //}// end if mask }// end loop particles }
void KochHillDrag::setForce() const { if (scaleDia_ > 1) Info << "KochHill using scale = " << scaleDia_ << endl; else if (particleCloud_.cg() > 1){ scaleDia_=particleCloud_.cg(); Info << "KochHill using scale from liggghts cg = " << scaleDia_ << endl; } // get viscosity field #ifdef comp const volScalarField nufField = particleCloud_.turbulence().mu()/rho_; #else const volScalarField& nufField = particleCloud_.turbulence().nu(); #endif vector position(0,0,0); scalar voidfraction(1); vector Ufluid(0,0,0); vector drag(0,0,0); label cellI=0; vector Us(0,0,0); vector Ur(0,0,0); scalar ds(0); scalar nuf(0); scalar rho(0); scalar magUr(0); scalar Rep(0); scalar Vs(0); scalar volumefraction(0); scalar betaP(0); interpolationCellPoint<scalar> voidfractionInterpolator_(voidfraction_); interpolationCellPoint<vector> UInterpolator_(U_); #include "setupProbeModel.H" for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { //if(mask[index][0]) //{ cellI = particleCloud_.cellIDs()[index][0]; drag = vector(0,0,0); betaP = 0; Vs = 0; Ufluid =vector(0,0,0); voidfraction=0; if (cellI > -1) // particle Found { if(interpolation_) { position = particleCloud_.position(index); voidfraction = voidfractionInterpolator_.interpolate(position,cellI); Ufluid = UInterpolator_.interpolate(position,cellI); //Ensure interpolated void fraction to be meaningful // Info << " --> voidfraction: " << voidfraction << endl; if(voidfraction>1.00) voidfraction = 1.00; if(voidfraction<0.40) voidfraction = 0.40; }else { voidfraction = voidfraction_[cellI]; Ufluid = U_[cellI]; } Us = particleCloud_.velocity(index); Ur = Ufluid-Us; ds = particleCloud_.d(index); nuf = nufField[cellI]; rho = rho_[cellI]; magUr = mag(Ur); Rep = 0; Vs = ds*ds*ds*M_PI/6; volumefraction = 1-voidfraction+SMALL; if (magUr > 0) { // calc particle Re Nr Rep = ds/scaleDia_*voidfraction*magUr/(nuf+SMALL); // calc model coefficient F0 scalar F0=0.; if(volumefraction < 0.4) { F0 = (1+3*sqrt((volumefraction)/2)+135/64*volumefraction*log(volumefraction) +16.14*volumefraction )/ (1+0.681*volumefraction-8.48*sqr(volumefraction) +8.16*volumefraction*volumefraction*volumefraction ); } else { F0 = 10*volumefraction/(voidfraction*voidfraction*voidfraction); } // calc model coefficient F3 scalar F3 = 0.0673+0.212*volumefraction+0.0232/pow(voidfraction,5); //Calculate F scalar F = voidfraction * (F0 + 0.5*F3*Rep); // calc drag model coefficient betaP betaP = 18.*nuf*rho/(ds/scaleDia_*ds/scaleDia_)*voidfraction*F; // calc particle's drag drag = Vs*betaP*Ur*scaleDrag_; if (modelType_=="B") drag /= voidfraction; } if(verbose_ && index >=0 && index <2) { Pout << "cellI = " << cellI << endl; Pout << "index = " << index << endl; Pout << "Us = " << Us << endl; Pout << "Ur = " << Ur << endl; Pout << "ds = " << ds << endl; Pout << "ds/scale = " << ds/scaleDia_ << endl; Pout << "rho = " << rho << endl; Pout << "nuf = " << nuf << endl; Pout << "voidfraction = " << voidfraction << endl; Pout << "Rep = " << Rep << endl; Pout << "betaP = " << betaP << endl; Pout << "drag = " << drag << endl; } //Set value fields and write the probe if(probeIt_) { #include "setupProbeModelfields.H" vValues.append(drag); //first entry must the be the force vValues.append(Ur); sValues.append(Rep); sValues.append(betaP); sValues.append(voidfraction); particleCloud_.probeM().writeProbe(index, sValues, vValues); } } // set force on particle if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] += drag[j]; else for(int j=0;j<3;j++) impForces()[index][j] += drag[j]; // set Cd if(implDEM_) { for(int j=0;j<3;j++) fluidVel()[index][j]=Ufluid[j]; if (modelType_=="B" && cellI > -1) Cds()[index][0] = Vs*betaP/voidfraction*scaleDrag_; else Cds()[index][0] = Vs*betaP*scaleDrag_; }else{ for(int j=0;j<3;j++) DEMForces()[index][j] += drag[j]; } //} } }