/***************************************************************************** File Name : "Drag Force.c" Contents : Drag force calculus. : Converted & optimized from Chingis Omarov Fortran code. Coded by : Taras Panamarev, : Denis Yurin, Maxim Makukov & Peter Berczik :-) Last redaction : 2012-11-15 15:33 *****************************************************************************/ // main parameters const double Md = 0.01; const double s=4, beta_s=0.7, alpha=0.75, h=0.001; const double r_lim2=(0.5*0.5), h_lim2=(5e-3*5e-3); const double gradP_rho = 0.90; // account for -grad(P)/rho in gas disk... const double Qtot = 0.01; // 16e3 /* const double Qtot = 0.00547000; // 8e3 const double Qtot = 0.00296975; // 16e3 const double Qtot = 0.00193372; // 32e3 const double Qtot = 0.00054215; // 128KB */ int K; double RDISC, //projection of radius vector to the disc plane h_z, // disc profile RDISC2, Z2, RDISC_3over2, R, RR0, RR02, RR0_s, RDISC_5over2, R_zeta, R0_zeta, RRcrit, RRcrit_zeta,Rcrit_zeta, R_zetaR, inner_hole, temp, sqrt_m_bh, pot_drag, sigma0, R02, hR02, Rcrit, R0, zeta, R_DOT, //the first derivative of absolute value of projection COEFDENS, RHO, RHODOT, //disc density and it's firs derivative with respect to time VXDISC, VYDISC,//disc particle velocity components VXRE, VYRE, VZRE, VRE,//the absolute value of relative (star-disc) velocity and it's components coef, FDRAGX, FDRAGY, FDRAGZ,//drag force components DVXRE, DVYRE, DVZRE, DVRE,//first derivative of relative velocity and it's absolute value KFDOT; void init_drag_force() { R0 = R_0; Rcrit = R_CRIT; sigma0 = (2-alpha)*Md/(TWOPi*sqrt_TWOPi*h*R0); R02 = SQR(R0); hR02 = SQR(h*R0); } void calc_drag_force() { if (min_t < t_diss_on) return; // if (min_t == t_diss_on) init_drag_force(); init_drag_force(); for (i=0; i