Пример #1
0
void GidaspowDrag::setForce() const
{
    // get viscosity field
    #ifdef comp
        const volScalarField nufField = particleCloud_.turbulence().mu() / rho_;
    #else
        const volScalarField& nufField = particleCloud_.turbulence().nu();
    #endif

    for(int index = 0;index <  particleCloud_.numberOfParticles(); ++index)
    {
        //if(mask[index][0])
        //{
            vector drag(0,0,0);
            label cellI = particleCloud_.cellIDs()[index][0];

            if (cellI > -1) // particle Found
            {
                vector Us = particleCloud_.velocity(index);
                vector Ur = U_[cellI]-Us;
                scalar magUr = mag(Ur);
                scalar ds = 2*particleCloud_.radius(index);
                scalar voidfraction = particleCloud_.voidfraction(index);
                scalar rho = rho_[cellI];
                scalar nuf = nufField[cellI];
                scalar CdMagUrLag=0;//Cd of the very particle
                scalar KslLag;      //momentum exchange of the very particle

                if(voidfraction > 0.8) //dilute
                {
                    CdMagUrLag = (24.0*nuf/(ds*voidfraction))
                                 *(scalar(1)+0.15*Foam::pow(ds*voidfraction*magUr/nuf, 0.687));
                    KslLag = 0.75*((1-voidfraction)*rho*voidfraction*CdMagUrLag
                                /(ds*Foam::pow(voidfraction,2.65)));
                }
                else  //dense
                {
                    KslLag = (150*Foam::pow(1-voidfraction,2)*nuf*rho)/
                             (voidfraction*ds*ds+SMALL)
                            +
                             (1.75*(1-voidfraction) * magUr * rho)/
                             ((ds));
                }

                //divide by number of particles per unit volume - Enwald (Int J Multiphase Flow, 22, 21-61, pp39
                KslLag /= (particleCloud_.averagingM().UsWeightField()[cellI]/particleCloud_.mesh().V()[cellI]);

                drag = KslLag*Ur;

                if (modelType_=="B")
                    drag /= voidfraction;
            }

            // 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];
        //}// end if mask
    }// end loop particles
}
void noDrag::setForce() const
{
    // Do nothing
    Info << "noDrag::setForce" << endl;
    for(int index = 0;index <  particleCloud_.numberOfParticles(); ++index)
    {
        // set force on particle
        if(!keepCFDForce_)
        {
            if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] = 0.;
            else  for(int j=0;j<3;j++) impForces()[index][j] = 0.;
        }
        if(noDEMForce_)for(int j=0;j<3;j++) DEMForces()[index][j] = 0.;
        
    }
}
Пример #3
0
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 virtualMassForce::setForce() const
{
    reAllocArrays();

    scalar dt = U_.mesh().time().deltaT().value();

    for(int index = 0;index <  particleCloud_.numberOfParticles(); index++)
    {
        //if(mask[index][0])
        //{
            vector virtualMassForce(0,0,0);
            label cellI = particleCloud_.cellIDs()[index][0];

            if (cellI > -1) // particle Found
            {
                vector Us = particleCloud_.velocity(index);
                vector Ur = U_[cellI]-Us;
                vector UrelOld;
                for(int j=0;j<3;j++)
                {
                    UrelOld[j] = UrelOld_[index][j];
                    UrelOld_[index][j] = Ur[j];
                }

                vector ddtUrel = (Ur-UrelOld)/dt;
                scalar ds = 2*particleCloud_.radius(index);
                scalar Vs = ds*ds*ds*M_PI/6;
                scalar rho = rho_[cellI];

                virtualMassForce = 0.5 * rho * Vs * ddtUrel;

            }
            // set force on particle
            if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] += virtualMassForce[j];
            else  for(int j=0;j<3;j++) impForces()[index][j] += virtualMassForce[j];
            for(int j=0;j<3;j++) DEMForces()[index][j] += virtualMassForce[j];
        //}
    }

}
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 gradPForce::setForce() const
{
    volVectorField gradPField = fvc::grad(p_);
    /*if (useU_)
    {
        // const volScalarField& voidfraction_ = particleCloud_.mesh().lookupObject<volScalarField> ("voidfraction");
        volScalarField U2 = U_&U_;// *voidfraction_*voidfraction_;
        if (useRho_)
            gradPField = fvc::grad(0.5*U2);
        else
            gradPField = fvc::grad(0.5*rho_*U2);
    }*/
    vector gradP;
    scalar ds;
    scalar Vs;
    scalar rho;
    vector position;
    vector force;
    label cellI;

    interpolationCellPoint<vector> gradPInterpolator_(gradPField);

    #include "setupProbeModel.H"

    for(int index = 0;index <  particleCloud_.numberOfParticles(); index++)
    {
        //if(mask[index][0])
        //{
            force=vector(0,0,0);
            cellI = particleCloud_.cellIDs()[index][0];

            if (cellI > -1) // particle Found
            {
                position = particleCloud_.position(index);

                if(interpolation_) // use intepolated values for alpha (normally off!!!)
                {
                    gradP = gradPInterpolator_.interpolate(position,cellI);
                }else
                {
                    gradP = gradPField[cellI];
                }

                ds = 2*particleCloud_.radius(index);
                Vs = ds*ds*ds*M_PI/6;
                rho = rho_[cellI];

                // calc particle's pressure gradient force
                if (useRho_)
                    force = -Vs*gradP*rho*(1.0+addedMassCoeff_);
                else
                    force = -Vs*gradP*(1.0+addedMassCoeff_);

                if(verbose_ && index >=0 && index <2)
                {
                    Info << "index = " << index << endl;
                    Info << "gradP = " << gradP << endl;
                    Info << "force = " << force << endl;
                }

                //Set value fields and write the probe
                if(probeIt_)
                {
                    #include "setupProbeModelfields.H"
                    vValues.append(force);           //first entry must the be the force
                    sValues.append(Vs);
                    sValues.append(rho);
                    particleCloud_.probeM().writeProbe(index, sValues, vValues);
                }
            }

            // set force on particle
            if(!treatDEM_){
                if(!treatExplicit_) for(int j=0;j<3;j++) impForces()[index][j] += force[j];
                else  for(int j=0;j<3;j++) expForces()[index][j] += force[j];
            }
            for(int j=0;j<3;j++) DEMForces()[index][j] += force[j];

        //}
    }
}
Пример #7
0
void SchillerNaumannDrag::setForce() const
{
    // get viscosity field
    #ifdef comp
        const volScalarField nufField = particleCloud_.turbulence().mu() / rho_;
    #else
        const volScalarField& nufField = particleCloud_.turbulence().nu();
    #endif

    #include "setupProbeModel.H"

    for(int index = 0;index <  particleCloud_.numberOfParticles(); index++)
    {
        //if(mask[index][0])
        //{
            vector drag(0,0,0);
            vector Uturb(0,0,0);
            vector position(0,0,0);
            label cellI = particleCloud_.cellIDs()[index][0];

            if (cellI > -1) // particle Found
            {
                //NP note: one could add pointInterpolated values instead of cell centered
                vector Us = particleCloud_.velocity(index);
                vector Ur = U_[cellI]-Us;
                position     = particleCloud_.position(index);
                
                
                //accounting for turbulent dispersion
                if(particleCloud_.dispersionM().isActive())
                {
                    Uturb=particleCloud_.fluidTurbVel(index);
                    Ur=(U_[cellI]+Uturb)-Us;                                        
                }
                
                
                scalar ds = 2*particleCloud_.radius(index);
                scalar nuf = nufField[cellI];
                scalar rho = rho_[cellI];
                scalar voidfraction = particleCloud_.voidfraction(index);
                scalar magUr = mag(Ur);
                scalar Rep = 0;
                scalar Cd = 0;                
                
                if (magUr > 0)
                {
                   // calc particle Re Nr
                    Rep = ds*magUr/nuf;

                    // calc fluid drag Coeff
                    Cd = max(0.44,24.0/Rep*(1.0+0.15*pow(Rep,0.687)));

                    // calc particle's drag
                    drag = 0.125*Cd*rho*M_PI*ds*ds*magUr*Ur;

                    if (modelType_=="B")
                        drag /= voidfraction;
                }

                if(verbose_ && index >=0 && index <1)
                {
                    Pout << " "<< endl;
                    Pout << "SchillerNaumannDrag drag force verbose: "  << endl;
                    
                    Info << "index = " << index << endl;
                    Pout << "position = " << position << endl;
                    Pout << "Ufluid = " << U_[cellI] << endl; 
                    Pout << "Uturb = " << Uturb << endl; 
                    Pout << "Us = " << Us << endl; 
                    
                    Info << "Ur = " << Ur << endl;
                    Info << "ds = " << ds << endl;
                    Info << "rho = " << rho << endl;
                    Info << "nuf = " << nuf << endl;
                    Info << "voidfraction = " << voidfraction << endl;
                    Info << "Rep = " << Rep << endl;
                    Info << "Cd = " << Cd << endl;
                    Info << "drag = " << drag << 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(Cd);
                    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];
        //}
    }

}
Пример #8
0
void brownianForce::setForce() const
{
    // get viscosity field
    #ifdef comp
        const volScalarField nufField = particleCloud_.turbulence().mu() / rho_;
    #else
        const volScalarField& nufField = particleCloud_.turbulence().nu();
    #endif

    vector force(0,0,0);
    scalar dp=0;    
    scalar alpha=0;
    scalar Cc = 0;    
    
    scalar rhoRatio=0;
    scalar S0=0;
    scalar rho_p=0;
    scalar mass=0;
    scalar Diff_k=0;
    
    //scalar eta=0;
    //const scalar sqrt2 = 1.414213562;//sqrt(2.0);    
    //const scalar sigma = physicoChemical::sigma.value();
    
    const scalar Tc = temperature_;
    const scalar kb=1.38e-23;
        
    scalar f = 0.0;
        
    for(int index = 0;index <  particleCloud_.numberOfParticles(); ++index)
    {
        label cellI = particleCloud_.cellIDs()[index][0];
        
        force=vector::zero;

        if (cellI > -1) // particle Found
        {
            dp = particleCloud_.d(index);
            mass=particleCloud_.mass(index);
            rho_p=mass/(0.523598776*pow3(dp));       //M_PI/6=0.523598776
            alpha = 2.0*lambda_/dp;
            Cc = 1.0 + alpha*(1.257 + 0.4*exp(-1.1/alpha));
            
            //const scalar eta = rndGen_.sample01<scalar>();
            //random number [0;1]
            //const scalar eta = uniform();
            
            rhoRatio = rho_p/rho_[cellI];
            scalar muc = nufField[cellI]*rho_[cellI];
            S0 = 216*muc*kb*Tc/(9.869604401*pow5(dp)*sqr(rhoRatio)*Cc);     //9.869604401=sqr(M_PI)
                                                   
            f = sqrt(M_PI*S0/dt_);
                        
            for(int j=0;j<3;j++)
            {
                //const scalar x = rndGen_.sample01<scalar>();
                //const scalar x = (scalar)random()/INT_MAX;
                
                //const scalar eta = sqrt2*erfInv(2*x - 1.0);
                //const scalar eta = gaussian();
                //Info<<"++++++"<<eta<<endl;
                
                //value.Su()[i] = mass*f*eta;
                DEMForces()[index][j] += mass*f*gaussian();
            }
            
            if(verbose_ && index >=0 && index <1)
            {
                Diff_k=(kb*Tc*Cc)/(2*M_PI*muc*dp);                
                
                Pout << " "<< endl;
                Pout << "Brownian force verbose: "  << endl;

                Pout << "index = " << index << endl;
                Pout << "cellI = " << cellI << endl;
                Pout << "dt = " << dt_ << endl;
                

                Pout << "muf = " << muc << endl;
                Pout << "nuf = " << nufField[cellI] << endl;
                
                Pout << "dp = " << dp << endl;
                Pout << "mass = " << mass << endl;
                Pout << "rhop = " << rho_p << endl;
                Pout << "phof = " << rho_[cellI] << endl;
                Pout << "rhoRatio = " << rhoRatio << endl;
                
                //Pout << "sigma = " << sigma << endl;
                Pout << "kb = " << kb << endl;
                Pout << "Tf = " << Tc << endl;
                Pout << "lambda = " << lambda_ << endl;
                Pout << "Diff_k = " << Diff_k << endl;
                Pout << "Cc = " << Cc << endl;
                                                
                Pout << "Force = (" << DEMForces()[index][0]<<" "<<DEMForces()[index][1]<<" "<<DEMForces()[index][2]<<")"<< endl;
                
                //TODO TRY to display forces like below
                //Pout << "UTurb = " << particleCloud_.fluidTurbVel(index)<< endl;
                
                
                /*Pout << "Fx = " << DEMForces()[index][0] << endl;
                Pout << "Fy = " << DEMForces()[index][1] << endl;
                Pout << "Fz = " << DEMForces()[index][2] << endl;*/                
                
                Pout << " "<< endl;
            }
                                    
            /*
            if(twoDimensional_)
            {                
                force = M_PI*pow(radius,2)*part_density_*g_.value();
            }
            else
            {
                force = 1.333*part_density_*M_PI*pow(radius,3)*g_.value();
            }*/
        }
    }
}
Пример #9
0
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
}
Пример #10
0
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];
        }
    //}
}
Пример #11
0
void viscForce::setForce() const
{

    // get viscosity field
#ifdef comp
    const volScalarField& mufField = particleCloud_.turbulence().mu();

    // calc div(Tau)
    volVectorField divTauField =
        - fvc::laplacian(mufField, U_)
        - fvc::div(mufField*dev(fvc::grad(U_)().T()));
#else
    const volScalarField& nufField = particleCloud_.turbulence().nu();

    // calc div(Tau)
    volVectorField divTauField =
        - fvc::laplacian(nufField*rho_, U_)
        - fvc::div(nufField*rho_*dev(fvc::grad(U_)().T()));
#endif

    vector divTau;
    scalar ds;
    scalar Vs;
    vector position;
    vector force;
    label cellI;

    interpolationCellPoint<vector> divTauInterpolator_(divTauField);


    for(int index = 0; index <  particleCloud_.numberOfParticles(); index++)
    {
        //if(mask[index][0])
        //{
        force=vector(0,0,0);
        cellI = particleCloud_.cellIDs()[index][0];

        if (cellI > -1) // particle Found
        {

            position = particleCloud_.position(index);

            if(interpolation_) // use intepolated values for alpha (normally off!!!)
            {
                divTau = divTauInterpolator_.interpolate(position,cellI);
            } else
            {
                divTau = divTauField[cellI];
            }

            ds = 2*particleCloud_.radius(index);
            Vs = ds*ds*ds*M_PI/6;

            // calc particle's pressure gradient force
            force = -Vs*divTau;

            if(verbose_ && index >0 && index <2)
            {
                Info << "index = " << index << endl;
                Info << "gradP = " << divTau << endl;
                Info << "force = " << force << endl;
            }
        }

        // set force on particle
        if(!treatDEM_) {
            if(!treatExplicit_) for(int j=0; j<3; j++) impForces()[index][j] += force[j];
            else  for(int j=0; j<3; j++) expForces()[index][j] += force[j];
        }
        for(int j=0; j<3; j++) DEMForces()[index][j] += force[j];

        //}
    }
}
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];
        }
    //}
}
Пример #13
0
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];
            }

        //}
    }
}