HARM
harm and utilities
 All Data Structures Files Functions Variables Typedefs Macros Pages
Data Structures | Macros | Functions | Variables
phys.tools.rad.c File Reference

All locally-related Koral/RAD physics calculations. More...

#include "decs.h"
#include "f2c.h"
#include "stdlib.h"
#include "math.h"
#include "testfpp.P"
Include dependency graph for phys.tools.rad.c:

Go to the source code of this file.

Data Structures

struct  of_method
 
struct  of_refU
 

Macros

#define MYEXTERN   extern
 
#define PLOOPDYNAMICAL(pliter, pl)   PLOOP(pliter,pl) if(SCALARPL(pl)==0)
 
#define AVOIDTAUFORFLOOR   (1)
 
#define COURRADEXPLICIT   (0.1)
 
#define IMPTRYCONVHIGHTAU   (NUMEPSILON*5.0)
 
#define IMPTRYCONV   (1.e-12)
 Funny, even 1E-5 does ok with torus, no worse at Erf~ERADLIMIT instances. Also, does ~3 iterations, but not any faster than using 1E-12 with ~6 iterations. More...
 
#define IMPTRYCONVQUICK   (1.e-6)
 
#define ITERATIONMARGINAL2   (4)
 
#define IMPTRYCONVMARGINAL2   (1.e-6)
 
#define IMPTRYCONVMARGINAL   (1.e-6)
 
#define IMPTRYCONVSUPERQUICK   (1.e-3)
 
#define IMPTRYCONVABS   ((FTYPE)(NDIM+2)*trueimptryconv)
 error for comparing to sum over all absolute errors More...
 
#define IMPALLOWCONVCONST   (1.e-5)
 what tolerance to use for saying can switch to entropy when u_g is suggested to be bad for energy More...
 
#define IMPOKCONVCONST   (1E-6)
 
#define IMPOKCONVCONSTABS   ((FTYPE)(NDIM+2)*IMPOKCONVCONST)
 
#define IMPOKCONV   (MAX(trueimptryconv,IMPOKCONVCONST))
 
#define IMPOKCONVABS   ((FTYPE)(NDIM+2)*IMPOKCONV)
 
#define IMPALLOWCONVCONSTABS   ((FTYPE)(NDIM+2)*IMPALLOWCONVCONST)
 
#define IMPALLOWCONV   (trueimpallowconv)
 
#define IMPALLOWCONV2   (IMPALLOWCONV)
 
#define IMPALLOWCONVABS   ((FTYPE)(NDIM+2)*IMPALLOWCONV)
 
#define IMPBADENERGY   (MIN(IMPALLOWCONV,1E-6))
 tolerance above which say energy solution is probably bad even if not very large error. These have tended (or nearly 100%) to be cases where actual solution has u_g<0 but harm gets error u_g>0 and error not too large. More...
 
#define TAUTOTMAXHIGHERTOL   (-1.0)
 
#define IMPTRYCONV_TAUTOTMAXHIGHERTOL   (1E-4)
 
#define IMPTRYCONV_RHORHIGHERTOL   (1E-3)
 
#define IMPTRYCONV_ROUTERHIGHERTOL   (1E-3)
 
#define IMPALLOWCONV_RHORHIGHERTOL   (1E-2)
 
#define ITERMHDINVTRYHARDER   5
 how many iterations before we try harder to get better 1D MHD inversion solution More...
 
#define MINTRYCONVFORMHDINVERSION   (1E-4)
 
#define ABORTBACKUPIFNOERRORREDUCE   1
 whether to abort even the backup if error is not reducing. More...
 
#define IMPTRYCONVALT   (MAX(1E-8,IMPTRYCONVABS))
 
#define IMPTRYDAMPCONV   (5.0*IMPTRYCONVABS)
 tolerance above which to continue to try damping More...
 
#define IMPEPSLARGE   (1E-4)
 IMPLICIT SOLVER TOLERANCES or DERIVATIVE SIZES for used implicit solver (needs to be chosen more generally. More...
 
#define IMPEPSSMALL   (1E-4)
 
#define ERRORFORIMPEPSSMALL   (1E-5)
 
#define SKIPJACCOMPUTE   (DOPERF)
 
#define SKIPJACITER   (4)
 
#define SKIPJACFACTOR   (4)
 
#define MAXIMPEPS   (0.3)
 maximum EPS for getting Jacobian More...
 
#define MAXJACITER   (10)
 maximum number of times to (typically) increase EPS in getting Jacobian for implicit scheme. This might generally override MAXIMPEPS. More...
 
#define IMPMAXITERLONG   (100)
 
#define IMPMAXITERMEDIUM   (40)
 
#define IMPMAXITERQUICK   (13)
 
#define IMPMAXITERSUPERQUICK   (2)
 
#define IMPMINABSERROR   (1E-100)
 
#define IMPLICITERRORNORM   4
 1 : normalize radiation error by only radiation thermal energy 2 : normalize radiation error by max(radiation,gas) thermal energy 3 : normalize using radiation URAD0 but also fnorm from actual f 4 : URAD0, fnorm, and UU normalize error. More...
 
#define MAXSUBCYCLES   (2000)
 
#define MAXSUBCYCLESFAIL   (MAXSUBCYCLES*100)
 if tries more than this number of sub-cycles, just fail and assume no 4-force since probably due to no actual solution even for implicit scheme due to sitting at radiative failure (e.g. gamma->gammamax or Erf->ERADLIMIT) More...
 
#define MAXF1TRIES   20
 
#define MAXMHDSTEPS   (trueimpmaxiter*6)
 
#define RADDAMPDELTA   (0.5)
 
#define RADDAMPUNDELTA   (1.0/RADDAMPDELTA)
 
#define TRYFIRSTEXPLICIT   1
 
#define DONONEXPLICITIFFAILS   ((DOPERF==0)*TRYFIRSTEXPLICIT)
 
#define TAUFAILLIMIT   (2.0/3.0)
 
#define TAUSWITCHPBVSPIIN   (2.0/3.0)
 
#define IMPLICITREVERTEXPLICIT   0
 whether to revert to sub-cycle explicit if implicit fails. Only alternative is die. More...
 
#define MAXEXPLICITSUBSTEPCHANGE   1.e-2
 like SAFE for normal dt step, don't allow explicit substepping to change dt too fast to avoid instabilities. More...
 
#define TAUSUPPRESS   0
 0 : tau suppression 1 : space-time merged 2 : all space merged but separate from time 3 : full split 4 : split even mhd and rad More...
 
#define SPACETIMESUBSPLITNONE   1
 
#define SPACETIMESUBSPLITTIME   2
 
#define SPACETIMESUBSPLITALL   3
 
#define SPACETIMESUBSPLITSUPERALL   4
 
#define SPACETIMESUBSPLITMHDRAD   5
 
#define SPACETIMESUBSPLITTIMEMHDRAD   6
 
#define WHICHSPACETIMESUBSPLIT   TAUSUPPRESS
 
#define NUMERRORTYPES   2
 determine which error will use when deciding if converged or not. More...
 
#define WHICHERROR   1
 
#define GETRADINVFROMUU0FORPB   1
 whether to get pb(uu0) instead of using pb that was used to compute F(pb). More...
 
#define USEDUINRADUPDATE   1
 whether to use dUriemann and dUgeom or other dU's sitting in dUother for radiation update -1 : use Uiin,piin 0: use Uiin,piin [initial U and initial p] // bad choice to use, e.g., uu0[RHO] should always be used 1: use uu0 for non-iterated U's and pb for non-iterated. More...
 
#define USEINPUTASGUESSIFERRORSMALL   (WHICHERROR==1)
 whether to use inputted uub, and pb as guess if errorabsreturn inputted is small enough makes sense in general only if WHICHERROR=1 More...
 
#define GAMMASMALLLIMIT   (1.0-1E-10)
 
#define JONCHOICE   0
 whether to choose Jon or Olek way of handling u2p_rad inversion failures More...
 
#define OLEKCHOICE   1
 
#define CASECHOICE   JONCHOICE
 
#define TOZAMOFRAME   0
 
#define TOFLUIDFRAME   1
 
#define TOOPACITYDEPENDENTFRAME   2
 
#define M1REDUCE   TOOPACITYDEPENDENTFRAME
 
#define MINTAUSOURCE   (NUMEPSILON)
 below this , no source term applied. More...
 
#define DOSUBJAC   1
 whether to do subjac iter-dependent solver. More...
 
#define ENERGYSIMPLEFACTOR   (NDIM)
 
#define ITERMODENORMAL   0
 
#define ITERMODESTAGES   1
 
#define ITERMODECOLD   2
 
#define BEGINMOMSTEPS0   1
 for ITERSTAGES More...
 
#define ENDMOMSTEPS0   2
 
#define BEGINENERGYSTEPS0   3
 
#define ENDENERGYSTEPS0   13
 
#define BEGINFULLSTEPS0   14
 
#define ENDFULLSTEPS0   (IMPMAXITERLONG*2)
 
#define BEGINNORMALSTEPS0   BEGINFULLSTEPS0
 
#define NUMPRIORERRORSITER0   7
 number of prior iterations to see if error has dropped enough to seem relevant More...
 
#define NUMPRIORERRORS   5
 
#define PRIORERRORCHANGEREQUIRED   (0.5)
 
#define DEBUGMAXITER   (PRODUCTION==0)
 whether to store steps for primitive and so debug max iteration cases More...
 
#define DEBUGMAXITERVELOCITY   1
 0: show primitive 1: show u^ and urad^ More...
 
#define DEBUGLEVELIMPSOLVER   3
 
#define DEBUGLEVELIMPSOLVERMORE   3
 
#define RAMESHFIXEARLYSTEPS   (DOSUBJAC==1 ? 0 : 3)
 how many holds on u_g to apply while stepping velocity. More...
 
#define JONHOLDPOS   1
 whether to apply Jon's hold on u_g or rho from going negative More...
 
#define NEWJONHOLDPOS   0
 
#define NUMHOLDTIMES   6
 number of times allowed to hold u_g as positive More...
 
#define RAMESHSTOPENERGYIFTOOOFTENBELOWENTROPY   3
 stop iterating energy if pbenergy[UU]<0.5*pbentropy[UU] consistently starting aafter below number of iterations and lasting for 2nd below number of iterations More...
 
#define SWITCHTOENTROPYIFCHANGESTOENTROPY   (0)
 whether to allow changes in eomtype during implicit iterations generally not a good idea currently because overall scheme handles switching between eomtype's in separate full calls More...
 
#define USERAMESH   0
 whether to use ramesh solver as backup More...
 
#define TRYHARDERFEEDGUESSTOL   (1E-4)
 error below which to feed best guess into next attempt More...
 
#define ERRORTOUSEENTROPYFORENERGYGUESS   (1E-4)
 error below which will use entropy as guess for energy if entropy didn't hard fail. More...
 
#define GETBEST   1
 whether to get lowest error solution instead of final one. More...
 
#define DOFINALCHECK   1
 need to do final check since get f1 and then do step. More...
 
#define REPORTMAXITERALLOWED   (PRODUCTION==0)
 below 1 if reporting cases when MAXITER reached, but allowd error so not otherwise normally reported. More...
 
#define FORCEJDIFFNOCROSS   1
 whether to ensure rho and u_g in Jacobian calculation difference do not cross over 0 and stay on same side as origin point. More...
 
#define POSTNEWTONCONVCHECK   1
 whether to check pp-ppp 1: directly check post pp-ppp relative error and see if changes by LOCALPREIMPCONVX 2: directly check if any changes to pp during Newton step are bigger than DIFFXLIMIT. More...
 
#define DIFFXLIMIT   (10.0*NUMEPSILON)
 below which sum of all primitives is taken as no interesting change. More...
 
#define LOCALPREIMPCONVX   (10.0*NUMEPSILON)
 
#define LOCALPREIMPCONVXABS   ((FTYPE)(NDIM+2)*LOCALPREIMPCONVX)
 
#define NUMNOERRORREDUCE0   (5 + mtd.BEGINNORMALSTEPS)
 number of iterations by which to check (1st) whether after some number of times (2nd) error rose instead of reduced. More...
 
#define NUMNOERRORREDUCE   5
 
#define SWITCHTODONOTHING   1
 whether to use EOMDONOTHING if error is good enough. More...
 
#define CHANGEDAMPFACTOR   2
 whether to change damp factor during this instance. More...
 
#define NUMDAMPATTEMPTS   (3*((DOPERF)==0) + 1*((DOPERF)==1))
 
#define NUMDAMPATTEMPTSQUICK   1
 
#define FACTORBADJUMPERROR   (1.0E2)
 factor by which error jumps as indication that u_g stepped to was very bad choice. More...
 
#define WHICHU2PRAD   1
 0 : old Jon method 1 : Jon's paper draft method More...
 
#define GAMMAMAXRADIMPLICITSOLVER   (GAMMAMAXRAD)
 during implicit solver, don't limit gamma so much as normally. Otherwise, solution may not be found and solver struggles and leads to high errors and iterations. If limit gammarad but not gammafluid, then gammafluid can be too high. If limit both, no solutions can be found. So just limit afterwards for now. More...
 
#define ENTROPYOPT   1
 whether to avoid computing entropy during iterations if not needed More...
 
#define ALLOWUSEUUALT   0
 whether to try using uualt (see f_implicit()) More...
 
#define USECAPTYPEFIX2FORF1   1
 whether to use CAPTYPEFIX2 for f1 (central Jac and error estimate). Still will use CAPTYPEBASIC for final check, but this allows faster convergence or non-convergence as required. More...
 
#define USECAPTYPEFIX2FORFINALCHECK   1
 "" for final check. More...
 
#define AVOIDURAD0IFRADINVMODANDPMHDMETHOD   (USECAPTYPEFIX2FORF1!=0)
 whether to avoid including URAD0 in total error when hitting radinvmod!=0. If using CAPTYPEFIX2FORF1=1, then can't get error better than what CAPTYPEFIX2 provides for non-URAD0 terms. More...
 
#define TREATRADINVCAPASNONFAILUREFORPMHDMETHOD   (USECAPTYPEFIX2FORF1!=0)
 whether to avoid back-tracing f1 calculation if rad inv hits cap, just push through if ==1. More...
 
#define LETPMHDFAIL   1
 whether to just let PMHD fail and try it first no matter whether primary considerations say otherwise. More...
 
#define USEPRIORITERMETHOD   0
 whether to use history of methods to determine current method – KORALTODO: Needs work. More...
 
#define STOPIFVERYLOWERROR   (1)
 stop if WHICHERROR is low error More...
 
#define STOPIFITERLOWERROR   (0)
 stop if iter error is low error More...
 
#define FAILRETURNGOTRIVIALEXPLICIT   -1
 
#define FAILRETURNNOFAIL   0
 
#define FAILRETURNGENERAL   1
 
#define FAILRETURNJACISSUE   2
 
#define FAILRETURNMODESWITCH   3
 
#define FAILRETURNNOTTOLERROR   4
 
#define ACCEPTASNOFAILURE(failreturn)   (failreturn==FAILRETURNNOFAIL || failreturn==FAILRETURNNOTTOLERROR || failreturn==FAILRETURNGOTRIVIALEXPLICIT)
 
#define NOTACTUALFAILURE(failreturn)   (failreturn==FAILRETURNNOFAIL || failreturn==FAILRETURNMODESWITCH || failreturn==FAILRETURNGOTRIVIALEXPLICIT)
 
#define NOTBADFAILURE(failreturn)   (failreturn==FAILRETURNNOFAIL || failreturn==FAILRETURNMODESWITCH || failreturn==FAILRETURNNOTTOLERROR || failreturn==FAILRETURNGOTRIVIALEXPLICIT)
 
#define ACTUALHARDFAILURE(failreturn)   (failreturn==FAILRETURNGENERAL || failreturn==FAILRETURNJACISSUE)
 
#define ACTUALHARDORSOFTFAILURE(failreturn)   (failreturn==FAILRETURNGENERAL || failreturn==FAILRETURNJACISSUE || failreturn==FAILRETURNNOTTOLERROR)
 
#define SWITCHGOODIDEAFAILURE(failreturn)   (failreturn==FAILRETURNGENERAL || failreturn==FAILRETURNJACISSUE || failreturn==FAILRETURNNOTTOLERROR || failreturn==FAILRETURNMODESWITCH)
 
#define MODEMETHOD   MODEPICKBEST
 choose to switch to entropy only if energy fails or gives u_g<0. More...
 
#define MAXJACDIM   (NDIM)
 
#define FIMPLICITCALLTYPEF1   1
 f_implicit() call types More...
 
#define FIMPLICITCALLTYPEFINALCHECK   2
 
#define FIMPLICITCALLTYPEJAC   3
 
#define FIMPLICITCALLTYPEFINALCHECK2   4
 
#define DIMTYPEFCONS   0
 
#define DIMTYPEFPRIM   1
 
#define UTOPRIMGENWRAPPERRETURNNOFAIL   (UTOPRIMNOFAIL)
 mnemonics for return modes so schemes know how failed and what to do. More...
 
#define UTOPRIMGENWRAPPERRETURNFAILRAD   (1)
 
#define UTOPRIMGENWRAPPERRETURNFAILMHD   (2)
 
#define QTYUMHD   0
 whether iterate or have as error function: MHD T^t_ or RAD R^t_, etc. More...
 
#define QTYUMHDENERGYONLY   1
 
#define QTYUMHDMOMONLY   2
 
#define QTYURAD   3
 
#define QTYURADENERGYONLY   4
 
#define QTYURADMOMONLY   5
 
#define QTYPMHD   6
 
#define QTYPMHDENERGYONLY   7
 
#define QTYPMHDMOMONLY   8
 
#define QTYPRAD   9
 
#define QTYPRADENERGYONLY   10
 
#define QTYPRADMOMONLY   11
 
#define QTYENTROPYUMHD   12
 
#define QTYENTROPYUMHDENERGYONLY   13
 
#define QTYENTROPYUMHDMOMONLY   14
 
#define QTYENTROPYPMHD   15
 
#define QTYENTROPYPMHDENERGYONLY   16
 
#define QTYENTROPYPMHDMOMONLY   17
 
#define IMPPTYPE(implicititer)   (implicititer==QTYPMHD ||implicititer==QTYPMHDENERGYONLY ||implicititer==QTYPMHDMOMONLY || implicititer==QTYPRAD ||implicititer==QTYPRADENERGYONLY ||implicititer==QTYPRADMOMONLY || implicititer==QTYENTROPYPMHD ||implicititer==QTYENTROPYPMHDENERGYONLY ||implicititer==QTYENTROPYPMHDMOMONLY)
 P or U types. More...
 
#define IMPUTYPE(implicititer)   (implicititer==QTYUMHD ||implicititer==QTYUMHDENERGYONLY ||implicititer==QTYUMHDMOMONLY || implicititer==QTYURAD ||implicititer==QTYURADENERGYONLY ||implicititer==QTYURADMOMONLY || implicititer==QTYENTROPYUMHD ||implicititer==QTYENTROPYUMHDENERGYONLY ||implicititer==QTYENTROPYUMHDMOMONLY)
 
#define IMPMHDTYPE(implicititer)   (implicititer==QTYPMHD ||implicititer==QTYPMHDENERGYONLY ||implicititer==QTYPMHDMOMONLY || implicititer==QTYUMHD ||implicititer==QTYUMHDENERGYONLY ||implicititer==QTYUMHDMOMONLY || implicititer==QTYENTROPYUMHD ||implicititer==QTYENTROPYUMHDENERGYONLY ||implicititer==QTYENTROPYUMHDMOMONLY)
 MHD or RAD type. More...
 
#define IMPRADTYPE(implicititer)   (implicititer==QTYPRAD ||implicititer==QTYPRADENERGYONLY ||implicititer==QTYPRADMOMONLY || implicititer==QTYURAD ||implicititer==QTYURADENERGYONLY ||implicititer==QTYURADMOMONLY)
 
#define IMPMHDTYPEBASE(baseitermethod)   (baseitermethod==QTYPMHD || baseitermethod==QTYUMHD || baseitermethod==QTYENTROPYUMHD)
 MHD or RAD baseitermethod types. More...
 
#define IMPRADTYPEBASE(baseitermethod)   (baseitermethod==QTYPRAD || baseitermethod==QTYURAD)
 
#define IMPPMHDTYPE(implicititer)   (implicititer==QTYPMHD ||implicititer==QTYPMHDENERGYONLY ||implicititer==QTYPMHDMOMONLY)
 PMHD types. More...
 
#define JACNPR   (NDIM)
 
#define JACLOOP(jj, startjj, endjj)   for(jj=startjj;jj<=endjj;jj++)
 
#define JACLOOPALT(jj, startjj, endjj)   DLOOPA(jj)
 
#define JACLOOPSUPERFULL(pliter, pl, eomtype, baseitermethod, radinvmod)
 
#define JACLOOPFULLERROR(itermode, jj, startjj, endjj)   for(jj=(itermode==ITERMODECOLD ? startjj : 0);jj<=(itermode==ITERMODECOLD ? endjj : NDIM-1);jj++)
 
#define JACLOOPSUBERROR(jj, startjj, endjj)   JACLOOP(jj,startjj,endjj)
 
#define JACLOOP2D(ii, jj, startjj, endjj)   JACLOOP(ii,startjj,endjj) JACLOOP(jj,startjj,endjj)
 
#define ITERCHECKEXPLICITSAFE   1
 
#define NUMPHASES   (6)
 
#define NUMPHASESENT   (8)
 
#define NUMPHASESCOLD   (1)
 
#define NUMNUMHIST   (20)
 
#define HISTREPORTSTEP   (DTr)
 
#define GETCOLLECTIVETOTALS   ( (debugfail>=2 || PRODUCTION<=1 && nstep%HISTREPORTSTEP==0 && steppart==0 ) && (ptrgeom->i==0 && ptrgeom->j==0 && ptrgeom->k==0) )
 
#define NUMFRACDAMP   10
 
#define GETDEFAULTFAILURESTATE   (IMPPMHDTYPE(mtd.implicititer)==0)
 
#define IMPOKCONVCONSTFORDEFAULT   (1E-6)
 
#define IMPALLOWCONVCONSTFORDEFAULT   (1E-4)
 
#define IMPMAXITERFORDEFAULT   (10)
 
#define BACKUPRELEASEFAIL0   (1E-4)
 
#define BACKUPRELEASEFAIL1   (1E-6)
 
#define BACKUPRELEASEFAIL2   (1E-7)
 
#define MAXF1ITERRADTRY   (10)
 
#define F1ITERSWITCHONNEG   20
 
#define ERRORJUMPCHECK   0
 
#define BUFFERITER   0
 
#define NUMJUMPCHECKSMAX   5
 
#define CHECKDECREASE0   5
 
#define CHECKDECREASEAVGNUM   3
 
#define CHECKDECFACTOR   (0.5)
 
#define NUMUGNEGENERGY   (3)
 
#define BORROWTOL   (1E-1)
 
#define DEBUGMAXMODE   1
 0 : full 1: optimal More...
 
#define WHICHVELRAMESH   VELREL4
 
#define NUMRESULTS   15
 
#define NUMARGS   (211+11)
 
#define JDIFFONESIDED   0
 
#define JDIFFCENTERED   1
 
#define MAXSIGN(x, y)   (fabs(x)>fabs(y) ? (x) : (y))
 
#define MINSIGN(x, y)   (fabs(x)<fabs(y) ? (x) : (y))
 
#define EXPLICITFAILEDBUTWENTTHROUGH   -2
 
#define EXPLICITNOTNECESSARY   -1
 
#define EXPLICITNOTFAILED   0
 
#define EXPLICITFAILED   1
 
#define GETADVANCEDUNEW0FOREXPLICIT   1
 
#define SIGNGD   (1.0)
 
#define TRYCOLD   1
 
#define AVCOVRELDIFFALLOWED   1E-2
 

Functions

double d_sign (doublereal *aa, doublereal *bb)
 f2c prototype More...
 
integer i_dnnt (doublereal *x)
 
void f_exit (void)
 
int s_stop (char *s, ftnlen n)
 
double pow_dd (doublereal *ap, doublereal *bp)
 
static int koral_source_rad_implicit (int *eomtype, FTYPE *pb, FTYPE *pf, FTYPE *piin, FTYPE *Uiin, FTYPE *Ufin, FTYPE *CUf, FTYPE *CUimp, struct of_geom *ptrgeom, struct of_state *q, FTYPE dissmeasure, FTYPE *dUother,FTYPE(*dUcomp)[NPR])
 wrapper for mode method More...
 
static int koral_source_rad_implicit_mode (int modemethodlocal, int allowbaseitermethodswitch, int modprim, int havebackup, int didentropyalready, int *eomtype, int whichcap, int itermode, int *baseitermethod, FTYPE trueimptryconv, FTYPE trueimpokconv, FTYPE trueimpallowconv, int trueimpmaxiter, int truenumdampattempts, FTYPE fracenergy, FTYPE dissmeasure, int *radinvmod, FTYPE *pb, FTYPE *uub, FTYPE *piin, FTYPE *Uiin, FTYPE *Ufin, FTYPE *CUf, FTYPE *CUimp, struct of_geom *ptrgeom, struct of_state *q, FTYPE *dUother,FTYPE(*dUcomp)[NPR], FTYPE *errorabsreturn, FTYPE *errorabsbestexternal, int *itersreturn, int *f1itersreturn, int *nummhdinvsreturn, int *nummhdstepsreturn)
 compute changes to U (both T and R) using implicit method KORALTODO: If doing implicit, should also add geometry source term that can sometimes be stiff. More...
 
static int f_implicit (int allowbaseitermethodswitch, int iter, int f1iter, int failreturnallowable, int whichcall, FTYPE impeps, int showmessages, int showmessagesheavy, int allowlocalfailurefixandnoreport, int *eomtype, int whichcap, int itermode, int *baseitermethod, FTYPE fracenergy, FTYPE dissmeasure, int *radinvmod, FTYPE conv, FTYPE convabs, FTYPE allowconvabs, int maxiter, FTYPE realdt, int dimtypef, FTYPE *dimfactU, FTYPE *ppprev, FTYPE *pp, FTYPE *piin, FTYPE *uuprev, FTYPE *Uiin, FTYPE *uu0, FTYPE *uu, FTYPE localdt, struct of_geom *ptrgeom, struct of_state *q, FTYPE *f, FTYPE *fnorm, FTYPE *freport, int *goexplicit, FTYPE *errorabs, FTYPE *errorallabs, int whicherror, int *convreturn, int *nummhdinvsreturn, FTYPE *tautotmaxreturn, struct of_method *mtd, struct of_refU *ru)
 uu0 - original cons. More...
 
static int calc_tautot_chieff (FTYPE *pp, FTYPE chi, struct of_geom *ptrgeom, struct of_state *q, FTYPE *tautot, FTYPE *tautotmax)
 calculates total opacity over dx[] for given chi or chieff More...
 
static FTYPE calc_approx_ratchangeRtt (struct of_state *q, FTYPE chieff, FTYPE realdt)
 
static int get_implicit_iJ (int allowbaseitermethodswitch, int failreturnallowableuse, int showmessages, int showmessagesheavy, int allowlocalfailurefixandnoreport, int *eomtypelocal, int whichcap, int itermode, int *baseitermethod, FTYPE fracenergy, FTYPE dissmeasure, FTYPE impepsjac, FTYPE trueimptryconv, FTYPE trueimptryconvabs, FTYPE trueimpallowconvabs, int trueimpmaxiter, int iter, FTYPE errorabs, FTYPE errorallabs, int whicherror, int dimtypef, FTYPE *dimfactU, FTYPE *Uiin, FTYPE *uu, FTYPE *uup, FTYPE *uu0, FTYPE *piin, FTYPE *pp, FTYPE *ppp, FTYPE fracdtG, FTYPE realdt, struct of_geom *ptrgeom, struct of_state *q, FTYPE *f1, FTYPE *f1norm, FTYPE(*iJ)[NPR], int *nummhdinvsreturn, struct of_method *mtd, struct of_refU *ru)
 calculating approximate Jacobian: dUresid(dUrad,G(Urad))/dUrad = dy(x)/dx then compute inverse Jacobian More...
 
static int compute_ZAMORAD (FTYPE *uu, struct of_geom *ptrgeom, FTYPE *Er, FTYPE *Utildesq, FTYPE *Utildecon)
 compute ZAMO version of radiation quantities as in paper draft More...
 
static int get_m1closure_gammarel2 (int showmessages, struct of_geom *ptrgeom, FTYPE *Avcon, FTYPE *Avcov, FTYPE *gammarel2return, FTYPE *deltareturn, FTYPE *numeratorreturn, FTYPE *divisorreturn)
 get's gamma^2 for lab-frame gamma using Rd and gcon More...
 
static int get_m1closure_gammarel2_cold (int showmessages, struct of_geom *ptrgeom, FTYPE *Avcon, FTYPE *Avcov, FTYPE *gammarel2return, FTYPE *deltareturn, FTYPE *numeratorreturn, FTYPE *divisorreturn, FTYPE *Erfreturn, FTYPE *urfconrel)
 get's gamma assuming fixed E rather than using original R^t_t that we assume is flawed near floor regions. We want to preserve R^t_i (i.e conserved momentum) More...
 
static int get_m1closure_Erf (struct of_geom *ptrgeom, FTYPE *Avcon, FTYPE gammarel2, FTYPE *Erfreturn)
 get Erf More...
 
static int get_m1closure_urfconrel (int showmessages, int allowlocalfailurefixandnoreport, struct of_geom *ptrgeom, FTYPE *pp, FTYPE *Avcon, FTYPE *Avcov, FTYPE gammarel2, FTYPE delta, FTYPE numerator, FTYPE divisor, FTYPE *Erfreturn, FTYPE *urfconrel, PFTYPE *lpflag, PFTYPE *lpflagrad)
 get contravariant relative 4-velocity in lab frame More...
 
static int get_m1closure_urfconrel_olek (int showmessages, int allowlocalfailurefixandnoreport, struct of_geom *ptrgeom, FTYPE *pp, FTYPE *Avcon, FTYPE *Avcov, FTYPE gammarel2, FTYPE delta, FTYPE *Erfreturn, FTYPE *urfconrel, PFTYPE *lpflag, PFTYPE *lpflagrad)
 get contravariant relative 4-velocity in lab frame using Olek's koral choices More...
 
static int opacity_interpolated_urfconrel (FTYPE tautotmax, FTYPE *pp, struct of_geom *ptrgeom, FTYPE *Avcon, FTYPE Erf, FTYPE gammarel2, FTYPE *Erfnew, FTYPE *urfconrel)
 interpolate between optically thick and thin limits when no u2p_rad() inversion solution More...
 
static FTYPE compute_dt (int isexplicit, FTYPE *CUf, FTYPE *CUimp, FTYPE dtin)
 compute dt for this sub-step More...
 
static void calc_Gd (FTYPE *pp, struct of_geom *ptrgeom, struct of_state *q,FTYPE *GG, FTYPE *Tgas, FTYPE *Trad, FTYPE *chieffreturn, FTYPE *ndotffreturn, FTYPE *ndotffabsreturn, FTYPE *Gabs)
 get G_ More...
 
static void calc_Gu (FTYPE *pp, struct of_geom *ptrgeom, struct of_state *q,FTYPE *Gu, FTYPE *Tgasreturn, FTYPE *Tradreturn, FTYPE *chieffreturn, FTYPE *ndotffreturn, FTYPE *ndotffabsreturn, FTYPE *Gabs)
 compute G^ 4-force More...
 
static int simplefast_rad (int dir, struct of_geom *geom, struct of_state *q, FTYPE vrad2, FTYPE *vmin, FTYPE *vmax)
 get lab-frame 3-velocity for radiative emission in radiative frame More...
 
static void calcfull_Trad (FTYPE *pp, struct of_geom *ptrgeom, FTYPE *Trad, FTYPE *nrad, FTYPE *expfactorrad)
 
static void calc_Trad (FTYPE *pp, struct of_geom *ptrgeom, struct of_state *q, FTYPE *Trad, FTYPE *nrad, FTYPE *expfactorrad)
 compute Trad (also computed directly in calc_Gu() above) using only primitives (not using conserved quantities) More...
 
static void calc_Trad_fromRuuandgamma (FTYPE *pp, struct of_geom *ptrgeom, FTYPE Ruu, FTYPE gammaradgas, FTYPE *Trad, FTYPE *nrad, FTYPE *expfactorrad)
 compute Trad (also computed directly in calc_Gu() above) using only primitives (not using conserved quantities) More...
 
static void setgasinversionstuff (int iter, int whichcall, FTYPE impeps, FTYPE errorabs, FTYPE convabs, int maxiter, struct of_newtonstats *newtonstats, int *checkoninversiongas, int *checkoninversionrad)
 
int koral_source_rad (int whichradsourcemethod, FTYPE *piin, FTYPE *pb, FTYPE *pf, int *didreturnpf, int *eomtype, FTYPE *Uiin, FTYPE *Ufin, FTYPE *CUf, FTYPE *CUimp, struct of_geom *ptrgeom, struct of_state *q, FTYPE dissmeasure, FTYPE *dUother, FTYPE(*dUcomp)[NPR])
 General radiation source term calculation (EXTERNALLY called) NOTE: source_explicit() takes as first argument a form of function like general koral_source_rad_calc() . More...
 
void calc_chi (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q, FTYPE *chi)
 
void calc_Tandopacityandemission (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q, FTYPE Ruu, FTYPE gammaradgas, FTYPE B, FTYPE *Tgas, FTYPE *Tradff, FTYPE *nradff, FTYPE *expfactorradff, FTYPE *kappa, FTYPE *kappan, FTYPE *kappaemit, FTYPE *kappanemit, FTYPE *kappaes, FTYPE *lambda, FTYPE *nlambda)
 get {abs} and {es} in /mass * rho = 1/cm form. More...
 
void koral_source_rad_calc (int computestate, int computeentropy, FTYPE *pr, struct of_geom *ptrgeom, FTYPE *Gdpl, FTYPE *Gdplabs, FTYPE *chi, FTYPE *Tgas, FTYPE *Trad, struct of_state *q)
 get 4-force for all pl's More...
 
int vchar_rad (FTYPE *pr, struct of_state *q, int dir, struct of_geom *geom, FTYPE *vmax, FTYPE *vmin, FTYPE *vmax2, FTYPE *vmin2, int *ignorecourant)
 compute radiative characteristics as limited by opacity More...
 
int get_state_uradconuradcovonly (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 Get only u^ and u_ assumine b^ and b_ not used. More...
 
void mhdfull_calc_rad (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q, FTYPE(*radstressdir)[NDIM])
 
void mhd_calc_rad (FTYPE *pr, int dir, struct of_geom *ptrgeom, struct of_state *q, FTYPE *radstressdir, FTYPE *radstressdirabs)
 compute radiation stres-energy tensor assuming M1 closure More...
 
int calc_Rij_ff (FTYPE *pp, FTYPE Rij[][NDIM])
 compute fluid frame orthonormal basis radiation stress-energy tensor assuming M1 closure More...
 
FTYPE my_min (FTYPE aa, FTYPE bb)
 
FTYPE my_sign (FTYPE x)
 
int prad_fforlab (int *whichvel, int *whichcoord, int whichdir, int i, int j, int k, int loc, struct of_geom *ptrgeom, FTYPE *pradffortho, FTYPE *pin, FTYPE *pout)
 radiative ortonormal ff primitives (E,F^i) <-> primitives in lab frame Used only for initial conditions whichvel: input vel type for U1-U3 whichcoord: input coord type for both U1-U3 and URAD1-URAD3 whichdir: LAB2FF or FF2LAB . More...
 
int prad_labtoff (int *whichvel, int *whichcoord, int i, int j, int k, int loc, struct of_geom *ptrgeom, FTYPE *pradffortho, FTYPE *pin, FTYPE *pout)
 like prad_fforlab() but for only whichdir=LAB2FF used for dumps or diags More...
 
int prad_fftolab (int *whichvel, int *whichcoord, int i, int j, int k, int loc, struct of_geom *ptrgeom, FTYPE *pradffortho, FTYPE *pin, FTYPE *pout)
 like prad_fforlab() but for only whichdir=FF2LAB used for IC More...
 
int primefluid_EVrad_to_primeall (int *whichvel, int *whichcoord, struct of_geom *ptrgeom, FTYPE *pin, FTYPE *pout)
 for BCs, to take E[radiation frame] and u^i as radiation primitives in whichvel/whichcoord obtains WHICHVEL/PRIMECOORD primitives More...
 
int whichfluid_ffrad_to_primeall (int *whichvel, int *whichcoordfluid, int *whichcoordrad, struct of_geom *ptrgeomprimecoords, FTYPE *pradffortho, FTYPE *pin, FTYPE *pout)
 Input: start with pin [with fluid in whichvel velocity and whichcoordfluid coordinates (PRIMECOORDS or MCOORD) and radiation as E,F in fluid frame orthonormal basis in whichcoordrad coordinates] Output: pout [with all WHICHVEL PRIMECOORDS and radiation using velocity primitive]. More...
 
int u2p_rad (int showmessages, int allowlocalfailurefixandnoreport, FTYPE gammamaxrad, int whichcap, FTYPE *uu, FTYPE *pin, struct of_geom *ptrgeom, PFTYPE *lpflag, PFTYPE *lpflagrad)
 
int u2p_rad_new (int showmessages, int allowlocalfailurefixandnoreport, FTYPE gammamaxrad, int whichcap, FTYPE *uu, FTYPE *pin, struct of_geom *ptrgeom, PFTYPE *lpflag, PFTYPE *lpflagrad)
 Like u2p_rad_orig(), but uses Jon's paper draft ZAMO RAD version. More...
 
int calcfull_tautot (FTYPE *pp, struct of_geom *ptrgeom, FTYPE *tautot, FTYPE *tautotmax)
 
int calc_tautot (FTYPE *pp, struct of_geom *ptrgeom, struct of_state *q, FTYPE *tautot, FTYPE *tautotmax)
 calculates total opacity over dx[] More...
 
FTYPE calc_PEQ_ufromTrho (FTYPE T, FTYPE rho)
 suplementary routines for conversions More...
 
FTYPE calc_PEQ_Tfromurho (FTYPE u, FTYPE rho)
 
FTYPE calc_LTE_EfromT (FTYPE T)
 E=urad=arad T^4 (this is LTE only if put in T was gas T) More...
 
FTYPE calc_LTE_NfromT (FTYPE T)
 nrad(T) = nrad=arad T^3/2.70118 (this is LTE only if put in T was gas T) More...
 
FTYPE calc_LTE_NfromE (FTYPE E)
 nrad(E) More...
 
FTYPE calc_LTE_TfromE (FTYPE E)
 E=urad=arad T^4 and just solve for T (this is LTE only if assume resulting T is gas T). If put in fluid-frame E, then correct T for radiation in fluid frame. More...
 
FTYPE calc_LTE_Efromurho (FTYPE u, FTYPE rho)
 This will really give back only LTE E. More...
 
int set_ncon_velocity (int whichvel, FTYPE gammamax, FTYPE *ncon, struct of_geom *ptrgeom, FTYPE *uconwhichvel)
 set velocity based upon ncon and gammamax and return in whichvel format for the ptrgeom geometry/coords More...
 

Variables

FTYPE globaluu [NPR]
 
FTYPE globalpin [NPR]
 

Detailed Description

All locally-related Koral/RAD physics calculations.

Definition in file phys.tools.rad.c.

Macro Definition Documentation

#define ABORTBACKUPIFNOERRORREDUCE   1

whether to abort even the backup if error is not reducing.

Definition at line 288 of file phys.tools.rad.c.

#define ACCEPTASNOFAILURE (   failreturn)    (failreturn==FAILRETURNNOFAIL || failreturn==FAILRETURNNOTTOLERROR || failreturn==FAILRETURNGOTRIVIALEXPLICIT)

Definition at line 639 of file phys.tools.rad.c.

#define ACTUALHARDFAILURE (   failreturn)    (failreturn==FAILRETURNGENERAL || failreturn==FAILRETURNJACISSUE)

Definition at line 644 of file phys.tools.rad.c.

#define ACTUALHARDORSOFTFAILURE (   failreturn)    (failreturn==FAILRETURNGENERAL || failreturn==FAILRETURNJACISSUE || failreturn==FAILRETURNNOTTOLERROR)

Definition at line 645 of file phys.tools.rad.c.

#define ALLOWUSEUUALT   0

whether to try using uualt (see f_implicit())

Definition at line 602 of file phys.tools.rad.c.

#define AVCOVRELDIFFALLOWED   1E-2
#define AVOIDTAUFORFLOOR   (1)

Definition at line 208 of file phys.tools.rad.c.

#define AVOIDURAD0IFRADINVMODANDPMHDMETHOD   (USECAPTYPEFIX2FORF1!=0)

whether to avoid including URAD0 in total error when hitting radinvmod!=0. If using CAPTYPEFIX2FORF1=1, then can't get error better than what CAPTYPEFIX2 provides for non-URAD0 terms.

Definition at line 609 of file phys.tools.rad.c.

#define BACKUPRELEASEFAIL0   (1E-4)
#define BACKUPRELEASEFAIL1   (1E-6)
#define BACKUPRELEASEFAIL2   (1E-7)
#define BEGINENERGYSTEPS0   3

Definition at line 480 of file phys.tools.rad.c.

#define BEGINFULLSTEPS0   14

Definition at line 483 of file phys.tools.rad.c.

#define BEGINMOMSTEPS0   1

for ITERSTAGES

Definition at line 477 of file phys.tools.rad.c.

#define BEGINNORMALSTEPS0   BEGINFULLSTEPS0

Definition at line 486 of file phys.tools.rad.c.

#define BORROWTOL   (1E-1)
#define BUFFERITER   0
#define CASECHOICE   JONCHOICE

Definition at line 440 of file phys.tools.rad.c.

#define CHANGEDAMPFACTOR   2

whether to change damp factor during this instance.

Definition at line 579 of file phys.tools.rad.c.

#define CHECKDECFACTOR   (0.5)
#define CHECKDECREASE0   5
#define CHECKDECREASEAVGNUM   3
#define COURRADEXPLICIT   (0.1)

Definition at line 211 of file phys.tools.rad.c.

#define DEBUGLEVELIMPSOLVER   3

Definition at line 503 of file phys.tools.rad.c.

#define DEBUGLEVELIMPSOLVERMORE   3

Definition at line 506 of file phys.tools.rad.c.

#define DEBUGMAXITER   (PRODUCTION==0)

whether to store steps for primitive and so debug max iteration cases

Definition at line 497 of file phys.tools.rad.c.

#define DEBUGMAXITERVELOCITY   1

0: show primitive 1: show u^ and urad^

Definition at line 501 of file phys.tools.rad.c.

#define DEBUGMAXMODE   1

0 : full 1: optimal

Definition at line 8125 of file phys.tools.rad.c.

#define DIFFXLIMIT   (10.0*NUMEPSILON)

below which sum of all primitives is taken as no interesting change.

Definition at line 563 of file phys.tools.rad.c.

#define DIMTYPEFCONS   0

Definition at line 777 of file phys.tools.rad.c.

#define DIMTYPEFPRIM   1

Definition at line 778 of file phys.tools.rad.c.

#define DOFINALCHECK   1

need to do final check since get f1 and then do step.

Definition at line 548 of file phys.tools.rad.c.

#define DONONEXPLICITIFFAILS   ((DOPERF==0)*TRYFIRSTEXPLICIT)

Definition at line 373 of file phys.tools.rad.c.

#define DOSUBJAC   1

whether to do subjac iter-dependent solver.

0 : normal full 4D method 1 : Invert sub Jacobian method

Definition at line 466 of file phys.tools.rad.c.

#define ENDENERGYSTEPS0   13

Definition at line 481 of file phys.tools.rad.c.

#define ENDFULLSTEPS0   (IMPMAXITERLONG*2)

Definition at line 484 of file phys.tools.rad.c.

#define ENDMOMSTEPS0   2

Definition at line 478 of file phys.tools.rad.c.

#define ENERGYSIMPLEFACTOR   (NDIM)

Definition at line 467 of file phys.tools.rad.c.

#define ENTROPYOPT   1

whether to avoid computing entropy during iterations if not needed

Definition at line 599 of file phys.tools.rad.c.

#define ERRORFORIMPEPSSMALL   (1E-5)

Definition at line 307 of file phys.tools.rad.c.

#define ERRORJUMPCHECK   0
#define ERRORTOUSEENTROPYFORENERGYGUESS   (1E-4)

error below which will use entropy as guess for energy if entropy didn't hard fail.

Definition at line 540 of file phys.tools.rad.c.

#define EXPLICITFAILED   1

Definition at line 9682 of file phys.tools.rad.c.

#define EXPLICITFAILEDBUTWENTTHROUGH   -2

Definition at line 9679 of file phys.tools.rad.c.

#define EXPLICITNOTFAILED   0

Definition at line 9681 of file phys.tools.rad.c.

#define EXPLICITNOTNECESSARY   -1

Definition at line 9680 of file phys.tools.rad.c.

#define F1ITERSWITCHONNEG   20
#define FACTORBADJUMPERROR   (1.0E2)

factor by which error jumps as indication that u_g stepped to was very bad choice.

Definition at line 586 of file phys.tools.rad.c.

#define FAILRETURNGENERAL   1

Definition at line 634 of file phys.tools.rad.c.

#define FAILRETURNGOTRIVIALEXPLICIT   -1

Definition at line 632 of file phys.tools.rad.c.

#define FAILRETURNJACISSUE   2

Definition at line 635 of file phys.tools.rad.c.

#define FAILRETURNMODESWITCH   3

Definition at line 636 of file phys.tools.rad.c.

#define FAILRETURNNOFAIL   0

Definition at line 633 of file phys.tools.rad.c.

#define FAILRETURNNOTTOLERROR   4

Definition at line 637 of file phys.tools.rad.c.

#define FIMPLICITCALLTYPEF1   1

f_implicit() call types

Definition at line 766 of file phys.tools.rad.c.

#define FIMPLICITCALLTYPEFINALCHECK   2

Definition at line 767 of file phys.tools.rad.c.

#define FIMPLICITCALLTYPEFINALCHECK2   4

Definition at line 769 of file phys.tools.rad.c.

#define FIMPLICITCALLTYPEJAC   3

Definition at line 768 of file phys.tools.rad.c.

#define FORCEJDIFFNOCROSS   1

whether to ensure rho and u_g in Jacobian calculation difference do not cross over 0 and stay on same side as origin point.

Definition at line 555 of file phys.tools.rad.c.

#define GAMMAMAXRADIMPLICITSOLVER   (GAMMAMAXRAD)

during implicit solver, don't limit gamma so much as normally. Otherwise, solution may not be found and solver struggles and leads to high errors and iterations. If limit gammarad but not gammafluid, then gammafluid can be too high. If limit both, no solutions can be found. So just limit afterwards for now.

Definition at line 595 of file phys.tools.rad.c.

#define GAMMASMALLLIMIT   (1.0-1E-10)

Definition at line 433 of file phys.tools.rad.c.

#define GETADVANCEDUNEW0FOREXPLICIT   1

Definition at line 9685 of file phys.tools.rad.c.

#define GETBEST   1

whether to get lowest error solution instead of final one.

Definition at line 544 of file phys.tools.rad.c.

#define GETCOLLECTIVETOTALS   ( (debugfail>=2 || PRODUCTION<=1 && nstep%HISTREPORTSTEP==0 && steppart==0 ) && (ptrgeom->i==0 && ptrgeom->j==0 && ptrgeom->k==0) )
#define GETDEFAULTFAILURESTATE   (IMPPMHDTYPE(mtd.implicititer)==0)
#define GETRADINVFROMUU0FORPB   1

whether to get pb(uu0) instead of using pb that was used to compute F(pb).

Better guess to use pb(uu0) in optically thin regions. : 0 don't : 1 do for RAD and MHD methods under all cases : 2 do only for RAD methods : 3 do for both methods but only for STAGES for MHD methods

Definition at line 418 of file phys.tools.rad.c.

#define HISTREPORTSTEP   (DTr)
#define IMPALLOWCONV   (trueimpallowconv)

Definition at line 264 of file phys.tools.rad.c.

#define IMPALLOWCONV2   (IMPALLOWCONV)

Definition at line 265 of file phys.tools.rad.c.

#define IMPALLOWCONV_RHORHIGHERTOL   (1E-2)

Definition at line 279 of file phys.tools.rad.c.

#define IMPALLOWCONVABS   ((FTYPE)(NDIM+2)*IMPALLOWCONV)

Definition at line 266 of file phys.tools.rad.c.

#define IMPALLOWCONVCONST   (1.e-5)

what tolerance to use for saying can switch to entropy when u_g is suggested to be bad for energy

what error to allow at all too allowing to allow 1E-4 error since often solution is nuts at even errors>1E-8

Definition at line 252 of file phys.tools.rad.c.

#define IMPALLOWCONVCONSTABS   ((FTYPE)(NDIM+2)*IMPALLOWCONVCONST)

Definition at line 262 of file phys.tools.rad.c.

#define IMPALLOWCONVCONSTFORDEFAULT   (1E-4)
#define IMPBADENERGY   (MIN(IMPALLOWCONV,1E-6))

tolerance above which say energy solution is probably bad even if not very large error. These have tended (or nearly 100%) to be cases where actual solution has u_g<0 but harm gets error u_g>0 and error not too large.

Definition at line 270 of file phys.tools.rad.c.

#define IMPEPSLARGE   (1E-4)

IMPLICIT SOLVER TOLERANCES or DERIVATIVE SIZES for used implicit solver (needs to be chosen more generally.

KORALTODO: 1E-8 too small in general). Could start out with higher, and allow current checks to avoid inversion failure. define IMPEPS (1.e-8) use large, and it'll go smaller if no inversion, but can't start out with too small since then Jac will have diag() terms =0 KORALTODO: For difficult iterations, there can be solution but Jacobian is too rough and jump around alot in primitive space for small changes in U. Should really modify IMPEPS in such cases when pr changes alot for such changes in U. roughly (NUMEPSILON)**(1/3) as in NR5.7 on numerical derivatives

Definition at line 305 of file phys.tools.rad.c.

#define IMPEPSSMALL   (1E-4)

Definition at line 306 of file phys.tools.rad.c.

#define IMPLICITERRORNORM   4

1 : normalize radiation error by only radiation thermal energy 2 : normalize radiation error by max(radiation,gas) thermal energy 3 : normalize using radiation URAD0 but also fnorm from actual f 4 : URAD0, fnorm, and UU normalize error.

Can't expect radiation to be relatively accurate to itself if UU>>URAD0 due to G between them 3 is safest, but more expensive than 4. 4 should be fine for real systems.

Definition at line 349 of file phys.tools.rad.c.

#define IMPLICITREVERTEXPLICIT   0

whether to revert to sub-cycle explicit if implicit fails. Only alternative is die.

Definition at line 383 of file phys.tools.rad.c.

#define IMPMAXITERFORDEFAULT   (10)
#define IMPMAXITERLONG   (100)

Definition at line 336 of file phys.tools.rad.c.

#define IMPMAXITERMEDIUM   (40)

Definition at line 337 of file phys.tools.rad.c.

#define IMPMAXITERQUICK   (13)

Definition at line 338 of file phys.tools.rad.c.

#define IMPMAXITERSUPERQUICK   (2)

Definition at line 339 of file phys.tools.rad.c.

#define IMPMHDTYPE (   implicititer)    (implicititer==QTYPMHD ||implicititer==QTYPMHDENERGYONLY ||implicititer==QTYPMHDMOMONLY || implicititer==QTYUMHD ||implicititer==QTYUMHDENERGYONLY ||implicititer==QTYUMHDMOMONLY || implicititer==QTYENTROPYUMHD ||implicititer==QTYENTROPYUMHDENERGYONLY ||implicititer==QTYENTROPYUMHDMOMONLY)

MHD or RAD type.

Definition at line 943 of file phys.tools.rad.c.

#define IMPMHDTYPEBASE (   baseitermethod)    (baseitermethod==QTYPMHD || baseitermethod==QTYUMHD || baseitermethod==QTYENTROPYUMHD)

MHD or RAD baseitermethod types.

Definition at line 948 of file phys.tools.rad.c.

#define IMPMINABSERROR   (1E-100)

Definition at line 341 of file phys.tools.rad.c.

#define IMPOKCONV   (MAX(trueimptryconv,IMPOKCONVCONST))

Definition at line 258 of file phys.tools.rad.c.

#define IMPOKCONVABS   ((FTYPE)(NDIM+2)*IMPOKCONV)

Definition at line 259 of file phys.tools.rad.c.

#define IMPOKCONVCONST   (1E-6)

Definition at line 253 of file phys.tools.rad.c.

#define IMPOKCONVCONSTABS   ((FTYPE)(NDIM+2)*IMPOKCONVCONST)

Definition at line 257 of file phys.tools.rad.c.

#define IMPOKCONVCONSTFORDEFAULT   (1E-6)
#define IMPPMHDTYPE (   implicititer)    (implicititer==QTYPMHD ||implicititer==QTYPMHDENERGYONLY ||implicititer==QTYPMHDMOMONLY)

PMHD types.

Definition at line 953 of file phys.tools.rad.c.

#define IMPPTYPE (   implicititer)    (implicititer==QTYPMHD ||implicititer==QTYPMHDENERGYONLY ||implicititer==QTYPMHDMOMONLY || implicititer==QTYPRAD ||implicititer==QTYPRADENERGYONLY ||implicititer==QTYPRADMOMONLY || implicititer==QTYENTROPYPMHD ||implicititer==QTYENTROPYPMHDENERGYONLY ||implicititer==QTYENTROPYPMHDMOMONLY)

P or U types.

Definition at line 938 of file phys.tools.rad.c.

#define IMPRADTYPE (   implicititer)    (implicititer==QTYPRAD ||implicititer==QTYPRADENERGYONLY ||implicititer==QTYPRADMOMONLY || implicititer==QTYURAD ||implicititer==QTYURADENERGYONLY ||implicititer==QTYURADMOMONLY)

Definition at line 945 of file phys.tools.rad.c.

#define IMPRADTYPEBASE (   baseitermethod)    (baseitermethod==QTYPRAD || baseitermethod==QTYURAD)

Definition at line 950 of file phys.tools.rad.c.

#define IMPTRYCONV   (1.e-12)

Funny, even 1E-5 does ok with torus, no worse at Erf~ERADLIMIT instances. Also, does ~3 iterations, but not any faster than using 1E-12 with ~6 iterations.

Definition at line 221 of file phys.tools.rad.c.

#define IMPTRYCONV_RHORHIGHERTOL   (1E-3)

Definition at line 277 of file phys.tools.rad.c.

#define IMPTRYCONV_ROUTERHIGHERTOL   (1E-3)

Definition at line 278 of file phys.tools.rad.c.

#define IMPTRYCONV_TAUTOTMAXHIGHERTOL   (1E-4)

Definition at line 274 of file phys.tools.rad.c.

#define IMPTRYCONVABS   ((FTYPE)(NDIM+2)*trueimptryconv)

error for comparing to sum over all absolute errors

Definition at line 237 of file phys.tools.rad.c.

#define IMPTRYCONVALT   (MAX(1E-8,IMPTRYCONVABS))

Definition at line 289 of file phys.tools.rad.c.

#define IMPTRYCONVHIGHTAU   (NUMEPSILON*5.0)

Definition at line 215 of file phys.tools.rad.c.

#define IMPTRYCONVMARGINAL   (1.e-6)

Definition at line 233 of file phys.tools.rad.c.

#define IMPTRYCONVMARGINAL2   (1.e-6)

Definition at line 230 of file phys.tools.rad.c.

#define IMPTRYCONVQUICK   (1.e-6)

Definition at line 223 of file phys.tools.rad.c.

#define IMPTRYCONVSUPERQUICK   (1.e-3)

Definition at line 235 of file phys.tools.rad.c.

#define IMPTRYDAMPCONV   (5.0*IMPTRYCONVABS)

tolerance above which to continue to try damping

Definition at line 292 of file phys.tools.rad.c.

#define IMPUTYPE (   implicititer)    (implicititer==QTYUMHD ||implicititer==QTYUMHDENERGYONLY ||implicititer==QTYUMHDMOMONLY || implicititer==QTYURAD ||implicititer==QTYURADENERGYONLY ||implicititer==QTYURADMOMONLY || implicititer==QTYENTROPYUMHD ||implicititer==QTYENTROPYUMHDENERGYONLY ||implicititer==QTYENTROPYUMHDMOMONLY)

Definition at line 940 of file phys.tools.rad.c.

#define ITERATIONMARGINAL2   (4)

Definition at line 229 of file phys.tools.rad.c.

#define ITERCHECKEXPLICITSAFE   1
#define ITERMHDINVTRYHARDER   5

how many iterations before we try harder to get better 1D MHD inversion solution

Definition at line 283 of file phys.tools.rad.c.

#define ITERMODECOLD   2

Definition at line 472 of file phys.tools.rad.c.

#define ITERMODENORMAL   0

Definition at line 470 of file phys.tools.rad.c.

#define ITERMODESTAGES   1

Definition at line 471 of file phys.tools.rad.c.

#define JACLOOP (   jj,
  startjj,
  endjj 
)    for(jj=startjj;jj<=endjj;jj++)

Definition at line 1233 of file phys.tools.rad.c.

#define JACLOOP2D (   ii,
  jj,
  startjj,
  endjj 
)    JACLOOP(ii,startjj,endjj) JACLOOP(jj,startjj,endjj)

Definition at line 1248 of file phys.tools.rad.c.

#define JACLOOPALT (   jj,
  startjj,
  endjj 
)    DLOOPA(jj)

Definition at line 1234 of file phys.tools.rad.c.

#define JACLOOPFULLERROR (   itermode,
  jj,
  startjj,
  endjj 
)    for(jj=(itermode==ITERMODECOLD ? startjj : 0);jj<=(itermode==ITERMODECOLD ? endjj : NDIM-1);jj++)

Definition at line 1246 of file phys.tools.rad.c.

#define JACLOOPSUBERROR (   jj,
  startjj,
  endjj 
)    JACLOOP(jj,startjj,endjj)

Definition at line 1247 of file phys.tools.rad.c.

#define JACLOOPSUPERFULL (   pliter,
  pl,
  eomtype,
  baseitermethod,
  radinvmod 
)
Value:
PLOOPDYNAMICAL(pliter,pl) if(\
pl!=ENTROPY && pl!=UU && pl!=URAD0 \
|| (eomtype==EOMDEFAULT && EOMTYPE==EOMENTROPYGRMHD || eomtype==EOMENTROPYGRMHD || eomtype==EOMDIDENTROPYGRMHD) \
&& (pl==ENTROPY || pl==URAD0 && IMPMHDTYPEBASE(baseitermethod)==0 || IMPMHDTYPEBASE(baseitermethod)==1 && (pl==URAD0 && AVOIDURAD0IFRADINVMODANDPMHDMETHOD==0 || pl==URAD0 && AVOIDURAD0IFRADINVMODANDPMHDMETHOD==1 && radinvmod==0)) \
|| (eomtype==EOMDEFAULT && EOMTYPE==EOMGRMHD || eomtype==EOMGRMHD || eomtype==EOMDIDGRMHD) \
&& (pl==UU || pl==URAD0 && IMPMHDTYPEBASE(baseitermethod)==0 || IMPMHDTYPEBASE(baseitermethod)==1 && (pl==URAD0 && AVOIDURAD0IFRADINVMODANDPMHDMETHOD==0 || pl==URAD0 && AVOIDURAD0IFRADINVMODANDPMHDMETHOD==1 && radinvmod==0) ) \
)

Definition at line 1237 of file phys.tools.rad.c.

#define JACNPR   (NDIM)

Definition at line 1232 of file phys.tools.rad.c.

#define JDIFFCENTERED   1

Definition at line 8886 of file phys.tools.rad.c.

#define JDIFFONESIDED   0

Definition at line 8885 of file phys.tools.rad.c.

#define JONCHOICE   0

whether to choose Jon or Olek way of handling u2p_rad inversion failures

Definition at line 437 of file phys.tools.rad.c.

#define JONHOLDPOS   1

whether to apply Jon's hold on u_g or rho from going negative

Definition at line 513 of file phys.tools.rad.c.

#define LETPMHDFAIL   1

whether to just let PMHD fail and try it first no matter whether primary considerations say otherwise.

Definition at line 614 of file phys.tools.rad.c.

#define LOCALPREIMPCONVX   (10.0*NUMEPSILON)

Definition at line 565 of file phys.tools.rad.c.

#define LOCALPREIMPCONVXABS   ((FTYPE)(NDIM+2)*LOCALPREIMPCONVX)

Definition at line 566 of file phys.tools.rad.c.

#define M1REDUCE   TOOPACITYDEPENDENTFRAME

Definition at line 447 of file phys.tools.rad.c.

#define MAXEXPLICITSUBSTEPCHANGE   1.e-2

like SAFE for normal dt step, don't allow explicit substepping to change dt too fast to avoid instabilities.

Definition at line 386 of file phys.tools.rad.c.

#define MAXF1ITERRADTRY   (10)
#define MAXF1TRIES   20

Definition at line 358 of file phys.tools.rad.c.

#define MAXIMPEPS   (0.3)

maximum EPS for getting Jacobian

Definition at line 328 of file phys.tools.rad.c.

#define MAXJACDIM   (NDIM)

Definition at line 721 of file phys.tools.rad.c.

#define MAXJACITER   (10)

maximum number of times to (typically) increase EPS in getting Jacobian for implicit scheme. This might generally override MAXIMPEPS.

Definition at line 331 of file phys.tools.rad.c.

#define MAXMHDSTEPS   (trueimpmaxiter*6)

Definition at line 361 of file phys.tools.rad.c.

#define MAXSIGN (   x,
 
)    (fabs(x)>fabs(y) ? (x) : (y))
#define MAXSUBCYCLES   (2000)

Definition at line 352 of file phys.tools.rad.c.

#define MAXSUBCYCLESFAIL   (MAXSUBCYCLES*100)

if tries more than this number of sub-cycles, just fail and assume no 4-force since probably due to no actual solution even for implicit scheme due to sitting at radiative failure (e.g. gamma->gammamax or Erf->ERADLIMIT)

Definition at line 355 of file phys.tools.rad.c.

#define MINSIGN (   x,
 
)    (fabs(x)<fabs(y) ? (x) : (y))
#define MINTAUSOURCE   (NUMEPSILON)

below this , no source term applied.

KORALTODO: Need to fix implicit solver so avoids dU-del in fluid if no radiatoin-fluid interaction, else overestimates effect and inversion failures occur.

Definition at line 453 of file phys.tools.rad.c.

#define MINTRYCONVFORMHDINVERSION   (1E-4)

Definition at line 284 of file phys.tools.rad.c.

#define MODEMETHOD   MODEPICKBEST

choose to switch to entropy only if energy fails or gives u_g<0.

Or choose to always do both and use best solution.

Definition at line 669 of file phys.tools.rad.c.

#define MYEXTERN   extern

Definition at line 117 of file phys.tools.rad.c.

#define NEWJONHOLDPOS   0

Definition at line 515 of file phys.tools.rad.c.

#define NOTACTUALFAILURE (   failreturn)    (failreturn==FAILRETURNNOFAIL || failreturn==FAILRETURNMODESWITCH || failreturn==FAILRETURNGOTRIVIALEXPLICIT)

Definition at line 641 of file phys.tools.rad.c.

#define NOTBADFAILURE (   failreturn)    (failreturn==FAILRETURNNOFAIL || failreturn==FAILRETURNMODESWITCH || failreturn==FAILRETURNNOTTOLERROR || failreturn==FAILRETURNGOTRIVIALEXPLICIT)

Definition at line 642 of file phys.tools.rad.c.

#define NUMARGS   (211+11)
#define NUMDAMPATTEMPTS   (3*((DOPERF)==0) + 1*((DOPERF)==1))

Definition at line 580 of file phys.tools.rad.c.

#define NUMDAMPATTEMPTSQUICK   1

Definition at line 582 of file phys.tools.rad.c.

#define NUMERRORTYPES   2

determine which error will use when deciding if converged or not.

If only use iterated, then rest can be large error, and that's not desired. So generally should use WHICHERROR 1

Definition at line 405 of file phys.tools.rad.c.

#define NUMFRACDAMP   10
#define NUMHOLDTIMES   6

number of times allowed to hold u_g as positive

Definition at line 518 of file phys.tools.rad.c.

#define NUMJUMPCHECKSMAX   5
#define NUMNOERRORREDUCE   5

Definition at line 571 of file phys.tools.rad.c.

#define NUMNOERRORREDUCE0   (5 + mtd.BEGINNORMALSTEPS)

number of iterations by which to check (1st) whether after some number of times (2nd) error rose instead of reduced.

Definition at line 570 of file phys.tools.rad.c.

#define NUMNUMHIST   (20)
#define NUMPHASES   (6)
#define NUMPHASESCOLD   (1)
#define NUMPHASESENT   (8)
#define NUMPRIORERRORS   5

Definition at line 493 of file phys.tools.rad.c.

#define NUMPRIORERRORSITER0   7

number of prior iterations to see if error has dropped enough to seem relevant

Definition at line 492 of file phys.tools.rad.c.

#define NUMRESULTS   15
#define NUMUGNEGENERGY   (3)
#define OLEKCHOICE   1

Definition at line 438 of file phys.tools.rad.c.

#define PLOOPDYNAMICAL (   pliter,
  pl 
)    PLOOP(pliter,pl) if(SCALARPL(pl)==0)

Definition at line 199 of file phys.tools.rad.c.

#define POSTNEWTONCONVCHECK   1

whether to check pp-ppp 1: directly check post pp-ppp relative error and see if changes by LOCALPREIMPCONVX 2: directly check if any changes to pp during Newton step are bigger than DIFFXLIMIT.

Definition at line 560 of file phys.tools.rad.c.

#define PRIORERRORCHANGEREQUIRED   (0.5)

Definition at line 494 of file phys.tools.rad.c.

#define QTYENTROPYPMHD   15

Definition at line 932 of file phys.tools.rad.c.

#define QTYENTROPYPMHDENERGYONLY   16

Definition at line 933 of file phys.tools.rad.c.

#define QTYENTROPYPMHDMOMONLY   17

Definition at line 934 of file phys.tools.rad.c.

#define QTYENTROPYUMHD   12

Definition at line 929 of file phys.tools.rad.c.

#define QTYENTROPYUMHDENERGYONLY   13

Definition at line 930 of file phys.tools.rad.c.

#define QTYENTROPYUMHDMOMONLY   14

Definition at line 931 of file phys.tools.rad.c.

#define QTYPMHD   6

Definition at line 923 of file phys.tools.rad.c.

#define QTYPMHDENERGYONLY   7

Definition at line 924 of file phys.tools.rad.c.

#define QTYPMHDMOMONLY   8

Definition at line 925 of file phys.tools.rad.c.

#define QTYPRAD   9

Definition at line 926 of file phys.tools.rad.c.

#define QTYPRADENERGYONLY   10

Definition at line 927 of file phys.tools.rad.c.

#define QTYPRADMOMONLY   11

Definition at line 928 of file phys.tools.rad.c.

#define QTYUMHD   0

whether iterate or have as error function: MHD T^t_ or RAD R^t_, etc.

Definition at line 917 of file phys.tools.rad.c.

#define QTYUMHDENERGYONLY   1

Definition at line 918 of file phys.tools.rad.c.

#define QTYUMHDMOMONLY   2

Definition at line 919 of file phys.tools.rad.c.

#define QTYURAD   3

Definition at line 920 of file phys.tools.rad.c.

#define QTYURADENERGYONLY   4

Definition at line 921 of file phys.tools.rad.c.

#define QTYURADMOMONLY   5

Definition at line 922 of file phys.tools.rad.c.

#define RADDAMPDELTA   (0.5)

Definition at line 364 of file phys.tools.rad.c.

#define RADDAMPUNDELTA   (1.0/RADDAMPDELTA)

Definition at line 365 of file phys.tools.rad.c.

#define RAMESHFIXEARLYSTEPS   (DOSUBJAC==1 ? 0 : 3)

how many holds on u_g to apply while stepping velocity.

Definition at line 510 of file phys.tools.rad.c.

#define RAMESHSTOPENERGYIFTOOOFTENBELOWENTROPY   3

stop iterating energy if pbenergy[UU]<0.5*pbentropy[UU] consistently starting aafter below number of iterations and lasting for 2nd below number of iterations

Definition at line 522 of file phys.tools.rad.c.

#define REPORTMAXITERALLOWED   (PRODUCTION==0)

below 1 if reporting cases when MAXITER reached, but allowd error so not otherwise normally reported.

Definition at line 552 of file phys.tools.rad.c.

#define SIGNGD   (1.0)
#define SKIPJACCOMPUTE   (DOPERF)

Definition at line 321 of file phys.tools.rad.c.

#define SKIPJACFACTOR   (4)

Definition at line 323 of file phys.tools.rad.c.

#define SKIPJACITER   (4)

Definition at line 322 of file phys.tools.rad.c.

#define SPACETIMESUBSPLITALL   3

Definition at line 396 of file phys.tools.rad.c.

#define SPACETIMESUBSPLITMHDRAD   5

Definition at line 398 of file phys.tools.rad.c.

#define SPACETIMESUBSPLITNONE   1

Definition at line 394 of file phys.tools.rad.c.

#define SPACETIMESUBSPLITSUPERALL   4

Definition at line 397 of file phys.tools.rad.c.

#define SPACETIMESUBSPLITTIME   2

Definition at line 395 of file phys.tools.rad.c.

#define SPACETIMESUBSPLITTIMEMHDRAD   6

Definition at line 399 of file phys.tools.rad.c.

#define STOPIFITERLOWERROR   (0)

stop if iter error is low error

Definition at line 622 of file phys.tools.rad.c.

#define STOPIFVERYLOWERROR   (1)

stop if WHICHERROR is low error

Definition at line 620 of file phys.tools.rad.c.

#define SWITCHGOODIDEAFAILURE (   failreturn)    (failreturn==FAILRETURNGENERAL || failreturn==FAILRETURNJACISSUE || failreturn==FAILRETURNNOTTOLERROR || failreturn==FAILRETURNMODESWITCH)

Definition at line 646 of file phys.tools.rad.c.

#define SWITCHTODONOTHING   1

whether to use EOMDONOTHING if error is good enough.

1: always avoid external inversion (so no longer can do cold MHD, but cold MHD in 1 places is very bad). Or avoid energy switching to entropy, which also is bad.

Definition at line 576 of file phys.tools.rad.c.

#define SWITCHTOENTROPYIFCHANGESTOENTROPY   (0)

whether to allow changes in eomtype during implicit iterations generally not a good idea currently because overall scheme handles switching between eomtype's in separate full calls

Definition at line 529 of file phys.tools.rad.c.

#define TAUFAILLIMIT   (2.0/3.0)

Definition at line 377 of file phys.tools.rad.c.

#define TAUSUPPRESS   0

0 : tau suppression 1 : space-time merged 2 : all space merged but separate from time 3 : full split 4 : split even mhd and rad

Definition at line 393 of file phys.tools.rad.c.

#define TAUSWITCHPBVSPIIN   (2.0/3.0)

Definition at line 379 of file phys.tools.rad.c.

#define TAUTOTMAXHIGHERTOL   (-1.0)

Definition at line 273 of file phys.tools.rad.c.

#define TOFLUIDFRAME   1

Definition at line 444 of file phys.tools.rad.c.

#define TOOPACITYDEPENDENTFRAME   2

Definition at line 445 of file phys.tools.rad.c.

#define TOZAMOFRAME   0

Definition at line 443 of file phys.tools.rad.c.

#define TREATRADINVCAPASNONFAILUREFORPMHDMETHOD   (USECAPTYPEFIX2FORF1!=0)

whether to avoid back-tracing f1 calculation if rad inv hits cap, just push through if ==1.

Definition at line 611 of file phys.tools.rad.c.

#define TRYCOLD   1

Definition at line 12693 of file phys.tools.rad.c.

#define TRYFIRSTEXPLICIT   1

Definition at line 368 of file phys.tools.rad.c.

#define TRYHARDERFEEDGUESSTOL   (1E-4)

error below which to feed best guess into next attempt

Definition at line 537 of file phys.tools.rad.c.

#define USECAPTYPEFIX2FORF1   1

whether to use CAPTYPEFIX2 for f1 (central Jac and error estimate). Still will use CAPTYPEBASIC for final check, but this allows faster convergence or non-convergence as required.

Definition at line 605 of file phys.tools.rad.c.

#define USECAPTYPEFIX2FORFINALCHECK   1

"" for final check.

Definition at line 607 of file phys.tools.rad.c.

#define USEDUINRADUPDATE   1

whether to use dUriemann and dUgeom or other dU's sitting in dUother for radiation update -1 : use Uiin,piin 0: use Uiin,piin [initial U and initial p] // bad choice to use, e.g., uu0[RHO] should always be used 1: use uu0 for non-iterated U's and pb for non-iterated.

And Uiin's for iterated U's and piin for iterated p's. // balanced choice 2: use uu0,pb [initial+flux U and pb used to get flux] // maybe best for dynamical flows 3: use uu0,puu0 [initial+flux U and p] // costly since needs inversion, and probably no better than 1

Definition at line 426 of file phys.tools.rad.c.

#define USEINPUTASGUESSIFERRORSMALL   (WHICHERROR==1)

whether to use inputted uub, and pb as guess if errorabsreturn inputted is small enough makes sense in general only if WHICHERROR=1

Definition at line 430 of file phys.tools.rad.c.

#define USEPRIORITERMETHOD   0

whether to use history of methods to determine current method – KORALTODO: Needs work.

Definition at line 617 of file phys.tools.rad.c.

#define USERAMESH   0

whether to use ramesh solver as backup

Definition at line 534 of file phys.tools.rad.c.

#define UTOPRIMGENWRAPPERRETURNFAILMHD   (2)

Definition at line 784 of file phys.tools.rad.c.

#define UTOPRIMGENWRAPPERRETURNFAILRAD   (1)

Definition at line 783 of file phys.tools.rad.c.

#define UTOPRIMGENWRAPPERRETURNNOFAIL   (UTOPRIMNOFAIL)

mnemonics for return modes so schemes know how failed and what to do.

worse failure should be larger number

Definition at line 782 of file phys.tools.rad.c.

#define WHICHERROR   1

Definition at line 406 of file phys.tools.rad.c.

#define WHICHSPACETIMESUBSPLIT   TAUSUPPRESS

Definition at line 401 of file phys.tools.rad.c.

#define WHICHU2PRAD   1

0 : old Jon method 1 : Jon's paper draft method

Definition at line 591 of file phys.tools.rad.c.

#define WHICHVELRAMESH   VELREL4

Definition at line 8241 of file phys.tools.rad.c.

Function Documentation

static FTYPE calc_approx_ratchangeRtt ( struct of_state q,
FTYPE  chieff,
FTYPE  realdt 
)
static

Definition at line 10952 of file phys.tools.rad.c.

Here is the caller graph for this function:

void calc_chi ( FTYPE pr,
struct of_geom ptrgeom,
struct of_state q,
FTYPE chi 
)

Definition at line 10430 of file phys.tools.rad.c.

Here is the caller graph for this function:

static void calc_Gd ( FTYPE pp,
struct of_geom ptrgeom,
struct of_state q,
FTYPE G,
FTYPE Tgasreturn,
FTYPE Tradreturn,
FTYPE chieffreturn,
FTYPE ndotffreturn,
FTYPE ndotffabsreturn,
FTYPE Gabs 
)
static

get G_

Definition at line 10559 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void calc_Gu ( FTYPE pp,
struct of_geom ptrgeom,
struct of_state q,
FTYPE Gu,
FTYPE Tgasreturn,
FTYPE Tradreturn,
FTYPE chieffreturn,
FTYPE ndotffreturn,
FTYPE ndotffabsreturn,
FTYPE Gabs 
)
static

compute G^ 4-force

Definition at line 10674 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

FTYPE calc_LTE_EfromT ( FTYPE  T)

E=urad=arad T^4 (this is LTE only if put in T was gas T)

Definition at line 14181 of file phys.tools.rad.c.

Here is the caller graph for this function:

FTYPE calc_LTE_Efromurho ( FTYPE  u,
FTYPE  rho 
)

This will really give back only LTE E.

Definition at line 14208 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

FTYPE calc_LTE_NfromE ( FTYPE  E)

nrad(E)

Definition at line 14194 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

FTYPE calc_LTE_NfromT ( FTYPE  T)

nrad(T) = nrad=arad T^3/2.70118 (this is LTE only if put in T was gas T)

Definition at line 14188 of file phys.tools.rad.c.

Here is the caller graph for this function:

FTYPE calc_LTE_TfromE ( FTYPE  E)

E=urad=arad T^4 and just solve for T (this is LTE only if assume resulting T is gas T). If put in fluid-frame E, then correct T for radiation in fluid frame.

Definition at line 14201 of file phys.tools.rad.c.

Here is the caller graph for this function:

FTYPE calc_PEQ_Tfromurho ( FTYPE  u,
FTYPE  rho 
)

Definition at line 14174 of file phys.tools.rad.c.

Here is the caller graph for this function:

FTYPE calc_PEQ_ufromTrho ( FTYPE  T,
FTYPE  rho 
)

suplementary routines for conversions

Definition at line 14166 of file phys.tools.rad.c.

Here is the caller graph for this function:

int calc_Rij_ff ( FTYPE pp,
FTYPE  Rij[][NDIM] 
)

compute fluid frame orthonormal basis radiation stress-energy tensor assuming M1 closure

Definition at line 11159 of file phys.tools.rad.c.

Here is the caller graph for this function:

void calc_Tandopacityandemission ( FTYPE pr,
struct of_geom ptrgeom,
struct of_state q,
FTYPE  Ruu,
FTYPE  gammaradgas,
FTYPE  B,
FTYPE Tgas,
FTYPE Tradff,
FTYPE nradff,
FTYPE expfactorradff,
FTYPE kappa,
FTYPE kappan,
FTYPE kappaemit,
FTYPE kappanemit,
FTYPE kappaes,
FTYPE lambda,
FTYPE nlambda 
)

get {abs} and {es} in /mass * rho = 1/cm form.

energy density loss rate integrated over frequency and solid angle

Definition at line 10442 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int calc_tautot ( FTYPE pp,
struct of_geom ptrgeom,
struct of_state q,
FTYPE tautot,
FTYPE tautotmax 
)

calculates total opacity over dx[]

Definition at line 14147 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int calc_tautot_chieff ( FTYPE pp,
FTYPE  chi,
struct of_geom ptrgeom,
struct of_state q,
FTYPE tautot,
FTYPE tautotmax 
)
static

calculates total opacity over dx[] for given chi or chieff

Definition at line 14076 of file phys.tools.rad.c.

Here is the caller graph for this function:

static void calc_Trad ( FTYPE pp,
struct of_geom ptrgeom,
struct of_state q,
FTYPE Trad,
FTYPE nrad,
FTYPE expfactorrad 
)
static

compute Trad (also computed directly in calc_Gu() above) using only primitives (not using conserved quantities)

Definition at line 10850 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void calc_Trad_fromRuuandgamma ( FTYPE pp,
struct of_geom ptrgeom,
FTYPE  Ruu,
FTYPE  gammaradgas,
FTYPE Trad,
FTYPE nrad,
FTYPE expfactorrad 
)
static

compute Trad (also computed directly in calc_Gu() above) using only primitives (not using conserved quantities)

Definition at line 10894 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int calcfull_tautot ( FTYPE pp,
struct of_geom ptrgeom,
FTYPE tautot,
FTYPE tautotmax 
)

Definition at line 14136 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void calcfull_Trad ( FTYPE pp,
struct of_geom ptrgeom,
FTYPE Trad,
FTYPE nrad,
FTYPE expfactorrad 
)
static

Definition at line 10839 of file phys.tools.rad.c.

Here is the call graph for this function:

static FTYPE compute_dt ( int  isexplicit,
FTYPE CUf,
FTYPE CUimp,
FTYPE  dtin 
)
static

compute dt for this sub-step

Definition at line 2719 of file phys.tools.rad.c.

Here is the caller graph for this function:

static int compute_ZAMORAD ( FTYPE uu,
struct of_geom ptrgeom,
FTYPE Er,
FTYPE Utildesq,
FTYPE Utildecon 
)
static

compute ZAMO version of radiation quantities as in paper draft

Definition at line 12653 of file phys.tools.rad.c.

Here is the caller graph for this function:

double d_sign ( doublereal aa,
doublereal bb 
)

f2c prototype

Definition at line 96 of file phys.tools.rad.c.

void f_exit ( void  )

Here is the caller graph for this function:

static int f_implicit ( int  allowbaseitermethodswitch,
int  iter,
int  f1iter,
int  failreturnallowable,
int  whichcall,
FTYPE  impeps,
int  showmessages,
int  showmessagesheavy,
int  allowlocalfailurefixandnoreport,
int *  eomtype,
int  whichcap,
int  itermode,
int *  baseitermethod,
FTYPE  fracenergy,
FTYPE  dissmeasure,
int *  radinvmod,
FTYPE  conv,
FTYPE  convabs,
FTYPE  allowconvabs,
int  maxiter,
FTYPE  realdt,
int  dimtypef,
FTYPE dimfactU,
FTYPE ppprev,
FTYPE pp,
FTYPE piin,
FTYPE uuprev,
FTYPE Uiin,
FTYPE uu0,
FTYPE uu,
FTYPE  localdt,
struct of_geom ptrgeom,
struct of_state q,
FTYPE f,
FTYPE fnorm,
FTYPE freport,
int *  goexplicit,
FTYPE errorabs,
FTYPE errorallabs,
int  whicherror,
int *  convreturn,
int *  nummhdinvsreturn,
FTYPE tautotmaxreturn,
struct of_method mtd,
struct of_refU ru 
)
static

uu0 - original cons.

qty uu – current iteration f - (returned) errors returns error function for which we seek to be zero using Newton's method, which solves the implicit problem. failreturnallowable : what failure level to allow so that push through and continue despite the failure whichcall : which call to this function showmessages: allowlocalfailurefixandnoreport: pp : primitive (associated with uu) used as guess for inversion as well as for returning inversion result for later quicker inversion uu0 : reference initial conserved quantity representing U_n for implicit problem uu : current conserved quantity representing U_{n+1} that solves implicit problem localdt : timestep for 4-force ptrgeom: f : error function returrned fnorm : norm of error function for esimating relative error in f.

returns: eomtype, radinvmod,pp,uu,q,f,fnorm,freport,goexplicit,errorabs,converturn

Definition at line 1554 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_implicit_iJ ( int  allowbaseitermethodswitch,
int  failreturnallowableuse,
int  showmessages,
int  showmessagesheavy,
int  allowlocalfailurefixandnoreport,
int *  eomtypelocal,
int  whichcap,
int  itermode,
int *  baseitermethod,
FTYPE  fracenergy,
FTYPE  dissmeasure,
FTYPE  impepsjac,
FTYPE  trueimptryconv,
FTYPE  trueimptryconvabs,
FTYPE  trueimpallowconvabs,
int  trueimpmaxiter,
int  iter,
FTYPE  errorabs,
FTYPE  errorallabs,
int  whicherror,
int  dimtypef,
FTYPE dimfactU,
FTYPE Uiin,
FTYPE uu,
FTYPE uup,
FTYPE uu0,
FTYPE piin,
FTYPE pp,
FTYPE ppp,
FTYPE  fracdtG,
FTYPE  realdt,
struct of_geom ptrgeom,
struct of_state q,
FTYPE f1,
FTYPE f1norm,
FTYPE(*)  iJ[NPR],
int *  nummhdinvsreturn,
struct of_method mtd,
struct of_refU ru 
)
static

calculating approximate Jacobian: dUresid(dUrad,G(Urad))/dUrad = dy(x)/dx then compute inverse Jacobian

Definition at line 8892 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_m1closure_Erf ( struct of_geom ptrgeom,
FTYPE Avcon,
FTYPE  gammarel2,
FTYPE Erfreturn 
)
static

get Erf

Definition at line 13151 of file phys.tools.rad.c.

Here is the caller graph for this function:

static int get_m1closure_gammarel2 ( int  showmessages,
struct of_geom ptrgeom,
FTYPE Avcon,
FTYPE Avcov,
FTYPE gammarel2return,
FTYPE deltareturn,
FTYPE numeratorreturn,
FTYPE divisorreturn 
)
static

get's gamma^2 for lab-frame gamma using Rd and gcon

Definition at line 13055 of file phys.tools.rad.c.

static int get_m1closure_gammarel2_cold ( int  showmessages,
struct of_geom ptrgeom,
FTYPE Avcon,
FTYPE Avcov,
FTYPE gammarel2return,
FTYPE deltareturn,
FTYPE numeratorreturn,
FTYPE divisorreturn,
FTYPE Erfreturn,
FTYPE urfconrel 
)
static

get's gamma assuming fixed E rather than using original R^t_t that we assume is flawed near floor regions. We want to preserve R^t_i (i.e conserved momentum)

Definition at line 13939 of file phys.tools.rad.c.

Here is the caller graph for this function:

static int get_m1closure_urfconrel ( int  showmessages,
int  allowlocalfailurefixandnoreport,
struct of_geom ptrgeom,
FTYPE pp,
FTYPE Avcon,
FTYPE Avcov,
FTYPE  gammarel2,
FTYPE  delta,
FTYPE  numerator,
FTYPE  divisor,
FTYPE Erfreturn,
FTYPE urfconrel,
PFTYPE lpflag,
PFTYPE lpflagrad 
)
static

get contravariant relative 4-velocity in lab frame

Definition at line 13349 of file phys.tools.rad.c.

Here is the call graph for this function:

static int get_m1closure_urfconrel_olek ( int  showmessages,
int  allowlocalfailurefixandnoreport,
struct of_geom ptrgeom,
FTYPE pp,
FTYPE Avcon,
FTYPE Avcov,
FTYPE  gammarel2,
FTYPE  delta,
FTYPE Erfreturn,
FTYPE urfconrel,
PFTYPE lpflag,
PFTYPE lpflagrad 
)
static

get contravariant relative 4-velocity in lab frame using Olek's koral choices

Definition at line 13587 of file phys.tools.rad.c.

Here is the call graph for this function:

int get_state_uradconuradcovonly ( FTYPE pr,
struct of_geom ptrgeom,
struct of_state q 
)

Get only u^ and u_ assumine b^ and b_ not used.

Definition at line 11096 of file phys.tools.rad.c.

Here is the caller graph for this function:

integer i_dnnt ( doublereal x)

Definition at line 110 of file phys.tools.rad.c.

int koral_source_rad ( int  whichradsourcemethod,
FTYPE piin,
FTYPE pb,
FTYPE pf,
int *  didreturnpf,
int *  eomtype,
FTYPE Uiin,
FTYPE Ufin,
FTYPE CUf,
FTYPE CUimp,
struct of_geom ptrgeom,
struct of_state q,
FTYPE  dissmeasure,
FTYPE dUother,
FTYPE(*)  dUcomp[NPR] 
)

General radiation source term calculation (EXTERNALLY called) NOTE: source_explicit() takes as first argument a form of function like general koral_source_rad_calc() .

It doesn't have to be just used for radiation. NOTE: koral_source_rad_implicit() currently only works for radiation where only 4 equations involved since 4-force of rad affects exactly mhd. So only invert 4x4 matrix. For recursion of other consistencies, should keep koral_source_rad() same function arguments as explicit and implicit functions. Once make koral_source_rad() general, can use this function as general source function instead of it getting called just for radiation.

Definition at line 10073 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void koral_source_rad_calc ( int  computestate,
int  computeentropy,
FTYPE pr,
struct of_geom ptrgeom,
FTYPE Gdpl,
FTYPE Gdplabs,
FTYPE chi,
FTYPE Tgas,
FTYPE Trad,
struct of_state q 
)

get 4-force for all pl's

Definition at line 10568 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int koral_source_rad_implicit ( int *  eomtype,
FTYPE pb,
FTYPE pf,
FTYPE piin,
FTYPE Uiin,
FTYPE Ufin,
FTYPE CUf,
FTYPE CUimp,
struct of_geom ptrgeom,
struct of_state q,
FTYPE  dissmeasure,
FTYPE dUother,
FTYPE(*)  dUcomp[NPR] 
)
static

wrapper for mode method

Definition at line 2744 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int koral_source_rad_implicit_mode ( int  modemethodlocal,
int  allowbaseitermethodswitch,
int  modprim,
int  havebackup,
int  didentropyalready,
int *  eomtype,
int  whichcap,
int  itermode,
int *  baseitermethod,
FTYPE  trueimptryconv,
FTYPE  trueimpokconv,
FTYPE  trueimpallowconv,
int  trueimpmaxiter,
int  truenumdampattempts,
FTYPE  fracenergy,
FTYPE  dissmeasure,
int *  radinvmod,
FTYPE pb,
FTYPE uub,
FTYPE piin,
FTYPE Uiin,
FTYPE Ufin,
FTYPE CUf,
FTYPE CUimp,
struct of_geom ptrgeom,
struct of_state q,
FTYPE dUother,
FTYPE(*)  dUcomp[NPR],
FTYPE errorabsreturn,
FTYPE errorabsbestexternal,
int *  itersreturn,
int *  f1itersreturn,
int *  nummhdinvsreturn,
int *  nummhdstepsreturn 
)
static

compute changes to U (both T and R) using implicit method KORALTODO: If doing implicit, should also add geometry source term that can sometimes be stiff.

Would require inverting sparse 8x8 matrix (or maybe 6x6 since only r- for SPC). Could be important for very dynamic radiative flows.

return

Definition at line 5491 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void mhd_calc_rad ( FTYPE pr,
int  dir,
struct of_geom ptrgeom,
struct of_state q,
FTYPE radstressdir,
FTYPE radstressdirabs 
)

compute radiation stres-energy tensor assuming M1 closure

Definition at line 11124 of file phys.tools.rad.c.

Here is the caller graph for this function:

void mhdfull_calc_rad ( FTYPE pr,
struct of_geom ptrgeom,
struct of_state q,
FTYPE(*)  radstressdir[NDIM] 
)

Definition at line 11111 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

FTYPE my_min ( FTYPE  aa,
FTYPE  bb 
)

Definition at line 11239 of file phys.tools.rad.c.

FTYPE my_sign ( FTYPE  x)

Definition at line 11245 of file phys.tools.rad.c.

static int opacity_interpolated_urfconrel ( FTYPE  tautotmax,
FTYPE pp,
struct of_geom ptrgeom,
FTYPE Avcon,
FTYPE  Erf,
FTYPE  gammarel2,
FTYPE Erfnew,
FTYPE urfconrel 
)
static

interpolate between optically thick and thin limits when no u2p_rad() inversion solution

Definition at line 12901 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

double pow_dd ( doublereal ap,
doublereal bp 
)

Definition at line 175 of file phys.tools.rad.c.

int prad_fforlab ( int *  whichvel,
int *  whichcoord,
int  whichdir,
int  i,
int  j,
int  k,
int  loc,
struct of_geom ptrgeom,
FTYPE pradffortho,
FTYPE pin,
FTYPE pout 
)

radiative ortonormal ff primitives (E,F^i) <-> primitives in lab frame Used only for initial conditions whichvel: input vel type for U1-U3 whichcoord: input coord type for both U1-U3 and URAD1-URAD3 whichdir: LAB2FF or FF2LAB .

In addition, here lab means HARM-lab different by alpha factor from true lab. i,j,k,loc = standard grid location ptrgeom: any input geometry for the lab frame (ptrgeom could be from MCOORD, PRIMECOORDS, etc.) (same for pin's velocity as well as orthonormal basis) If ptrgeom==NULL, then use i,j,k,loc to get geometry in whichcoord coordinates pradffortho: radiation primitives (PRAD0-3) should be fluid-frame orthonormal basis values (i.e. E,F in fluid frame orthonormal basis) pin: inputs for primitives (i.e. whichvel for U1-U3 and whichcoord for U1-U3,URAD1-URAD3) pout: outputs for primitives ("")

Definition at line 11432 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int prad_fftolab ( int *  whichvel,
int *  whichcoord,
int  i,
int  j,
int  k,
int  loc,
struct of_geom ptrgeom,
FTYPE pradffortho,
FTYPE pin,
FTYPE pout 
)

like prad_fforlab() but for only whichdir=FF2LAB used for IC

Definition at line 11526 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int prad_labtoff ( int *  whichvel,
int *  whichcoord,
int  i,
int  j,
int  k,
int  loc,
struct of_geom ptrgeom,
FTYPE pradffortho,
FTYPE pin,
FTYPE pout 
)

like prad_fforlab() but for only whichdir=LAB2FF used for dumps or diags

Definition at line 11448 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int primefluid_EVrad_to_primeall ( int *  whichvel,
int *  whichcoord,
struct of_geom ptrgeom,
FTYPE pin,
FTYPE pout 
)

for BCs, to take E[radiation frame] and u^i as radiation primitives in whichvel/whichcoord obtains WHICHVEL/PRIMECOORD primitives

Definition at line 11684 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int s_stop ( char *  s,
ftnlen  n 
)

Definition at line 135 of file phys.tools.rad.c.

Here is the call graph for this function:

int set_ncon_velocity ( int  whichvel,
FTYPE  gammamax,
FTYPE ncon,
struct of_geom ptrgeom,
FTYPE uconwhichvel 
)

set velocity based upon ncon and gammamax and return in whichvel format for the ptrgeom geometry/coords

Definition at line 14217 of file phys.tools.rad.c.

Here is the call graph for this function:

static void setgasinversionstuff ( int  iter,
int  whichcall,
FTYPE  impeps,
FTYPE  errorabs,
FTYPE  convabs,
int  maxiter,
struct of_newtonstats newtonstats,
int *  checkoninversiongas,
int *  checkoninversionrad 
)
static

Definition at line 1493 of file phys.tools.rad.c.

Here is the caller graph for this function:

static int simplefast_rad ( int  dir,
struct of_geom geom,
struct of_state q,
FTYPE  vrad2,
FTYPE vmin,
FTYPE vmax 
)
static

get lab-frame 3-velocity for radiative emission in radiative frame

Definition at line 11057 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int u2p_rad ( int  showmessages,
int  allowlocalfailurefixandnoreport,
FTYPE  gammamaxrad,
int  whichcap,
FTYPE uu,
FTYPE pin,
struct of_geom ptrgeom,
PFTYPE lpflag,
PFTYPE lpflagrad 
)

Definition at line 11984 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int u2p_rad_new ( int  showmessages,
int  allowlocalfailurefixandnoreport,
FTYPE  gammamaxrad,
int  whichcap,
FTYPE uu,
FTYPE pin,
struct of_geom ptrgeom,
PFTYPE lpflag,
PFTYPE lpflagrad 
)

Like u2p_rad_orig(), but uses Jon's paper draft ZAMO RAD version.

Definition at line 12300 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int vchar_rad ( FTYPE pr,
struct of_state q,
int  dir,
struct of_geom geom,
FTYPE vmax,
FTYPE vmin,
FTYPE vmax2,
FTYPE vmin2,
int *  ignorecourant 
)

compute radiative characteristics as limited by opacity

Definition at line 10975 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int whichfluid_ffrad_to_primeall ( int *  whichvel,
int *  whichcoordfluid,
int *  whichcoordrad,
struct of_geom ptrgeomprimecoords,
FTYPE pradffortho,
FTYPE pin,
FTYPE pout 
)

Input: start with pin [with fluid in whichvel velocity and whichcoordfluid coordinates (PRIMECOORDS or MCOORD) and radiation as E,F in fluid frame orthonormal basis in whichcoordrad coordinates] Output: pout [with all WHICHVEL PRIMECOORDS and radiation using velocity primitive].

Useful for BCs when have (say) VEL3,MCOORD for fluid velocity as well as E,F in ff for radiation and need normal WHICHVEL PRIMECOORDS fluid velocity as well as normal velocity primitive for radiation

Definition at line 11729 of file phys.tools.rad.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

FTYPE globalpin[NPR]

Definition at line 12697 of file phys.tools.rad.c.

FTYPE globaluu[NPR]

Definition at line 12696 of file phys.tools.rad.c.