6 #include "xtensor-python/pyarray.hpp"
62 const xt::pyarray<double>& uFluid,
63 const xt::pyarray<double>& uSolid,
67 return betaCoeff(sedF, rhoFluid, uFluid.data(), uSolid.data(), nu);
74 const double uFluid[nSpace],
75 const double uSolid[nSpace],
80 for (
int ii=0; ii<nSpace; ii++)
82 du2+= (uFluid[ii] - uSolid[ii])*(uFluid[ii] - uSolid[ii]);
84 double du = sqrt(du2);
90 double Re = (1-sedF)*du*
grain_/nu;
91 double Re_min = 1.0e-3;
94 Cd = 24*(1. + 0.15*pow(fmax(Re_min,Re), 0.687))/fmax(Re_min,Re);
97 double gDrag2 = 0.75 * Cd * du * pow(1. - sedF, -1.65)/
grain_;
112 return (weight*gDrag1 + (1.-weight)*gDrag2)*rhoFluid;
115 inline double gs0(
double sedF)
122 g0 = 0.5*(2.-sedF)/((1-sedF)*(1-sedF)*(1-sedF));
126 g0= 0.853744035/(0.64-sedF);
129 else g0 = 170.74880702;
137 const xt::pyarray<double>& uFluid,
138 const xt::pyarray<double>& uSolid,
139 const xt::pyarray<double>& gradC,
145 const xt::pyarray<double>& g)
166 const double uFluid[nSpace],
167 const double uSolid[nSpace],
168 const double gradC[nSpace],
174 const double g[nSpace])
181 double t_p = rhoSolid/beta;
182 double t_c = l_c/(sqrt(theta_n) +
small_);
183 double t_l = 0.165*kappa_n/(epsilon_n +
small_);
185 double alpha= t_cl/(t_cl + t_p);
186 double term = beta/(rhoFluid*(1.-sedF));
187 double es_1 = 2.*term*(1-alpha)*sedF*kappa_n;
189 for (
int ii=0; ii<nSpace; ii++)
191 g_gradC+= g[ii]*gradC[ii];
194 double ss = rhoSolid/rhoFluid - 1.;
195 double es_2 = nuT_n*ss*g_gradC/
sigmaC_/(1.-sedF) ;
197 return C3e_ * es_1 / kappa_n +
C4e_ * es_2 / kappa_n;
206 const xt::pyarray<double>& uFluid,
207 const xt::pyarray<double>& uSolid,
208 const xt::pyarray<double>& gradC,
214 const xt::pyarray<double>& g)
235 const double uFluid[nSpace],
236 const double uSolid[nSpace],
237 const double gradC[nSpace],
243 const double g[nSpace])
249 double t_p = rhoSolid/beta;
250 double t_c = l_c/(sqrt(theta_n) +
small_);
251 double t_l = 0.165*kappa_n/(epsilon_n +
small_);
253 double alpha= t_cl/(t_cl + t_p);
254 double term = beta/(rhoFluid*(1.-sedF));
255 double es_1 = 2.*term*(1-alpha)*sedF*kappa_n;
257 for (
int ii=0; ii<nSpace; ii++)
259 g_gradC+= g[ii]*gradC[ii];
262 double ss = rhoSolid/rhoFluid - 1.;
263 double es_2 = nuT_n*ss*g_gradC/
sigmaC_/(1.-sedF) ;
273 const xt::pyarray<double>& uFluid,
274 const xt::pyarray<double>& uSolid,
275 const xt::pyarray<double>& gradC,
300 const double uFluid[nSpace],
301 const double uSolid[nSpace],
302 const double gradC[nSpace],
312 double t_p = rhoSolid/beta;
313 double t_c = l_c/(sqrt(theta_n) +
small_);
314 double t_l = 0.165*kappa_n/(epsilon_n +
small_);
316 double alpha= t_cl/(t_cl + t_p);
317 double term = beta/(rhoFluid*(1.-sedF));
318 double es_1 = 2.*term*rhoSolid*(1-alpha)*sedF;
325 inline double psc(
double sedF,
330 double gs_0 =
gs0(sedF);
331 double eRp1 = 1.+
eR_;
332 double psc = rhoSolid * sedF * (1.+2.*eRp1*sedF*gs_0)*theta;
345 return -2.*
psc(sedF,rhoSolid,theta_np1)*(du_dx + dv_dy + dw_dz)/(3.*rhoSolid * sedF);
356 double gs_0 =
gs0(sedF);
357 double eRp1 = 1.+
eR_;
358 double dpsc = rhoSolid * sedF * (1.+2.*eRp1*sedF*gs_0);
359 return -2.*dpsc*(du_dx + dv_dy + dw_dz)/(3.*rhoSolid * sedF);
368 double gs_0 =
gs0(sedF);
369 double sq_pi = (sqrt(M_PI));
370 double sedF2 = sedF * sedF;
371 double eRp1 = 1.+
eR_;
372 double sq_theta = sqrt(theta);
374 double mu_sc = rhoSolid*
grain_*sq_theta*( 0.8*sedF2*gs_0*eRp1/(sq_pi) + (1./15.)*sq_pi*sedF2*gs_0*eRp1 + (1./6.)*sq_pi*sedF + (5./48)*sq_pi/(gs_0*eRp1) );
379 inline double l_sc(
double sedF,
384 double gs_0 =
gs0(sedF);
385 double sq_pi = (sqrt(M_PI));
386 double sedF2 = sedF * sedF;
387 double eRp1 = 1.+
eR_;
388 double sq_theta = sqrt(theta_n);
389 double lambda = (4./3.)*sedF2*rhoSolid*
grain_*gs_0*eRp1*sq_theta/sq_pi;
418 double la =
l_sc(sedF, rhoSolid, theta_n);
419 double mu =
mu_sc(sedF, rhoSolid, theta_n);
422 double divU = du_dx + dv_dy + dw_dz;
423 double t11 = 2*mu*du_dx + (la - (2./3.)*mu)*divU ;
424 double t22 = 2*mu*dv_dy + (la - (2./3.)*mu)*divU ;
425 double t33 = 2*mu*dw_dz + (la - (2./3.)*mu)*divU ;
426 double t13 = mu*(du_dz + dw_dx);
427 double t23 = mu*(dv_dz + dw_dy);
428 double t12 = mu*(du_dy + dv_dx);
431 double term = t11 * du_dx + t22 * dv_dy + t33 * dw_dz;
432 term += t12*(du_dy +dv_dx);
433 term += t13*(du_dz +dw_dx);
434 term += t23*(dv_dz +dw_dy);
436 return term* (2./3.) / (rhoSolid*sedF);
450 double sq_pi = (sqrt(M_PI));
451 double sq_theta = sqrt(theta_n);
452 double divU = du_dx + dv_dy + dw_dz;
466 double sq_pi = (sqrt(M_PI));
467 double sq_theta = sqrt(theta_n);
468 double divU = du_dx + dv_dy + dw_dz;
476 const xt::pyarray<double>& uFluid,
477 const xt::pyarray<double>& uSolid,
497 const double uFluid[nSpace],
498 const double uSolid[nSpace],
508 double t_p = rhoSolid/beta;
509 double t_c = l_c/(sqrt(theta) +
small_);
510 double t_l = 0.165*kappa/(epsilon +
small_);
512 double alpha= t_cl/(t_cl + t_p);
514 double Jint1 = 4. * alpha * beta * kappa /( 3.* rhoSolid) ;
521 const xt::pyarray<double>& uFluid,
522 const xt::pyarray<double>& uSolid,
539 const double uFluid[nSpace],
540 const double uSolid[nSpace],
546 return - 2*beta*theta/rhoSolid;
553 const xt::pyarray<double>& uFluid,
554 const xt::pyarray<double>& uSolid,
568 const double uFluid[nSpace],
569 const double uSolid[nSpace],
574 return - 2*beta/rhoSolid;
583 double gs_0 =
gs0(sedF);
584 double sq_pi = (sqrt(M_PI));
585 double sedF2 = sedF * sedF;
586 double eRp1 = 1.+
eR_;
587 double sq_theta = sqrt(theta);
588 double k_diff = rhoSolid*
grain_*sq_theta*( 2.*sedF2*gs_0*eRp1/(sq_pi) + (0.5625)*sq_pi*sedF2*gs_0*eRp1 + (0.9375)*sq_pi*sedF + (0.390625)*sq_pi/(gs_0*eRp1) );
637 double divU = du_dx + dv_dy + dw_dz;
639 double s11 = du_dx - (1./nSpace)*divU;
640 double s22 = dv_dy - (1./nSpace)*divU;
641 double s33 = dw_dz - (1./nSpace)*divU;
642 double s12 = 0.5*(du_dy + dv_dx);
643 double s13 = 0.5*(du_dz + dw_dx);
644 double s23 = 0.5*(dv_dz + dw_dy);
645 double sumS = s11*s11 + s22*s22 + s33*s33 + 2.*s12*s12 + 2.*s13*s13 + 2.*s23*s23;
713 const xt::pyarray<double>& uFluid_n,
714 const xt::pyarray<double>& uSolid_n,
715 const xt::pyarray<double>& uFluid_np1,
718 const xt::pyarray<double>& gradc
721 auto mint2 = xt::pyarray<double>::from_shape({2});
736 const double uFluid_n[nSpace],
737 const double uSolid_n[nSpace],
738 const double uFluid_np1[nSpace],
741 const double gradc[nSpace]
745 double beta =
betaCoeff(sedF,rhoFluid,uFluid_n,uSolid_n,nu);
746 for (
int ii=0; ii<nSpace; ii++)
748 mint2[ii] = -sedF*beta*(uFluid_np1[ii])/(rhoFluid * (1. - sedF)) ;
755 const xt::pyarray<double>& uFluid_n,
756 const xt::pyarray<double>& uSolid_n,
757 const xt::pyarray<double>& uSolid_np1,
760 const xt::pyarray<double>& gradc
763 auto mint2 = xt::pyarray<double>::from_shape({2});
778 const double uFluid_n[nSpace],
779 const double uSolid_n[nSpace],
780 const double uSolid_np1[nSpace],
783 const double gradc[nSpace]
787 double beta =
betaCoeff(sedF,rhoFluid,uFluid_n,uSolid_n,nu);
788 for (
int ii=0; ii<nSpace; ii++)
790 mint2[ii] = -sedF*beta*(-uSolid_np1[ii])/(rhoFluid * (1. - sedF)) ;
796 const xt::pyarray<double>& uFluid_n,
797 const xt::pyarray<double>& uSolid_n,
800 const xt::pyarray<double>& gradc
804 auto mint2 = xt::pyarray<double>::from_shape({2});
818 const double uFluid_n[nSpace],
819 const double uSolid_n[nSpace],
822 const double gradc[nSpace]
827 double beta =
betaCoeff(sedF,rhoFluid,uFluid_n,uSolid_n,nu);
828 for (
int ii=0; ii<nSpace; ii++)
830 mint2[ii] = - sedF*beta*nuT*gradc[ii]/
sigmaC_/(rhoFluid * (1. - sedF));
841 const xt::pyarray<double>& uFluid_n,
842 const xt::pyarray<double>& uSolid_n,
857 const double uFluid_n[nSpace],
858 const double uSolid_n[nSpace],
863 return -sedF*
betaCoeff(sedF,rhoFluid,uFluid_n,uSolid_n,nu)/(rhoFluid * (1. - sedF));
871 const xt::pyarray<double>& uFluid_n,
872 const xt::pyarray<double>& uSolid_n,
887 const double uFluid_n[nSpace],
888 const double uSolid_n[nSpace],
894 return +sedF*
betaCoeff(sedF,rhoFluid,uFluid_n,uSolid_n,nu)/(rhoFluid * (1. - sedF));
897 inline double p_s(
double sedF,
912 double divU = du_dx + dv_dy + dw_dz;
913 double mf =
mu_fr(sedF, du_dx, du_dy, du_dz, dv_dx, dv_dy, dv_dz, dw_dx, dw_dy, dw_dz);
914 double msc =
mu_sc(sedF, rhoSolid, theta );
915 double lam =
l_sc(sedF, rhoSolid, theta );
916 double pcorr = ( (2./3.)*(msc + mf) - lam ) * divU;
917 return p_friction(sedF) +
psc(sedF, rhoSolid, theta) + pcorr ;