User: zetienne Date: 2014/04/15 03:47 PM
Modified: /trunk/src/ driver_conserv_to_prims.C, enforce_limits_on_primitives_and_recompute_conservs_INLINED.h, harm_primitives_lowlevel.C, harm_u2p_util.c, harm_utoprim_2d.c, reconstruct_set_of_prims_PPM.C
Log: Remove some harmless compile warnings (uninitialized variables, set-but-unused variables, etc)
File Changes:
Directory: /trunk/src/ ======================
File [modified]: driver_conserv_to_prims.C Delta lines: +1 -1 =================================================================== --- trunk/src/driver_conserv_to_prims.C 2014-04-02 03:29:00 UTC (rev 23) +++ trunk/src/driver_conserv_to_prims.C 2014-04-15 20:47:43 UTC (rev 24) @@ -352,7 +352,7 @@ useconds = end.tv_usec - start.tv_usec;
mtime = ((seconds) * 1000 + useconds/1000.0) + 0.999; // We add 0.999 since mtime is a long int; this rounds up the result before setting the value. Here, rounding down is incorrect. - printf("Pointcount: %d Font fixes: %d VL: %d Failures: %d, InHoriz: %d / %d = %.3e\t%f solutions/second, Error: %e, ErrDenom: %.15e, rho*fixes: %d Lev: %d\n", + printf("Pointcount: %d Font fixes: %d VL: %d Failures: %d, InHoriz: %d / %d = %.3e\t%.2f solutions/second, Error: %e, ErrDenom: %.15e, rho*fixes: %d Lev: %d\n", pointcount,font_fixes,vel_limited_ptcount, failures, failures_inhoriz,pointcount_inhoriz,failures_inhoriz/((double)pointcount_inhoriz+1e-10),
File [modified]: enforce_limits_on_primitives_and_recompute_conservs_INLINED.h Delta lines: +0 -2 =================================================================== --- trunk/src/enforce_limits_on_primitives_and_recompute_conservs_INLINED.h 2014-04-02 03:29:00 UTC (rev 23) +++ trunk/src/enforce_limits_on_primitives_and_recompute_conservs_INLINED.h 2014-04-15 20:47:43 UTC (rev 24) @@ -120,8 +120,6 @@ // Compute T_{\mu \nu} count=0; for(int ii=0;ii<4;ii++) for(int jj=ii;jj<4;jj++) { TDNMUNU[count] = rho0_h_plus_b2*uDN[ii]*uDN[jj] + P_plus_half_b2*g4dn[ii][jj] - smallb_lower[SMALLBT+ii]*smallb_lower[SMALLBT+jj]; count++; }
- int flag=0; - // Finally, compute conservatives: CONSERVS[RHOSTAR] = alpha_sqrt_gamma * U[RHOB] * uUP[0]; CONSERVS[STILDEX] = CONSERVS[RHOSTAR]*h_enthalpy*uDN[1] + alpha_sqrt_gamma*(uUP[0]*smallb[SMALLB2]*uDN[1] - smallb[SMALLBT]*smallb_lower[SMALLBX]);
File [modified]: harm_primitives_lowlevel.C Delta lines: +2 -2 =================================================================== --- trunk/src/harm_primitives_lowlevel.C 2014-04-02 03:29:00 UTC (rev 23) +++ trunk/src/harm_primitives_lowlevel.C 2014-04-15 20:47:43 UTC (rev 24) @@ -169,7 +169,7 @@ int font_fix_applied=0; if(check!=0) { font_fix_applied=1; - double u_xl, u_yl, u_zl, rhob; + double u_xl, u_yl, u_zl; if (gamma_equals2==1) { check = font_fix_gamma_equals2(u_xl,u_yl,u_zl,CONSERVS,PRIMS,METRIC_PHYS,METRIC_LAP_PSI4,eos); } else { @@ -181,7 +181,7 @@ prim[UTCON3] = METRIC_PHYS[GUPXZ]*u_xl + METRIC_PHYS[GUPYZ]*u_yl + METRIC_PHYS[GUPZZ]*u_zl; if (check==1) { printf("Font fix failed!\n"); - printf("i,j,k = %d %d %d, x,y,z = %e %e %e , st_i = %e %e %e, rhostar = %e, Bi = %e %e %e, gij = %e %e %e %e %e %e, Psi6 = %e\n",i,j,k,X[index],Y[index],Z[index],index,mhd_st_x_orig,mhd_st_y_orig,mhd_st_z_orig,rho_star_orig,PRIMS[BX_CENTER],PRIMS[BY_CENTER],PRIMS[BZ_CENTER],METRIC_PHYS[GXX],METRIC_PHYS[GXY],METRIC_PHYS[GXZ],METRIC_PHYS[GYY],METRIC_PHYS[GYZ],METRIC_PHYS[GZZ],METRIC_LAP_PSI4[PSI6]); + printf("i,j,k = %d %d %d, x,y,z = %e %e %e , index=%d st_i = %e %e %e, rhostar = %e, Bi = %e %e %e, gij = %e %e %e %e %e %e, Psi6 = %e\n",i,j,k,X[index],Y[index],Z[index],index,mhd_st_x_orig,mhd_st_y_orig,mhd_st_z_orig,rho_star_orig,PRIMS[BX_CENTER],PRIMS[BY_CENTER],PRIMS[BZ_CENTER],METRIC_PHYS[GXX],METRIC_PHYS[GXY],METRIC_PHYS[GXZ],METRIC_PHYS[GYY],METRIC_PHYS[GYZ],METRIC_PHYS[GZZ],METRIC_LAP_PSI4[PSI6]); } } stats.font_fixed=font_fix_applied;
File [modified]: harm_u2p_util.c Delta lines: +2 -23 =================================================================== --- trunk/src/harm_u2p_util.c 2014-04-02 03:29:00 UTC (rev 23) +++ trunk/src/harm_u2p_util.c 2014-04-15 20:47:43 UTC (rev 24) @@ -41,7 +41,6 @@
/********************************************************************** -/****************************************************************** primtoU_g():
-- calculates the conserved variables from the primitive variables @@ -66,7 +65,7 @@ FTYPE gdet, /* sqrt of -1 times det(g_{\mu \nu}) */ FTYPE U[NPR] /* matrix of derivatives */ ) { - int i,j ; + int i ; FTYPE rho0 ; static FTYPE ucon[NDIM],ucov[NDIM],bcon[NDIM],bcov[NDIM],ncov[NDIM] ; FTYPE gamma,n_dot_b,bsq,u,p,w, alpha ; @@ -118,8 +117,6 @@ }
/********************************************************************** -/****************************************************************** - ucon_calc_g():
-- calculates the contravariant (up) components of the four-velocity @@ -143,7 +140,7 @@ FTYPE u_tilde_con[4] ; FTYPE u_tilde_sq ; FTYPE gamma,lapse ; - int i,j ; + int i,j; u_tilde_con[0] = 0. ; u_tilde_con[1] = prim[UTCON1] ; @@ -166,13 +163,10 @@ }
/********************************************************************** -/****************************************************************** - raise_g():
-- calculates the contravariant form of a covariant tensor, using the inverse of the metric; - ******************************************************************/ void raise_g(FTYPE vcov[NDIM], FTYPE gcon[NDIM][NDIM], FTYPE vcon[NDIM]) { @@ -188,13 +182,10 @@ }
/********************************************************************** -/****************************************************************** - lower_g():
-- calculates the ocvariant form of a contravariant tensor using the metric; - ******************************************************************/ void lower_g(FTYPE vcon[NDIM], FTYPE gcov[NDIM][NDIM], FTYPE vcov[NDIM]) { @@ -210,15 +201,12 @@ }
/********************************************************************** -/****************************************************************** - ncov_calc():
-- calculates the covariant form of the normal vector to our spacelike hypersurfaces ala the ADM formalism.
-- requires the inverse metric; - ******************************************************************/ void ncov_calc(FTYPE gcon[NDIM][NDIM],FTYPE ncov[NDIM]) { @@ -236,8 +224,6 @@ }
/********************************************************************** -/****************************************************************** - bcon_calc_g():
-- using the primitive variables, contra-/co-variant 4-vel., @@ -249,8 +235,6 @@ P = | uu | | \tilde{u}^i | \ B^i / - - ******************************************************************/ void bcon_calc_g(FTYPE prim[NPR],FTYPE ucon[NDIM],FTYPE ucov[NDIM], FTYPE ncov[NDIM],FTYPE bcon[NDIM]) @@ -273,8 +257,6 @@
/********************************************************************** -/****************************************************************** - gamma_calc_g():
-- using the primitive variables, contra-/co-variant 4-vel., @@ -287,12 +269,10 @@ P = | uu | | \tilde{u}^i | \ B^i / - ******************************************************************/ int gamma_calc_g(FTYPE *pr, FTYPE gcov[NDIM][NDIM], FTYPE *gamma) { FTYPE utsq ; - int j,k;
utsq = gcov[1][1]*pr[UTCON1]*pr[UTCON1] + gcov[2][2]*pr[UTCON2]*pr[UTCON2] @@ -315,7 +295,6 @@
/************************************************** -/************************************************** The following functions assume a Gamma-law EOS: ***************************************************/
File [modified]: harm_utoprim_2d.c Delta lines: +7 -14 =================================================================== --- trunk/src/harm_utoprim_2d.c 2014-04-02 03:29:00 UTC (rev 23) +++ trunk/src/harm_utoprim_2d.c 2014-04-15 20:47:43 UTC (rev 24) @@ -117,8 +117,8 @@ FTYPE gdet, FTYPE prim[NPR]) {
- FTYPE U_tmp[NPR], U_tmp2[NPR], prim_tmp[NPR]; - int i, j, ret; + FTYPE U_tmp[NPR], prim_tmp[NPR]; + int i, ret; FTYPE alpha;
@@ -216,14 +216,9 @@
FTYPE x_2d[NEWT_DIM]; FTYPE QdotB,Bcon[NDIM],Bcov[NDIM],Qcov[NDIM],Qcon[NDIM],ncov[NDIM],ncon[NDIM],Qsq,Qtcon[NDIM]; - FTYPE rho0,u,p,w,gammasq,gamma,gtmp,W_last,W,utsq,vsq,tmpdiff ; + FTYPE rho0,u,p,w,gammasq,gamma,gtmp,W_last,W,utsq,vsq; int i,j, n, retval, i_increase ;
- //TESTING vv - double P_cold; - //TESTING ^^ - - n = NEWT_DIM ;
// Assume ok initially: @@ -395,7 +390,7 @@
static FTYPE x1_of_x0(FTYPE x0, FTYPE &Bsq, FTYPE &QdotBsq, FTYPE &Qtsq, FTYPE &Qdotn, FTYPE &D ) { - FTYPE x1,vsq; + FTYPE vsq; FTYPE dv = 1.e-15;
vsq = fabs(vsq_calc(x0,Bsq,QdotBsq,Qtsq,Qdotn,D)) ; // guaranteed to be positive @@ -448,8 +443,7 @@ FTYPE f, df, dx[NEWT_DIM], x_old[NEWT_DIM]; FTYPE resid[NEWT_DIM], jac[NEWT_DIM][NEWT_DIM]; FTYPE errx, x_orig[NEWT_DIM]; - int n_iter, id, jd, i_extra, doing_extra; - FTYPE dW,dvsq,vsq_old,vsq,W,W_old; + int n_iter, id, i_extra, doing_extra;
int keep_iterating;
@@ -460,7 +454,6 @@ i_extra = doing_extra = 0; for( id = 0; id < n ; id++) x_old[id] = x_orig[id] = x[id] ;
- vsq_old = vsq = W = W_old = 0.; n_iter = 0;
/* Start the Newton-Raphson iterations : */ @@ -560,7 +553,7 @@ {
- FTYPE W, vsq, Wsq, p_tmp, dPdvsq, dPdW, temp, detJ,tmp2,tmp3; + FTYPE W, vsq, Wsq, p_tmp, dPdvsq, dPdW; FTYPE t11; FTYPE t16; FTYPE t18; @@ -633,7 +626,7 @@ dx[0] = -(t2*t11+t4*t18)*t21*t36; t40 = (vsq+t24)*t3; dx[1] = -(-t25*t11-2.0*t40*t18)*t21*t36; - detJ = t3*t35; + //detJ = t3*t35; // <- set but not used... jac[0][0] = -2.0*t40; jac[0][1] = -t4; jac[1][0] = t25;
File [modified]: reconstruct_set_of_prims_PPM.C Delta lines: +3 -3 =================================================================== --- trunk/src/reconstruct_set_of_prims_PPM.C 2014-04-02 03:29:00 UTC (rev 23) +++ trunk/src/reconstruct_set_of_prims_PPM.C 2014-04-15 20:47:43 UTC (rev 24) @@ -339,11 +339,11 @@ double dP2 = U[PRESSURE][PLUS2] - U[PRESSURE][MINUS2];
// MODIFICATION TO STANDARD PPM: - // Cure roundoff error issues when dP1==0 or dP2==0 to 4 or more significant digits. + // Cure roundoff error issues when dP1==0 or dP2==0 to 7 or more significant digits. double avg1=0.5*(U[PRESSURE][PLUS1] + U[PRESSURE][MINUS1]); double avg2=0.5*(U[PRESSURE][PLUS2] + U[PRESSURE][MINUS2]); - if(fabs(dP1)/avg1<1e-4) dP1=0.0; /* If this is triggered, there is NO shock */ - if(fabs(dP2)/avg2<1e-4) dP2=0.0; /* If this is triggered alone, there may be a shock. Otherwise if triggered with above, NO shock. */ + if(fabs(dP1)/avg1<1e-7) dP1=0.0; /* If this is triggered, there is NO shock */ + if(fabs(dP2)/avg2<1e-7) dP2=0.0; /* If this is triggered alone, there may be a shock. Otherwise if triggered with above, NO shock. */
double dP1_over_dP2=1.0; if (dP2 != 0.0) dP1_over_dP2 = dP1/dP2;
commits@lists.einsteintoolkit.org