int main(int, char**) { std::chrono::duration<Rep> d(Rep(15)); d = d % 5; return 0; }
int main() { int T; scanf("%d", &T); while(T--) { int i, x, n, p = 0, res = 0; scanf("%d", &n); Rep(i, MAXN) en[i] = ex[i] = 0; Rep(i, n) { scanf("%d", &x); en[x]++; } Rep(i, n) { scanf("%d", &x); ex[x]++; }
namespace phys { namespace units { // acceleration of free-fall, standard constexpr quantity< acceleration_d > g_sub_n { Rep( 9.80665L ) * meter / square( second ) }; // Avogadro constant constexpr quantity< dimensions< 0, 0, 0, 0, 0, -1 > > N_sub_A { Rep( 6.02214199e+23L ) / mole }; // electronvolt constexpr quantity< energy_d > eV { Rep( 1.60217733e-19L ) * joule }; // elementary charge constexpr quantity< electric_charge_d > e { Rep( 1.602176462e-19L ) * coulomb }; // Planck constant constexpr quantity< dimensions< 2, 1, -1 > > h { Rep( 6.62606876e-34L ) * joule * second }; // speed of light in a vacuum constexpr quantity< speed_d > c { Rep( 299792458L ) * meter / second }; // unified atomic mass unit constexpr quantity< mass_d > u { Rep( 1.6605402e-27L ) * kilogram }; // etc. }} // namespace phys { namespace units {
CachedTexture::CachedTexture( const string &f_,int flags,int w,int h,int first,int cnt ){ string f=f_; if( f.substr(0,2)==".\\" ) f=f.substr(2); if( path.size() ){ string t=path+tolower( filenamefile( f ) ); if( rep=findRep( t,flags,w,h,first,cnt ) ) return; rep=d_new Rep( t,flags,w,h,first,cnt ); if( rep->frames.size() ){ rep_set.insert( rep ); return; } delete rep; } string t=tolower( fullfilename( f ) ); if( rep=findRep( t,flags,w,h,first,cnt ) ) return; rep=d_new Rep( t,flags,w,h,first,cnt ); rep_set.insert( rep ); }
Vec3 getMaxVertexPos() { Vec3 max(0, 0, 0); for (int32 index : Rep(getFrameNum())) { // MV1GetFrameMaxVertexLocalPosition } }
void MainWindow::handleCallRequest(SipRequest const& request) { ContactInfo* sender = sClientMgr->findContact(request.getSenderId()); if (!sender || sClientMgr->hasActiveCall() || sClientMgr->hasCallRequest()) { SipRespond Rep(604, request); sNetworkMgr->tcpSendPacket(Rep.getPacket()); return; } _contactForm->handleCallRequest(sender, request); }
/// <summary> 柵を傾けます </summary> void tilt(const Matrix &mat) { auto w2 = Vec3(0, height, 0).transform(mat); w2.y -= height; for (const auto i : Rep(5)) { vertices[i * 2 + 1].pos = VAdd(vertices[i * 2 + 1].pos, (VECTOR)w2); } }
int main() { // exact conversions allowed for integral reps { boost::chrono::milliseconds ms(1); boost::chrono::microseconds us = ms; BOOST_TEST(us.count() == 1000); } // inexact conversions allowed for floating point reps { boost::chrono::duration<double, boost::micro> us(1); boost::chrono::duration<double, boost::milli> ms = us; BOOST_TEST(ms.count() == 1./1000); } // Convert int to float { boost::chrono::duration<int> i(3); boost::chrono::duration<int> d = i; BOOST_TEST(d.count() == 3); } // default constructor { check_default<boost::chrono::duration<Rep> >(); } // constructor from rep { check_from_rep<boost::chrono::duration<int> >(5); check_from_rep<boost::chrono::duration<int, boost::ratio<3, 2> > >(5); check_from_rep<boost::chrono::duration<Rep, boost::ratio<3, 2> > >(Rep(3)); check_from_rep<boost::chrono::duration<double, boost::ratio<2, 3> > >(5.5); } // constructor from other rep { boost::chrono::duration<double> d(5); BOOST_TEST(d.count() == 5); return boost::report_errors(); } return boost::report_errors(); }
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 MeiLift::setForce() const { const volScalarField& nufField = forceSubM(0).nuField(); const volScalarField& rhoField = forceSubM(0).rhoField(); vector position(0,0,0); vector lift(0,0,0); vector Us(0,0,0); vector Ur(0,0,0); scalar magUr(0); scalar magVorticity(0); scalar ds(0); scalar dParcel(0); scalar nuf(0); scalar rho(0); scalar voidfraction(1); scalar Rep(0); scalar Rew(0); scalar Cl(0); scalar Cl_star(0); scalar J_star(0); scalar Omega_eq(0); scalar alphaStar(0); scalar epsilon(0); scalar omega_star(0); vector vorticity(0,0,0); volVectorField vorticity_ = fvc::curl(U_); #include "resetVorticityInterpolator.H" #include "resetUInterpolator.H" #include "setupProbeModel.H" for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { //if(mask[index][0]) //{ lift = vector::zero; label cellI = particleCloud_.cellIDs()[index][0]; if (cellI > -1) // particle Found { Us = particleCloud_.velocity(index); if( forceSubM(0).interpolation() ) { position = particleCloud_.position(index); Ur = UInterpolator_().interpolate(position,cellI) - Us; vorticity = vorticityInterpolator_().interpolate(position,cellI); } else { Ur = U_[cellI] - Us; vorticity=vorticity_[cellI]; } magUr = mag(Ur); magVorticity = mag(vorticity); if (magUr > 0 && magVorticity > 0) { ds = 2*particleCloud_.radius(index); dParcel = ds; forceSubM(0).scaleDia(ds,index); //caution: this fct will scale ds! nuf = nufField[cellI]; rho = rhoField[cellI]; //Update any scalar or vector quantity for (int iFSub=0;iFSub<nrForceSubModels();iFSub++) forceSubM(iFSub).update( index, cellI, ds, nuf, rho, forceSubM(0).verbose() ); // calc dimensionless properties Rep = ds*magUr/nuf; Rew = magVorticity*ds*ds/nuf; alphaStar = magVorticity*ds/magUr/2.0; epsilon = sqrt(2.0*alphaStar /Rep ); omega_star=2.0*alphaStar; //Basic model for the correction to the Saffman lift //Based on McLaughlin (1991) if(epsilon < 0.1) { J_star = -140 *epsilon*epsilon*epsilon*epsilon*epsilon *log( 1./(epsilon*epsilon+SMALL) ); } else if(epsilon > 20) { J_star = 1.0-0.287/(epsilon*epsilon+SMALL); } else { J_star = 0.3 *( 1.0 +tanh( 2.5 * log10(epsilon+0.191) ) ) *( 0.667 +tanh( 6.0 * (epsilon-0.32) ) ); } Cl=J_star*4.11*epsilon; //multiply McLaughlin's correction to the basic Saffman model //Second order terms given by Loth and Dorgan 2009 if(useSecondOrderTerms_) { Omega_eq = omega_star/2.0*(1.0-0.0075*Rew)*(1.0-0.062*sqrt(Rep)-0.001*Rep); Cl_star=1.0-(0.675+0.15*(1.0+tanh(0.28*(omega_star/2.0-2.0))))*tanh(0.18*sqrt(Rep)); Cl += Omega_eq*Cl_star; } lift = 0.125*M_PI *rho *Cl *magUr*Ur^vorticity/magVorticity *ds*ds; //total force on all particles in parcel forceSubM(0).scaleForce(lift,dParcel,index); if (modelType_=="B") { voidfraction = particleCloud_.voidfraction(index); lift /= voidfraction; } } //********************************** //SAMPLING AND VERBOSE OUTOUT if( forceSubM(0).verbose() ) { Pout << "index = " << index << endl; Pout << "Us = " << Us << endl; Pout << "Ur = " << Ur << endl; Pout << "vorticity = " << vorticity << endl; Pout << "dprim = " << ds << endl; Pout << "rho = " << rho << endl; Pout << "nuf = " << nuf << endl; Pout << "Rep = " << Rep << endl; Pout << "Rew = " << Rew << endl; Pout << "alphaStar = " << alphaStar << endl; Pout << "epsilon = " << epsilon << endl; Pout << "J_star = " << J_star << endl; Pout << "lift = " << lift << endl; } //Set value fields and write the probe if(probeIt_) { #include "setupProbeModelfields.H" // Note: for other than ext one could use vValues.append(x) // instead of setSize vValues.setSize(vValues.size()+1, lift); //first entry must the be the force vValues.setSize(vValues.size()+1, Ur); vValues.setSize(vValues.size()+1, vorticity); sValues.setSize(sValues.size()+1, Rep); sValues.setSize(sValues.size()+1, Rew); sValues.setSize(sValues.size()+1, J_star); particleCloud_.probeM().writeProbe(index, sValues, vValues); } // END OF SAMPLING AND VERBOSE OUTOUT //********************************** } // write particle based data to global array forceSubM(0).partToArray(index,lift,vector::zero); //} } }
static Rep zero () { return Rep(0); }
void KochHillDrag::setForce ( double** const& mask, double**& impForces, double**& expForces, double**& DEMForces ) const { // 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); interpolationCellPoint<scalar> voidfractionInterpolator_(voidfraction_); interpolationCellPoint<vector> UInterpolator_(U_); for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { if(mask[index][0]) { cellI = particleCloud_.cellIDs()[index][0]; drag = 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); }else { voidfraction = particleCloud_.voidfraction(index); Ufluid = U_[cellI]; } Us = particleCloud_.velocity(index); Ur = Ufluid-Us; ds = 2*particleCloud_.radius(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/scale_*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); // calc model coefficient beta scalar beta = 18*nuf*rho*voidfraction*voidfraction*volumefraction/(ds/scale_*ds/scale_)* (F0 + 0.5*F3*Rep); // calc particle's drag drag = Vs*beta/volumefraction*Ur; if (modelType_=="B") drag /= voidfraction; } if(verbose_ && index >=0 && index <2) { Info << "index = " << index << endl; Info << "Us = " << Us << endl; Info << "Ur = " << Ur << endl; Info << "ds = " << ds << endl; Info << "ds/scale = " << ds/scale_ << endl; Info << "rho = " << rho << endl; Info << "nuf = " << nuf << endl; Info << "voidfraction = " << voidfraction << endl; Info << "Rep = " << Rep << endl; Info << "drag = " << drag << endl; } } // 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]; } } }
// speed of light in a vacuum inline quantity c() { return Rep( 299792458L ) * meter() / second(); }
// elementary charge inline quantity e() { return Rep( 1.602176462e-19L ) * coulomb(); }
// Avogadro constant inline quantity N_sub_A() { return mole() / mole() * // to help msvc Rep( 6.02214199e+23L ) / mole(); }
CachedTexture::CachedTexture( int w,int h,int flags,int cnt ): rep(d_new Rep(w,h,flags,cnt)){ }
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 scalarGeneralExchange::manipulateScalarField(volScalarField& explicitEulerSource, volScalarField& implicitEulerSource, int speciesID) const { // reset Scalar field explicitEulerSource.internalField() = 0.0; implicitEulerSource.internalField() = 0.0; if(speciesID>=0 && particleSpeciesValue_[speciesID]<0.0) //skip if species is not active return; //Set the names of the exchange fields word fieldName; word partDatName; word partFluxName; word partTransCoeffName; word partFluidName; scalar transportParameter; // realloc the arrays to pull particle data if(speciesID<0) //this is the temperature - always pull from LIGGGHTS { fieldName = tempFieldName_; partDatName = partTempName_; partFluxName = partHeatFluxName_; partTransCoeffName = partHeatTransCoeffName_; partFluidName = partHeatFluidName_; transportParameter = lambda_; allocateMyArrays(0.0); particleCloud_.dataExchangeM().getData(partDatName,"scalar-atom", partDat_); } else { fieldName = eulerianFieldNames_[speciesID]; partDatName = partSpeciesNames_[speciesID]; partFluxName = partSpeciesFluxNames_[speciesID]; partTransCoeffName = partSpeciesTransCoeffNames_[speciesID]; partFluidName = partSpeciesFluidNames_[speciesID]; transportParameter = DMolecular_[speciesID]; allocateMyArrays(0.0); if(particleSpeciesValue_[speciesID]>ALARGECONCENTRATION) particleCloud_.dataExchangeM().getData(partDatName,"scalar-atom", partDat_); } if (scaleDia_ > 1) Info << typeName << " using scale = " << scaleDia_ << endl; else if (particleCloud_.cg() > 1) { scaleDia_=particleCloud_.cg(); Info << typeName << " using scale from liggghts cg = " << scaleDia_ << endl; } //============================== // get references const volScalarField& voidfraction_(particleCloud_.mesh().lookupObject<volScalarField> (voidfractionFieldName_)); // ref to voidfraction field const volVectorField& U_(particleCloud_.mesh().lookupObject<volVectorField> (velFieldName_)); const volScalarField& fluidScalarField_(particleCloud_.mesh().lookupObject<volScalarField> (fieldName)); // ref to scalar field const volScalarField& nufField = forceSubM(0).nuField(); //============================== // calc La based heat flux vector position(0,0,0); scalar voidfraction(1); vector Ufluid(0,0,0); scalar fluidValue(0); label cellI=0; vector Us(0,0,0); vector Ur(0,0,0); scalar dscaled(0); scalar nuf(0); scalar magUr(0); scalar As(0); scalar Rep(0); scalar Pr(0); scalar sDth(scaleDia_*scaleDia_*scaleDia_); interpolationCellPoint<scalar> voidfractionInterpolator_(voidfraction_); interpolationCellPoint<vector> UInterpolator_(U_); interpolationCellPoint<scalar> fluidScalarFieldInterpolator_(fluidScalarField_); #include "setupProbeModel.H" for(int index = 0;index < particleCloud_.numberOfParticles(); ++index) { cellI = particleCloud_.cellIDs()[index][0]; if(cellI >= 0) { if(forceSubM(0).interpolation()) { position = particleCloud_.position(index); voidfraction = voidfractionInterpolator_.interpolate(position,cellI); Ufluid = UInterpolator_.interpolate(position,cellI); fluidValue = fluidScalarFieldInterpolator_.interpolate(position,cellI); }else { voidfraction = voidfraction_[cellI]; Ufluid = U_[cellI]; fluidValue = fluidScalarField_[cellI]; } // calc relative velocity Us = particleCloud_.velocity(index); Ur = Ufluid-Us; magUr = mag(Ur); dscaled = 2*particleCloud_.radius(index)/scaleDia_; As = dscaled*dscaled*M_PI*sDth; nuf = nufField[cellI]; Rep = dscaled*magUr/nuf; if(speciesID<0) //have temperature Pr = Prandtl_; else Pr = max(SMALL,nuf/transportParameter); //This is Sc for species scalar alpha = transportParameter*(this->*Nusselt)(Rep,Pr,voidfraction)/(dscaled); // calc convective heat flux [W] scalar areaTimesTransferCoefficient = alpha * As; scalar tmpPartFlux = areaTimesTransferCoefficient * (fluidValue - partDat_[index][0]); partDatFlux_[index][0] = tmpPartFlux; // split implicit/explicit contribution forceSubM(0).explicitCorrScalar( partDatTmpImpl_[index][0], partDatTmpExpl_[index][0], areaTimesTransferCoefficient, fluidValue, fluidScalarField_[cellI], partDat_[index][0], forceSubM(0).verbose() ); if(validPartTransCoeff_) partDatTransCoeff_[index][0] = alpha; if(validPartFluid_) partDatFluid_[index][0] = fluidValue; if( forceSubM(0).verbose()) { Pout << "fieldName = " << fieldName << endl; Pout << "partTransCoeffName = " << partTransCoeffName << endl; Pout << "index = " <<index << endl; Pout << "partFlux = " << tmpPartFlux << endl; Pout << "magUr = " << magUr << endl; Pout << "As = " << As << endl; Pout << "r = " << particleCloud_.radius(index) << endl; Pout << "dscaled = " << dscaled << endl; Pout << "nuf = " << nuf << endl; Pout << "Rep = " << Rep << endl; Pout << "Pr/Sc = " << Pr << endl; Pout << "Nup/Shp = " << (this->*Nusselt)(Rep,Pr,voidfraction) << endl; Pout << "partDatTransCoeff: " << partDatTransCoeff_[index][0] << endl; Pout << "voidfraction = " << voidfraction << endl; Pout << "partDat_[index][0] = " << partDat_[index][0] << endl ; Pout << "fluidValue = " << fluidValue << endl ; } //Set value fields and write the probe if(probeIt_) { #include "setupProbeModelfields.H" vValues.append(Ur); sValues.append((this->*Nusselt)(Rep,Pr,voidfraction)); sValues.append(Rep); particleCloud_.probeM().writeProbe(index, sValues, vValues); } } } //Handle explicit and implicit source terms on the Euler side //these are simple summations! particleCloud_.averagingM().setScalarSum ( explicitEulerSource, partDatTmpExpl_, particleCloud_.particleWeights(), NULL ); particleCloud_.averagingM().setScalarSum ( implicitEulerSource, partDatTmpImpl_, particleCloud_.particleWeights(), NULL ); // scale with the cell volume to get (total) volume-specific source explicitEulerSource.internalField() /= -explicitEulerSource.mesh().V(); implicitEulerSource.internalField() /= -implicitEulerSource.mesh().V(); // limit explicit source term scalar explicitEulerSourceInCell; forAll(explicitEulerSource,cellI) { explicitEulerSourceInCell = explicitEulerSource[cellI]; if(mag(explicitEulerSourceInCell) > maxSource_ ) { explicitEulerSource[cellI] = sign(explicitEulerSourceInCell) * maxSource_; } }
void KochHillDrag::setForce() const { const volScalarField& nufField = forceSubM(0).nuField(); const volScalarField& rhoField = forceSubM(0).rhoField(); //update force submodels to prepare for loop for (int iFSub=0;iFSub<nrForceSubModels();iFSub++) forceSubM(iFSub).preParticleLoop(forceSubM(iFSub).verbose()); vector position(0,0,0); scalar voidfraction(1); vector Ufluid(0,0,0); vector drag(0,0,0); vector dragExplicit(0,0,0); scalar dragCoefficient(0); label cellI=0; vector Us(0,0,0); vector Ur(0,0,0); scalar ds(0); scalar dParcel(0); scalar nuf(0); scalar rho(0); scalar magUr(0); scalar Rep(0); scalar Vs(0); scalar volumefraction(0); scalar betaP(0); scalar piBySix(M_PI/6); int couplingInterval(particleCloud_.dataExchangeM().couplingInterval()); #include "resetVoidfractionInterpolator.H" #include "resetUInterpolator.H" #include "setupProbeModel.H" for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { cellI = particleCloud_.cellIDs()[index][0]; drag = vector(0,0,0); dragExplicit = vector(0,0,0); dragCoefficient=0; betaP = 0; Vs = 0; Ufluid =vector(0,0,0); voidfraction=0; if (cellI > -1) // particle Found { if(forceSubM(0).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]; } ds = particleCloud_.d(index); dParcel = ds; forceSubM(0).scaleDia(ds); //caution: this fct will scale ds! nuf = nufField[cellI]; rho = rhoField[cellI]; Us = particleCloud_.velocity(index); //Update any scalar or vector quantity for (int iFSub=0;iFSub<nrForceSubModels();iFSub++) forceSubM(iFSub).update( index, cellI, ds, Ufluid, Us, nuf, rho, forceSubM(0).verbose() ); Ur = Ufluid-Us; magUr = mag(Ur); Rep = 0; Vs = ds*ds*ds*piBySix; volumefraction = max(SMALL,min(1-SMALL,1-voidfraction)); if (magUr > 0) { // calc particle Re Nr Rep = ds*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 (the factor 0.5 is introduced, since Koch and Hill, ARFM 33:619–47, use the radius //to define Rep, and we use the particle diameter, see vanBuijtenen et al., CES 66:2368–2376. scalar F = voidfraction * (F0 + 0.5*F3*Rep); // calc drag model coefficient betaP betaP = 18.*nuf*rho/(ds*ds)*voidfraction*F; // calc particle's drag dragCoefficient = Vs*betaP; if (modelType_=="B") dragCoefficient /= voidfraction; forceSubM(0).scaleCoeff(dragCoefficient,dParcel); if(forceSubM(0).switches()[7]) // implForceDEMaccumulated=true { //get drag from the particle itself for (int j=0 ; j<3 ; j++) drag[j] = particleCloud_.fAccs()[index][j]/couplingInterval; }else { drag = dragCoefficient * Ur; // explicitCorr for (int iFSub=0;iFSub<nrForceSubModels();iFSub++) forceSubM(iFSub).explicitCorr( drag, dragExplicit, dragCoefficient, Ufluid, U_[cellI], Us, UsField_[cellI], forceSubM(iFSub).verbose() ); } } if(forceSubM(0).verbose() && index >=0 && index <2) { Pout << "cellI = " << cellI << endl; Pout << "index = " << index << endl; Pout << "Us = " << Us << endl; Pout << "Ur = " << Ur << endl; Pout << "dprim = " << ds << 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" // Note: for other than ext one could use vValues.append(x) // instead of setSize vValues.setSize(vValues.size()+1, drag); //first entry must the be the force vValues.setSize(vValues.size()+1, Ur); sValues.setSize(sValues.size()+1, Rep); sValues.setSize(sValues.size()+1, betaP); sValues.setSize(sValues.size()+1, voidfraction); particleCloud_.probeM().writeProbe(index, sValues, vValues); } } // write particle based data to global array forceSubM(0).partToArray(index,drag,dragExplicit,Ufluid,dragCoefficient); } }
namespace phys { namespace units { constexpr quantity< electric_current_d > abampere { Rep( 1e+1L ) * ampere }; constexpr quantity< electric_charge_d > abcoulomb { Rep( 1e+1L ) * coulomb }; constexpr quantity< capacitance_d > abfarad { Rep( 1e+9L ) * farad }; constexpr quantity< inductance_d > abhenry { Rep( 1e-9L ) * henry }; constexpr quantity< electric_conductance_d > abmho { Rep( 1e+9L ) * siemens }; constexpr quantity< electric_resistance_d > abohm { Rep( 1e-9L ) * ohm }; constexpr quantity< electric_potential_d > abvolt { Rep( 1e-8L ) * volt }; constexpr quantity< area_d > acre { Rep( 4.046873e+3L ) * square( meter ) }; constexpr quantity< volume_d > acre_foot { Rep( 1.233489e+3L ) * cube( meter ) }; constexpr quantity< length_d > astronomical_unit { Rep( 1.495979e+11L ) * meter }; constexpr quantity< pressure_d > atmosphere_std { Rep( 1.01325e+5L ) * pascal }; constexpr quantity< pressure_d > atmosphere_tech { Rep( 9.80665e+4L ) * pascal }; constexpr quantity< volume_d > barrel { Rep( 1.589873e-1L ) * cube( meter ) }; constexpr quantity< electric_current_d > biot { Rep( 1e+1L ) * ampere }; constexpr quantity< energy_d > btu { Rep( 1.05587e+3L ) * joule }; constexpr quantity< energy_d > btu_it { Rep( 1.055056e+3L ) * joule }; constexpr quantity< energy_d > btu_th { Rep( 1.054350e+3L ) * joule }; constexpr quantity< energy_d > btu_39F { Rep( 1.05967e+3L ) * joule }; constexpr quantity< energy_d > btu_59F { Rep( 1.05480e+3L ) * joule }; constexpr quantity< energy_d > btu_60F { Rep( 1.05468e+3L ) * joule }; constexpr quantity< volume_d > bushel { Rep( 3.523907e-2L ) * cube( meter ) }; constexpr quantity< energy_d > calorie { Rep( 4.19002L ) * joule }; constexpr quantity< energy_d > calorie_it { Rep( 4.1868L ) * joule }; constexpr quantity< energy_d > calorie_th { Rep( 4.184L ) * joule }; constexpr quantity< energy_d > calorie_15C { Rep( 4.18580L ) * joule }; constexpr quantity< energy_d > calorie_20C { Rep( 4.18190L ) * joule }; constexpr quantity< mass_d > carat_metric { Rep( 2e-4L ) * kilogram }; constexpr quantity< length_d > chain { Rep( 2.011684e+1L ) * meter }; constexpr quantity< thermal_insulance_d > clo { Rep( 1.55e-1L ) * square( meter ) * kelvin / watt }; constexpr quantity< pressure_d > cm_mercury { Rep( 1.333224e+3L ) * pascal }; constexpr quantity< volume_d > cord { Rep( 3.624556L ) * cube( meter ) }; constexpr quantity< volume_d > cup { Rep( 2.365882e-4L ) * cube( meter ) }; constexpr quantity< dimensions< 2, 0, 0 >> darcy { Rep( 9.869233e-13L ) * square( meter ) }; constexpr quantity< time_interval_d > day_sidereal { Rep( 8.616409e+4L ) * second }; constexpr quantity< dimensions< 1, 0, 1, 1>> debye { Rep( 3.335641e-30L ) * coulomb * meter }; constexpr quantity< thermodynamic_temperature_d > degree_fahrenheit{ Rep( 5.555556e-1L ) * kelvin }; constexpr quantity< thermodynamic_temperature_d > degree_rankine { Rep( 5.555556e-1L ) * kelvin }; constexpr quantity< dimensions< -1, 1, 0 >> denier { Rep( 1.111111e-7L ) * kilogram / meter }; constexpr quantity< force_d > dyne { Rep( 1e-5L ) * newton }; constexpr quantity< energy_d > erg { Rep( 1e-7L ) * joule }; constexpr quantity< electric_charge_d > faraday { Rep( 9.648531e+4L ) * coulomb }; constexpr quantity< length_d > fathom { Rep( 1.828804L ) * meter }; constexpr quantity< length_d > fermi { Rep( 1e-15L ) * meter }; constexpr quantity< length_d > foot { Rep( 3.048e-1L ) * meter }; constexpr quantity< energy_d > foot_pound_force { Rep( 1.355818L ) * joule }; constexpr quantity< energy_d > foot_poundal { Rep( 4.214011e-2L ) * joule }; constexpr quantity< length_d > foot_us_survey { Rep( 3.048006e-1L ) * meter }; constexpr quantity< illuminance_d > footcandle { Rep( 1.076391e+1L ) * lux }; constexpr quantity< illuminance_d > footlambert { Rep( 3.426259L ) * candela / square( meter ) }; constexpr quantity< time_interval_d > fortnight { Rep( 14 ) * day }; // from OED constexpr quantity< electric_charge_d > franklin { Rep( 3.335641e-10L ) * coulomb }; constexpr quantity< length_d > furlong { Rep( 2.01168e+2L ) * meter }; // from OED constexpr quantity< volume_d > gallon_imperial { Rep( 4.54609e-3L ) * cube( meter ) }; constexpr quantity< volume_d > gallon_us { Rep( 3.785412e-3L ) * cube( meter ) }; constexpr quantity< magnetic_flux_density_d > gamma { Rep( 1e-9L ) * tesla }; constexpr quantity< mass_d > gamma_mass { Rep( 1e-9L ) * kilogram }; constexpr quantity< magnetic_flux_density_d > gauss { Rep( 1e-4L ) * tesla }; constexpr quantity< electric_current_d > gilbert { Rep( 7.957747e-1L ) * ampere }; constexpr quantity< volume_d > gill_imperial { Rep( 1.420653e-4L ) * cube( meter ) }; constexpr quantity< volume_d > gill_us { Rep( 1.182941e-4L ) * cube( meter ) }; constexpr Rep gon { Rep( 9e-1L ) * degree_angle }; constexpr quantity< mass_d > grain { Rep( 6.479891e-5L ) * kilogram }; constexpr quantity< power_d > horsepower { Rep( 7.456999e+2L ) * watt }; constexpr quantity< power_d > horsepower_boiler { Rep( 9.80950e+3L ) * watt }; constexpr quantity< power_d > horsepower_electric{ Rep( 7.46e+2L ) * watt }; constexpr quantity< power_d > horsepower_metric { Rep( 7.354988e+2L ) * watt }; constexpr quantity< power_d > horsepower_uk { Rep( 7.4570e+2L ) * watt }; constexpr quantity< power_d > horsepower_water { Rep( 7.46043e+2L ) * watt }; constexpr quantity< time_interval_d > hour_sidereal { Rep( 3.590170e+3L ) * second }; constexpr quantity< mass_d > hundredweight_long { Rep( 5.080235e+1L ) * kilogram }; constexpr quantity< mass_d > hundredweight_short{ Rep( 4.535924e+1L ) * kilogram }; constexpr quantity< length_d > inch { Rep( 2.54e-2L ) * meter }; constexpr quantity< pressure_d > inches_mercury { Rep( 3.386389e+3L ) * pascal }; constexpr quantity< wave_number_d > kayser { Rep( 1e+2 ) / meter }; constexpr quantity< force_d > kilogram_force { Rep( 9.80665 ) * newton }; constexpr quantity< force_d > kilopond { Rep( 9.80665 ) * newton }; constexpr quantity< force_d > kip { Rep( 4.448222e+3L ) * newton }; constexpr quantity< volume_d > lambda_volume { Rep( 1e-9L ) * cube( meter ) }; constexpr quantity< illuminance_d > lambert { Rep( 3.183099e+3L ) * candela / square( meter ) }; constexpr quantity< heat_density_d > langley { Rep( 4.184e+4L ) * joule / square( meter ) }; constexpr quantity< length_d > light_year { Rep( 9.46073e+15L ) * meter }; constexpr quantity< magnetic_flux_d > maxwell { Rep( 1e-8L ) * weber }; constexpr quantity< electric_conductance_d > mho { siemens }; constexpr quantity< length_d > micron { micro * meter }; constexpr quantity< length_d > mil { Rep( 2.54e-5L ) * meter }; constexpr Rep mil_angle { Rep( 5.625e-2L ) * degree_angle }; constexpr quantity< area_d > mil_circular { Rep( 5.067075e-10L ) * square( meter ) }; constexpr quantity< length_d > mile { Rep( 1.609344e+3L ) * meter }; constexpr quantity< length_d > mile_us_survey { Rep( 1.609347e+3L ) * meter }; constexpr quantity< time_interval_d > minute_sidereal { Rep( 5.983617e+1L ) * second }; constexpr quantity< dimensions< -1, 0, 0, 1 > >oersted { Rep( 7.957747e+1L ) * ampere / meter }; constexpr quantity< mass_d > ounce_avdp { Rep( 2.834952e-2L ) * kilogram }; constexpr quantity< volume_d > ounce_fluid_imperial{ Rep( 2.841306e-5L ) * cube( meter ) }; constexpr quantity< volume_d > ounce_fluid_us { Rep( 2.957353e-5L ) * cube( meter ) }; constexpr quantity< force_d > ounce_force { Rep( 2.780139e-1L ) * newton }; constexpr quantity< mass_d > ounce_troy { Rep( 3.110348e-2L ) * kilogram }; constexpr quantity< length_d > parsec { Rep( 3.085678e+16L ) * meter }; constexpr quantity< volume_d > peck { Rep( 8.809768e-3L ) * cube( meter ) }; constexpr quantity< mass_d > pennyweight { Rep( 1.555174e-3L ) * kilogram }; constexpr quantity< substance_permeability_d > perm_0C { Rep( 5.72135e-11L ) * kilogram / pascal / second / square( meter ) }; constexpr quantity< substance_permeability_d > perm_23C { Rep( 5.74525e-11L ) * kilogram / pascal / second / square( meter ) }; constexpr quantity< illuminance_d > phot { Rep( 1e+4L ) * lux }; constexpr quantity< length_d > pica_computer { Rep( 4.233333e-3L ) * meter }; constexpr quantity< length_d > pica_printers { Rep( 4.217518e-3L ) * meter }; constexpr quantity< volume_d > pint_dry { Rep( 5.506105e-4L ) * cube( meter ) }; constexpr quantity< volume_d > pint_liquid { Rep( 4.731765e-4L ) * cube( meter ) }; constexpr quantity< length_d > point_computer { Rep( 3.527778e-4L ) * meter }; constexpr quantity< length_d > point_printers { Rep( 3.514598e-4L ) * meter }; constexpr quantity< dynamic_viscosity_d > poise { Rep( 1e-1L ) * pascal * second }; constexpr quantity< mass_d > pound_avdp { Rep( 4.5359237e-1L ) * kilogram }; constexpr quantity< force_d > pound_force { Rep( 4.448222L ) * newton }; constexpr quantity< mass_d > pound_troy { Rep( 3.732417e-1L ) * kilogram }; constexpr quantity< force_d > poundal { Rep( 1.382550e-1L ) * newton }; constexpr quantity< pressure_d > psi { Rep( 6.894757e+3L ) * pascal }; constexpr quantity< energy_d > quad { Rep( 1e+15L ) * btu_it }; constexpr quantity< volume_d > quart_dry { Rep( 1.101221e-3L ) * cube( meter ) }; constexpr quantity< volume_d > quart_liquid { Rep( 9.463529e-4L ) * cube( meter ) }; constexpr Rep revolution { Rep( 2 ) * pi }; constexpr quantity< dimensions< 1, -1, 1 > > rhe { Rep( 1e+1L ) / pascal / second }; constexpr quantity< length_d > rod { Rep( 5.029210L ) * meter }; constexpr quantity< angular_velocity_d > rpm { Rep( 1.047198e-1L ) / second }; constexpr quantity< time_interval_d > second_sidereal { Rep( 9.972696e-1L ) * second }; constexpr quantity< time_interval_d > shake { Rep( 1e-8L ) * second }; constexpr quantity< mass_d > slug { Rep( 1.459390e+1L ) * kilogram }; constexpr quantity< electric_current_d > statampere { Rep( 3.335641e-10L ) * ampere }; constexpr quantity< electric_charge_d > statcoulomb { Rep( 3.335641e-10L ) * coulomb }; constexpr quantity< capacitance_d > statfarad { Rep( 1.112650e-12L ) * farad }; constexpr quantity< inductance_d > stathenry { Rep( 8.987552e+11L ) * henry }; constexpr quantity< electric_conductance_d > statmho { Rep( 1.112650e-12L ) * siemens }; constexpr quantity< electric_resistance_d > statohm { Rep( 8.987552e+11L ) * ohm }; constexpr quantity< electric_potential_d > statvolt { Rep( 2.997925e+2L ) * volt }; constexpr quantity< volume_d > stere { cube( meter ) }; constexpr quantity< illuminance_d > stilb { Rep( 1e+4L ) * candela / square( meter ) }; constexpr quantity< kinematic_viscosity_d > stokes { Rep( 1e-4L ) * square( meter ) / second }; constexpr quantity< volume_d > tablespoon { Rep( 1.478676e-5L ) * cube( meter ) }; constexpr quantity< volume_d > teaspoon { Rep( 4.928922e-6L ) * cube( meter ) }; constexpr quantity< dimensions< -1, 1, 0 > > tex { Rep( 1e-6L ) * kilogram / meter }; constexpr quantity< energy_d > therm_ec { Rep( 1.05506e+8L ) * joule }; constexpr quantity< energy_d > therm_us { Rep( 1.054804e+8L ) * joule }; constexpr quantity< mass_d > ton_assay { Rep( 2.916667e-2L ) * kilogram }; constexpr quantity< force_d > ton_force { Rep( 8.896443e+3L ) * newton }; constexpr quantity< mass_d > ton_long { Rep( 1.016047e+3L ) * kilogram }; constexpr quantity< heat_flow_rate_d > ton_refrigeration { Rep( 3.516853e+3L ) * watt }; constexpr quantity< volume_d > ton_register { Rep( 2.831685L ) * cube( meter ) }; constexpr quantity< mass_d > ton_short { Rep( 9.071847e+2L ) * kilogram }; constexpr quantity< energy_d > ton_tnt { Rep( 4.184e+9L ) * joule }; constexpr quantity< pressure_d > torr { Rep( 1.333224e+2L ) * pascal }; constexpr quantity< magnetic_flux_d > unit_pole { Rep( 1.256637e-7L ) * weber }; constexpr quantity< time_interval_d > week { Rep( 604800L ) * second }; // 7 days constexpr quantity< length_d > x_unit { Rep( 1.002e-13L ) * meter }; constexpr quantity< length_d > yard { Rep( 9.144e-1L ) * meter }; constexpr quantity< time_interval_d > year_sidereal { Rep( 3.155815e+7L ) * second }; constexpr quantity< time_interval_d > year_std { Rep( 3.1536e+7L ) * second }; // 365 days constexpr quantity< time_interval_d > year_tropical { Rep( 3.155693e+7L ) * second }; }} // namespace phys::units
void DiFeliceDrag::setForce() const { if (scaleDia_ > 1) Info << typeName << " using scale = " << scaleDia_ << endl; else if (particleCloud_.cg() > 1){ scaleDia_=particleCloud_.cg(); Info << typeName << " using scale from liggghts cg = " << scaleDia_ << endl; } const volScalarField& nufField = forceSubM(0).nuField(); const volScalarField& rhoField = forceSubM(0).rhoField(); vector position(0,0,0); scalar voidfraction(1); vector Ufluid(0,0,0); vector drag(0,0,0); vector dragExplicit(0,0,0); scalar dragCoefficient(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 Cd(0); interpolationCellPoint<scalar> voidfractionInterpolator_(voidfraction_); interpolationCellPoint<vector> UInterpolator_(U_); #include "setupProbeModel.H" for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { cellI = particleCloud_.cellIDs()[index][0]; drag = vector(0,0,0); dragExplicit = vector(0,0,0); Ufluid =vector(0,0,0); if (cellI > -1) // particle Found { if(forceSubM(0).interpolation()) { position = particleCloud_.position(index); voidfraction = voidfractionInterpolator_.interpolate(position,cellI); Ufluid = UInterpolator_.interpolate(position,cellI); }else { voidfraction = voidfraction_[cellI]; Ufluid = U_[cellI]; } Us = particleCloud_.velocity(index); Ur = Ufluid-Us; ds = 2*particleCloud_.radius(index); nuf = nufField[cellI]; rho = rhoField[cellI]; magUr = mag(Ur); Rep = 0; Cd = 0; dragCoefficient = 0; if (magUr > 0) { // calc particle Re Nr Rep = ds/scaleDia_*voidfraction*magUr/(nuf+SMALL); // calc fluid drag Coeff Cd = sqr(0.63 + 4.8/sqrt(Rep)); // calc model coefficient Xi scalar Xi = 3.7 - 0.65 * exp(-sqr(1.5-log10(Rep))/2); // calc particle's drag dragCoefficient = 0.125*Cd*rho *M_PI *ds*ds *scaleDia_ *pow(voidfraction,(2-Xi))*magUr *scaleDrag_; if (modelType_=="B") dragCoefficient /= voidfraction; drag = dragCoefficient*Ur; //total drag force! forceSubM(0).explicitCorr(drag,dragExplicit,dragCoefficient,Ufluid,U_[cellI],Us,UsField_[cellI],forceSubM(0).verbose(),index); } if(forceSubM(0).verbose() && index >-1 && index <102) { Pout << "index = " << index << endl; Pout << "scaleDrag_ = " << scaleDrag_ << endl; Pout << "Us = " << Us << endl; Pout << "Ur = " << Ur << endl; Pout << "ds/scale = " << ds/scaleDia_ << endl; Pout << "rho = " << rho << endl; Pout << "nuf = " << nuf << endl; Pout << "voidfraction = " << voidfraction << endl; Pout << "Rep = " << Rep << endl; Pout << "Cd = " << Cd << endl; Pout << "drag (total) = " << 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(Cd); sValues.append(voidfraction); particleCloud_.probeM().writeProbe(index, sValues, vValues); } } // write particle based data to global array forceSubM(0).partToArray(index,drag,dragExplicit,Ufluid,dragCoefficient); } }
// acceleration of free-fall, standard inline quantity g_sub_n() { return Rep( 9.80665L ) * meter() / square( second() ); }
void DiFeliceDrag::setForce() const { // 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 Cd(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); if (cellI > -1) // particle Found { if(interpolation_) { position = particleCloud_.position(index); voidfraction = voidfractionInterpolator_.interpolate(position,cellI); Ufluid = UInterpolator_.interpolate(position,cellI); }else { voidfraction = voidfraction_[cellI]; Ufluid = U_[cellI]; } Us = particleCloud_.velocity(index); Ur = Ufluid-Us; ds = 2*particleCloud_.radius(index); nuf = nufField[cellI]; rho = rho_[cellI]; magUr = mag(Ur); Rep = 0; Cd = 0; if (magUr > 0) { // calc particle Re Nr Rep = ds*voidfraction*magUr/(nuf+SMALL); // calc fluid drag Coeff Cd = sqr(0.63 + 4.8/sqrt(Rep)); // calc model coefficient Xi scalar Xi = 3.7 - 0.65 * exp(-sqr(1.5-log10(Rep))/2); // calc particle's drag drag = 0.125*Cd*rho*M_PI*ds*ds*pow(voidfraction,(2-Xi))*magUr*Ur; if (modelType_=="B") drag /= voidfraction; } if(verbose_ && index >100 && index <102) { Pout << "index = " << index << endl; Pout << "Us = " << Us << endl; Pout << "Ur = " << Ur << endl; Pout << "ds = " << ds << endl; Pout << "rho = " << rho << endl; Pout << "nuf = " << nuf << endl; Pout << "voidfraction = " << voidfraction << endl; Pout << "Rep = " << Rep << endl; Pout << "Cd = " << Cd << 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(Cd); 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]; for(int j=0;j<3;j++) DEMForces()[index][j] += drag[j]; } //} }
// electronvolt inline quantity eV() { return Rep( 1.60217733e-19L ) * joule(); }
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]; } //} } }
// Planck constant inline quantity h() { return Rep( 6.62606876e-34L ) * joule() * second(); }
MD2Model::MD2Model( const string &f ): rep( d_new Rep( f ) ), anim_mode(0),anim_time(0), render_a(0),render_b(0),render_t(0),trans_verts(0){ }
// unified atomic mass unit inline quantity u() { return Rep( 1.6605402e-27L ) * kilogram(); }
void DiFeliceDrag::setForce() const { if (scaleDia_ > 1) Info << "DiFeliceDrag using scale = " << scaleDia_ << endl; else if (particleCloud_.cg() > 1){ scaleDia_=particleCloud_.cg(); Info << "DiFeliceDrag 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 Cd(0); vector UfluidFluct(0,0,0); vector UsFluct(0,0,0); vector dragExplicit(0,0,0); scalar dragCoefficient(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); if (cellI > -1) // particle Found { if(interpolation_) { position = particleCloud_.position(index); voidfraction = voidfractionInterpolator_.interpolate(position,cellI); Ufluid = UInterpolator_.interpolate(position,cellI); }else { voidfraction = voidfraction_[cellI]; Ufluid = U_[cellI]; } Us = particleCloud_.velocity(index); Ur = Ufluid-Us; ds = 2*particleCloud_.radius(index); nuf = nufField[cellI]; rho = rho_[cellI]; magUr = mag(Ur); Rep = 0; Cd = 0; dragCoefficient = 0; if (magUr > 0) { // calc particle Re Nr Rep = ds/scaleDia_*voidfraction*magUr/(nuf+SMALL); // calc fluid drag Coeff Cd = sqr(0.63 + 4.8/sqrt(Rep)); // calc model coefficient Xi scalar Xi = 3.7 - 0.65 * exp(-sqr(1.5-log10(Rep))/2); // calc particle's drag dragCoefficient = 0.125*Cd*rho *M_PI *ds*ds *scaleDia_ *pow(voidfraction,(2-Xi))*magUr *scaleDrag_; if (modelType_=="B") dragCoefficient /= voidfraction; drag = dragCoefficient*Ur; //total drag force! //Split forces if(splitImplicitExplicit_) { UfluidFluct = Ufluid - U_[cellI]; UsFluct = Us - UsField_[cellI]; dragExplicit = dragCoefficient*(UfluidFluct - UsFluct); //explicit part of force } } if(verbose_ && index >-1 && index <102) { Pout << "index = " << index << endl; Pout << "Us = " << Us << endl; Pout << "Ur = " << Ur << endl; Pout << "ds/scale = " << ds/scaleDia_ << endl; Pout << "rho = " << rho << endl; Pout << "nuf = " << nuf << endl; Pout << "voidfraction = " << voidfraction << endl; Pout << "Rep = " << Rep << endl; Pout << "Cd = " << Cd << endl; Pout << "drag (total) = " << drag << endl; if(splitImplicitExplicit_) { Pout << "UfluidFluct = " << UfluidFluct << endl; Pout << "UsFluct = " << UsFluct << endl; Pout << "dragExplicit = " << dragExplicit << 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(Cd); 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 //implicit treatment, taking explicit force contribution into account { for(int j=0;j<3;j++) { impForces()[index][j] += drag[j] - dragExplicit[j]; //only consider implicit part! expForces()[index][j] += dragExplicit[j]; } } for(int j=0;j<3;j++) DEMForces()[index][j] += drag[j]; } //} }