User: cott Date: 2011/02/06 10:22 AM
Modified: /trunk/ param.ccl /trunk/src/ GRHydro_Con2Prim.F90
Log: * update to hot c2p routine: allow for a failsafe mode that handles off-the-table issues with tabulated EOS.
File Changes:
Directory: /trunk/src/ ======================
File [modified]: GRHydro_Con2Prim.F90 Delta lines: +101 -6 =================================================================== --- trunk/src/GRHydro_Con2Prim.F90 2011-02-05 16:59:37 UTC (rev 213) +++ trunk/src/GRHydro_Con2Prim.F90 2011-02-06 16:22:28 UTC (rev 214) @@ -522,8 +522,10 @@ ! begin EOS Omni vars integer :: n,keytemp,anyerr,keyerr(1) real*8 :: xpress,temp0 + integer :: nfudgemax,nf n=1;keytemp=0;anyerr=0;keyerr(1)=0 temp0 = 0.0d0;xpress = 0.0d0 + nf=0;nfudgemax=10 ! end EOS Omni vars
failinfomode = 1 @@ -567,8 +569,39 @@ write(warnline,"(A7,i8)") "code: ",keyerr(1) call CCTK_WARN(failinfomode,warnline) write(warnline,"(A10,i5)") "reflevel: ", GRHydro_reflevel - call CCTK_WARN(failinfomode,warnline) - call CCTK_WARN(failwarnmode,"Aborting!!!") + if(keyerr(1).eq.667.and.GRHydro_eos_hot_eps_fix.ne.0) then + ! Handling of the case when no new temperature can be + ! found for a given epsilon. The amount of times + ! we get to this place should be monitored, as this + ! 'failsafe' mode creates artificial heat. + nf = 0 + do while(anyerr.ne.0.and.nf.le.nfudgemax) + anyerr = 0 + epsilon = epsilon + abs(epsilon)*0.05d0 + call EOS_Omni_press(handle,keytemp,GRHydro_eos_rf_prec,n,& + rho,epsilon,temp,ye,xpress,keyerr,anyerr) + nf = nf + 1 + enddo + write(warnline,"(A30,i5)") "Iterations of heat injection: ",nf + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(3i5,1P10E15.6)") ii,jj,kk,x,y,z + call CCTK_WARN(failinfomode,warnline) + if(nf.gt.nfudgemax) then + call CCTK_WARN(failinfomode,"EOS error in c2p 1: injected heat too many times") + write(warnline,"(3i5,1P10E15.6)") ii,jj,kk,x,y,z + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(1P10E15.6)") rho,epsilon,temp,ye + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(A7,i8)") "code: ",keyerr(1) + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(A10,i5)") "reflevel: ", GRHydro_reflevel + call CCTK_WARN(failinfomode,warnline) + call CCTK_WARN(failwarnmode,"Aborting!!!") + endif + else + call CCTK_WARN(failinfomode,warnline) + call CCTK_WARN(failwarnmode,"Aborting!!!") + endif endif endif
@@ -611,8 +644,39 @@ write(warnline,"(A7,i8)") "code: ",keyerr(1) call CCTK_WARN(failinfomode,warnline) write(warnline,"(A10,i5)") "reflevel: ", GRHydro_reflevel - call CCTK_WARN(failinfomode,warnline) - call CCTK_WARN(failwarnmode,"Aborting!!!") + if(keyerr(1).eq.667.and.GRHydro_eos_hot_eps_fix.ne.0) then + ! Handling of the case when no new temperature can be + ! found for a given epsilon. The amount of times + ! we get to this place should be monitored, as this + ! 'failsafe' mode creates artificial heat. + nf = 0 + do while(anyerr.ne.0.and.nf.le.nfudgemax) + anyerr = 0 + epsilon = epsilon + abs(epsilon)*0.05d0 + call EOS_Omni_press(handle,keytemp,GRHydro_eos_rf_prec,n,& + rho,epsilon,temp,ye,xpress,keyerr,anyerr) + nf = nf + 1 + enddo + write(warnline,"(A30,i5)") "Iterations of heat injection: ",nf + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(3i5,1P10E15.6)") ii,jj,kk,x,y,z + call CCTK_WARN(failinfomode,warnline) + if(nf.gt.nfudgemax) then + call CCTK_WARN(failinfomode,"EOS error in c2p 1: injected heat too many times") + write(warnline,"(3i5,1P10E15.6)") ii,jj,kk,x,y,z + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(1P10E15.6)") rho,epsilon,temp,ye + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(A7,i8)") "code: ",keyerr(1) + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(A10,i5)") "reflevel: ", GRHydro_reflevel + call CCTK_WARN(failinfomode,warnline) + call CCTK_WARN(failwarnmode,"Aborting!!!") + endif + else + call CCTK_WARN(failinfomode,warnline) + call CCTK_WARN(failwarnmode,"Aborting!!!") + endif endif endif f = pold - xpress @@ -673,8 +737,39 @@ write(warnline,"(A7,i8)") "code: ",keyerr(1) call CCTK_WARN(failinfomode,warnline) write(warnline,"(A10,i5)") "reflevel: ", GRHydro_reflevel - call CCTK_WARN(failinfomode,warnline) - call CCTK_WARN(failwarnmode,"Aborting!!!") + if(keyerr(1).eq.667.and.GRHydro_eos_hot_eps_fix.ne.0) then + ! Handling of the case when no new temperature can be + ! found for a given epsilon. The amount of times + ! we get to this place should be monitored, as this + ! 'failsafe' mode creates artificial heat. + nf = 0 + do while(anyerr.ne.0.and.nf.le.nfudgemax) + anyerr = 0 + epsilon = epsilon + abs(epsilon)*0.05d0 + call EOS_Omni_press(handle,keytemp,GRHydro_eos_rf_prec,n,& + rho,epsilon,temp,ye,xpress,keyerr,anyerr) + nf = nf + 1 + enddo + write(warnline,"(A30,i5)") "Iterations of heat injection: ",nf + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(3i5,1P10E15.6)") ii,jj,kk,x,y,z + call CCTK_WARN(failinfomode,warnline) + if(nf.gt.nfudgemax) then + call CCTK_WARN(failinfomode,"EOS error in c2p 1: injected heat too many times") + write(warnline,"(3i5,1P10E15.6)") ii,jj,kk,x,y,z + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(1P10E15.6)") rho,epsilon,temp,ye + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(A7,i8)") "code: ",keyerr(1) + call CCTK_WARN(failinfomode,warnline) + write(warnline,"(A10,i5)") "reflevel: ", GRHydro_reflevel + call CCTK_WARN(failinfomode,warnline) + call CCTK_WARN(failwarnmode,"Aborting!!!") + endif + else + call CCTK_WARN(failinfomode,warnline) + call CCTK_WARN(failwarnmode,"Aborting!!!") + endif endif endif
Directory: /trunk/ ==================
File [modified]: param.ccl Delta lines: +15 -3 =================================================================== --- trunk/param.ccl 2011-02-05 16:59:37 UTC (rev 213) +++ trunk/param.ccl 2011-02-06 16:22:28 UTC (rev 214) @@ -251,11 +251,23 @@ } "Ideal_Fluid"
-real GRHydro_eos_rf_prec "Precision to which root finding should be carried out" +real GRHydro_eos_rf_prec "Precision to which root finding should be carried out" STEERABLE=ALWAYS { (0.0:* :: "anything larger than 0 goes" } 1.0e-8
+# cott@tapir.caltech.edu: +# The below parameter controls the handling of EOS_Omni keyerr=667 +# failures. In these failures, no new temperature can be found for the +# eps it was called with. This may happen, for example, when a strong +# shock appears for the first time. Code checking this parameter will, +# if it is set to true, locally inject heat to fix the problem. +# This normally happens only very rarely, but one must monitor total energy +# conservation to check that this does ruin energy conservation. +boolean GRHydro_eos_hot_eps_fix "Activate quasi-failsafe mode for hot EOSs" STEERABLE=ALWAYS +{ +} "no" + ####################### Other Parameters ##############################
#Parameters controlling conservative <-> primitive change. @@ -279,12 +291,12 @@ 0: :: "Positive" } 1.e-10
-real GRHydro_perc_ptol "Tolerance for primitive variable solve (percent)" +real GRHydro_perc_ptol "Tolerance for primitive variable solve (percent)" STEERABLE=ALWAYS { 0: :: "Do we really want both tolerances?" } 1.e-8
-real GRHydro_del_ptol "Tolerance for primitive variable solve (absolute)" +real GRHydro_del_ptol "Tolerance for primitive variable solve (absolute)" STEERABLE=ALWAYS { 0: :: "Do we really want both tolerances?" } 1.e-18