#include #include #include #include "helpers.hh" void nuc_eos_m_kt1_dpdrhoe_dpderho(const int *restrict n_in, const double *restrict rho, double *restrict temp, const double *restrict ye, const double *restrict eps, double *restrict dpdrhoe, double *restrict dpderho, const double *restrict prec, int *restrict keyerr, int *restrict anyerr) { const int n = *n_in; int keyerr2; *anyerr = 0; for(int i=0;i0.0e0) { // this is the standard scenario; eps is larger than zero // and we can operate with logarithmic tables const double lxeps = log(epstot); #if DEBUG fprintf(stderr,"%d %15.6E %15.6E %15.6E %15.6E\n",i,lr,lt,ye[i],lxeps); fprintf(stderr,"%d %15.6E %15.6E %15.6E %15.6E\n",i, exp(lr),exp(lt),ye[i],exp(lxeps)); #endif int xnEOScalls = 0; nuc_eos_findtemp(lr,lt,ye[i],lxeps,*prec, (double *restrict)(<out),&keyerr[i],&xnEOScalls); *nEOScalls += xnEOScalls; } else { // will be overwritten further down, only marks error keyerr[i] = 667; } // epstot > 0.0 if(keyerr[i] != 0) { // now try negative temperature treatment double eps0, eps1; int idx[8]; double delx,dely,delz; get_interp_spots_linT_low_eps(lr,temp1,ye[i],&delx,&dely,&delz,idx); nuc_eos_C_linterp_one_linT_low_eps(idx,delx,dely,delz,&(eps1)); get_interp_spots_linT_low_eps(lr,temp0,ye[i],&delx,&dely,&delz,idx); nuc_eos_C_linterp_one_linT_low_eps(idx,delx,dely,delz,&(eps0)); *nEOScalls += 2; temp[i] = (epstot-eps0) * (temp1-temp0)/(eps1-eps0) + temp0; // set error codes *anyerr = 1; keyerr[i] = 668; // get pressure { const int iv = 0; get_interp_spots_linT_low(lr,temp[i],ye[i],&delx,&dely,&delz,idx); nuc_eos_C_linterp_one_linT_low(idx,delx,dely,delz,&(prs[i]),iv); *nEOScalls += 1; } } else { temp[i] = exp(ltout); int idx[8]; double delx,dely,delz; get_interp_spots(lr,ltout,ye[i],&delx,&dely,&delz,idx); { const int iv = 0; nuc_eos_C_linterp_one(idx,delx,dely,delz,&(prs[i]),iv); *nEOScalls += 1; #if DEBUG printf("update nuc_eos_press: nEOScalls = %i\n", *nEOScalls); #endif } } } // loop i