UDF for Herschel-Bulkley viscosity with spatial dependence.
Spatial dependence to Herschel-Bulkley viscosity model Spatial dependency needs to be added by user... very straighforward to implement. #include "udf.h" DEFINE_PROPERTY(my_herschel_bulkley,c,t) { /* * mu = [tau0 + k*(S_dot^n - (tau0/mu0)^n)]/S_dot ; S_dot > tau0/mu0 * mu = mu0; ; S_dot < tau0/mu0 * */ real mu,mu0,k,n,tau0,S_dot,S_crit; real NV_VEC(cell_position); /* Get cell centroid location: cell_position[0] = x cell_position[1] = y cell_position[2] = z in 3D only */ C_CENTROID(cell_position,c,t); /* H-B Coefficients... will need to multiply them by cell_position[?] */ tau0 = 1.0; k = 1.0; n = 1.0; mu0 = 1.0; /* Strain rate */ S_dot = Cell_Strain_Rate_Mag(c,t); S_crit = MAX(tau0, 1.0E-10) / MAX(mu0, 1.0E-10); /* H-B equation */ if (S_dot <= S_crit) mu = mu0; else mu = (tau0 + k*(pow(S_dot, n) - pow(S_crit, n)))/S_dot; /* CX_Message("Sdot is %10.3en", S_dot); CX_Message("Viscosity is %10.3en", mu); */ return mu; } |
||
![]()
|