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

All locally-related physics calculations THINGS IN HERE ARE PER-POINT and use only LOCAL variables (no globals) More...

#include "decs.h"
Include dependency graph for phys.tools.c:

Go to the source code of this file.

Macros

#define VARSTATIC
 

Functions

int primtoflux (int returntype, FTYPE *pr, struct of_state *q, int dir, struct of_geom *geom, FTYPE *flux, FTYPE *fluxabs)
 Calculate fluxes in direction dir and conserved variable U returntype==0 : flux with geometric factor geom->e (used by evolution code) returntype==1 : flux with physical geometry factor geom->gdet (used by diagnostics) see UtoU and source_conn() Note that if MAXWELL==PRIMMAXWELL then primtoflux doesn't use b^ or b_ (bcon and bcov) More...
 
int primtoflux_nonradonly (int needentropy, FTYPE *pr, struct of_state *q, int dir, struct of_geom *geom, FTYPE *flux, FTYPE *fluxabs)
 
int primtoflux_radonly (FTYPE *pr, struct of_state *q, int dir, struct of_geom *geom, FTYPE *flux, FTYPE *fluxabs)
 
int primtoflux_ma (int needentropy, int *returntype, FTYPE *pr, struct of_state *q, int dir, struct of_geom *geom, FTYPE *flux, FTYPE *fluxabs, FTYPE *fluxdiag, FTYPE *fluxdiagabs)
 matter only terms (as if B=0) More...
 
int primtoflux_rad (int *returntype, FTYPE *pr, struct of_state *q, int dir, struct of_geom *geom, FTYPE *flux, FTYPE *fluxabs)
 radiation terms (as if rho=u=p=0) More...
 
int primtoflux_em (int *returntype, FTYPE *pr, struct of_state *q, int dir, struct of_geom *geom, FTYPE *flux, FTYPE *fluxabs)
 electromagnetic terms (as if rho=u=p=0) More...
 
int massflux_calc (FTYPE *pr, int dir, struct of_state *q, FTYPE *massflux, FTYPE *massfluxabs)
 
int yflflux_calc (struct of_geom *ptrgeom, FTYPE *pr, int dir, struct of_state *q, FTYPE *advectedscalarflux, FTYPE *advectedscalarfluxabs, int pnum)
 flux associated with Y_fl variable More...
 
int ylflux_calc (struct of_geom *ptrgeom, FTYPE *pr, int dir, struct of_state *q, FTYPE *advectedscalarflux, FTYPE *advectedscalarfluxabs, int pnum)
 flux associated with Y_L variable More...
 
int ynuflux_calc (struct of_geom *ptrgeom, FTYPE *pr, int dir, struct of_state *q, FTYPE *advectedscalarflux, FTYPE *advectedscalarfluxabs, int pnum)
 flux asociated with Ynu variable More...
 
int advectedscalarflux_calc (FTYPE *pr, int dir, struct of_state *q, FTYPE *advectedscalarflux, FTYPE *advectedscalarfluxabs, int pnum)
 flux of scalar More...
 
int entropyflux_calc (FTYPE *pr, int dir, struct of_state *q, FTYPE *entropyflux, FTYPE *entropyfluxabs)
 flux of specific entropy More...
 
int dualfaradayspatial_calc (FTYPE *pr, int dir, struct of_state *q, FTYPE *dualf, FTYPE *dualfabs)
 spatial part of dualfaraday More...
 
int dualfullfaraday_calc (FTYPE *pr, int dir, struct of_state *q, FTYPE *dualffull)
 Notation for HARM paper and JCM's GRFFE paper is that: B^ = *F^{} and for lab-frame we chose ={-1,0,0,0}. More...
 
int primtofullflux (int returntype, FTYPE *pr, struct of_state *q, struct of_geom *ptrgeom, FTYPE(*flux)[NPR], FTYPE(*fluxabs)[NPR])
 returns entire space-time(NDIM in size) / EOM(NPR in size) matrix More...
 
int primtoU (int returntype, FTYPE *pr, struct of_state *q, struct of_geom *geom, FTYPE *U, FTYPE *Uabs)
 calculate "conserved" quantities More...
 
void PtoP (int inputtype, int returntype, struct of_geom *ptrgeom, FTYPE *pin, FTYPE *pout)
 standardized primitive form is assumed to be , u, {u}^ , *F^{it}=B^i where {u} is relative 4-velocity, as relative to $n_ = (-,0,0,0)$ and $^2=-1/g^{tt}$. More...
 
void bcon_calc (FTYPE *pr, FTYPE *ucon, FTYPE *ucov, FTYPE *bcon)
 calculate magnetic field four-vector More...
 
void Bcon_calc (struct of_state *q, FTYPE *B)
 inverse of bcon_calc() More...
 
void vbtopr (FTYPE *vcon, FTYPE *bcon, struct of_geom *geom, FTYPE *pr)
 convert (e^=0 case) b^ and (3-velocity in coordinate lab frame) v^ to pr More...
 
void mhd_calc (FTYPE *pr, int dir, struct of_geom *geom, struct of_state *q, FTYPE *mhd, FTYPE *mhdabs)
 MHD stress tensor, with first index up, second index down mhd^dir_j. More...
 
void mhd_calc_ma (FTYPE *pr, int dir, struct of_geom *geom, struct of_state *q, FTYPE *mhd, FTYPE *mhdabs, FTYPE *mhddiagpress, FTYPE *mhddiagpressabs)
 MHD stress tensor, with first index up, second index down mhd^dir_j understood that mhddiagpress only contains non-zero element on mhddiagpress[dir] and all others should be 0.0. More...
 
void mhd_calc_em (FTYPE *pr, int dir, struct of_geom *geom, struct of_state *q, FTYPE *mhd, FTYPE *mhdabs)
 MHD stress tensor, with first index up, second index down mhd^dir_j. More...
 
void mhd_calc_0_ma (FTYPE *pr, int dir, struct of_state *q, FTYPE *mhd, FTYPE *mhdabs, FTYPE *mhddiagpress, FTYPE *mhddiagpressabs)
 MHD stress tensor, with first index up, second index down. More...
 
void mhd_calc_0_em (FTYPE *pr, int dir, struct of_state *q, FTYPE *mhd, FTYPE *mhdabs)
 EM part of stress-energy tensor. More...
 
void mhd_calc_norestmass (FTYPE *pr, int dir, struct of_geom *geom, struct of_state *q, FTYPE *mhd, FTYPE *mhdabs)
 MHD stress tensor, with first index up, second index down avoids catastrophic cancellation with rest-mass density due to extracting velocity or internal energy from that conserved energy with order unity term from rest-mass also avoids catastrophic cancellation in field due to using 4-field. More...
 
void mhd_calc_norestmass_ma (FTYPE *pr, int dir, struct of_geom *geom, struct of_state *q, FTYPE *mhd, FTYPE *mhdabs, FTYPE *mhddiagpress, FTYPE *mhddiagpressabs)
 MHD stress tensor, with first index up, second index down avoids catastrophic cancellation with rest-mass density due to extracting velocity or internal energy from that conserved energy with order unity term from rest-mass also avoids catastrophic cancellation in field due to using 4-field. More...
 
void mhd_calc_primfield_em (FTYPE *pr, int dir, struct of_geom *geom, struct of_state *q, FTYPE *mhd, FTYPE *mhdabs)
 MHD stress tensor, with first index up, second index down avoids catastrophic cancellation with rest-mass density due to extracting velocity or internal energy from that conserved energy with order unity term from rest-mass also avoids catastrophic cancellation in field due to using 4-field. More...
 
void compute_1plusud0_general (FTYPE *pr, struct of_geom *geom, struct of_state *q, FTYPE *plus1ud0)
 plus1ud0=(1+q->ucov[TT]) avoids both non-rel and rel limit issues with machine precision GODMARK: Slow, can one optmize this somehow? This computes 1+u_t , which for nonrelativistic cases is ~0 . More...
 
void compute_1plusud0_rel4vel (FTYPE *pr, struct of_geom *geom, struct of_state *q, FTYPE *plus1ud0)
 latest method to compute 1+u_t without catastrophic cancellation More...
 
int source (FTYPE *pi, FTYPE *pr, FTYPE *pf, int *didreturnpf, int *eomtype, struct of_geom *ptrgeom, struct of_state *q, FTYPE *ui, FTYPE *uf, FTYPE *CUf, FTYPE *CUimp, FTYPE dissmeasure, FTYPE *dUriemann, FTYPE(*dUcomp)[NPR], FTYPE *dU)
 add in source terms to equations of motion ui and dUriemann in UEVOLVE form assume q(pr) so consistent, but p or ui don't yet account for dUriemann! More...
 
int bsq_calc_general (FTYPE *pr, struct of_geom *ptrgeom, FTYPE *bsq)
 returns b^2 (i.e., twice magnetic pressure) More...
 
int bsq_calc_fromq_general (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q, FTYPE *bsq)
 returns b^2 (i.e., twice magnetic pressure) More...
 
int bsq_calc_rel4vel (FTYPE *pr, struct of_geom *ptrgeom, FTYPE *bsq)
 returns b^2 (i.e., twice magnetic pressure) More...
 
int bsq_calc_fromq_rel4vel (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q, FTYPE *bsq)
 
void lowerf (FTYPE *fcon, struct of_geom *geom, FTYPE *fcov)
 
int get_state (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure} More...
 
int get_state_radonly (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure} More...
 
int get_state_norad_part1 (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure} More...
 
int get_state_norad_part2 (int needentropy, FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure} More...
 
int get_state_nofield (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 all get_state() things except the field quantities More...
 
int get_stateforcheckinversion (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 used to check inversion, which has consistent pressure used to get things as functions of instead of u in case of using jon's inversion More...
 
int pureget_stateforfluxcalc (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure,g,e[pl],prim,Blower} More...
 
int pureget_stateforsource (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure} More...
 
int pureget_stateforinterpline (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure} More...
 
int pureget_stateforglobalwavespeeds (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure} More...
 
int pureget_stateforfluxcalcorsource (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure,g,e[pl],prim,Blower} More...
 
int get_state_uconucovonly (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 Get only u^ and u_ assumine b^ and b_ not used. More...
 
int get_state_thermodynamics_forcheckinversion (struct of_geom *ptrgeom, FTYPE *pr, struct of_state *q)
 separate function for getting thermodynamical quantities More...
 
int get_state_prims (FTYPE *pr, struct of_state *q)
 separate function for getting primitives More...
 
int get_state_geom (FTYPE *pr, struct of_geom *ptrgeom, struct of_state *q)
 separate function for getting geometry More...
 
int invertentropyflux_calc (struct of_geom *ptrgeom, FTYPE entropyflux, int dir, struct of_state *q, FTYPE *pr)
 ptrgeom->i,ptrgeom->j,ptrgeom->k,ptrgeom->p More...
 
int ufromentropy_calc (struct of_geom *ptrgeom, FTYPE entropy, FTYPE *pr)
 u from entropy (uses pr[RHO]) wrapper More...
 
int ucon_calc_rel4vel_fromuconrel (FTYPE *uconrel, struct of_geom *geom, FTYPE *ucon, FTYPE *others)
 find u^ from {u}^ fill full 4-vector OPTMARK: Before storing , this was the most expensive function over the entire code [determined by avoiding inlining] More...
 
int uconrel (FTYPE *ucon, FTYPE *uconrel, struct of_geom *geom)
 find {u}^ from u^ only fill spatial parts so can feed in 3-vector More...
 
int ucon_calc_rel4vel (FTYPE *pr, struct of_geom *geom, FTYPE *ucon, FTYPE *others)
 find contravariant four-velocity from the relative 4 velocity More...
 
int ucon_calc_whichvel (int whichvel, FTYPE *pr, struct of_geom *geom, FTYPE *ucon, FTYPE *others)
 
int gamma_calc_fromuconrel (FTYPE *uconrel, struct of_geom *geom, FTYPE *gamma, FTYPE *qsq)
 find gamma-factor wrt normal observer This function and qsq_calc() have about the same cache miss amount now More...
 
int ucon_calc_3vel (FTYPE *pr, struct of_geom *geom, FTYPE *ucon, FTYPE *others)
 find contravariant four-velocity int ucon_calc(FTYPE *pr, struct of_geom *geom, FTYPE *ucon, FTYPE *others) More...
 
int ucon_calc_4vel_bothut (FTYPE *pr, struct of_geom *geom, FTYPE *ucon, FTYPE *ucon2, FTYPE *others)
 find contravariant time component of four-velocity from the 4velocity (3 terms) More...
 
int ucon_calc_4vel (FTYPE *pr, struct of_geom *geom, FTYPE *ucon, FTYPE *others)
 find contravariant time component of four-velocity from the 4velocity (3 terms) More...
 
int ucon_calc_nonrel (FTYPE *pr, struct of_geom *geom, FTYPE *ucon, FTYPE *others)
 find contravariant time component of four-velocity from the 4velocity (3 terms) More...
 
FTYPE taper_func (FTYPE R, FTYPE rin)
 
FTYPE lc4 (int updown, FTYPE detg, int mu, int nu, int kappa, int lambda)
 used Mathematica's MinimumChangePermutations and Signature updown = 0 : down updown = 1 : up More...
 
void faraday_calc (int which, FTYPE *b, FTYPE *u, struct of_geom *geom, FTYPE(*faraday)[NDIM])
 Compute faraday assumes b and u are inputted as bcov&ucov for F^{} and bcon&ucon for F_{}. More...
 
FTYPE sign_bad (FTYPE a)
 assumes below get inlined much faster than macro using ? : super slow for get_geometry()'s sign() call! More...
 
FTYPE sign_func (FTYPE a)
 not any faster than above (except when used alot) More...
 
FTYPE signavoidzero (FTYPE a)
 much faster than macro using ? : Generally avoid using, instead do: igdet = sign(geom.gdet)/(fabs(geom.gdet)+SMALL) More...
 
FTYPE max (FTYPE a, FTYPE b)
 
FTYPE min (FTYPE a, FTYPE b)
 
void projectionvec (int vcon, int vresultcon, struct of_state *q, struct of_geom *geom, FTYPE *v, FTYPE *vresult)
 take projection of v onto u, both are 4-vectors vcon=0 or 1 : whether or not ucon (1=true, 0=ucov) same for vresultcon More...
 
void compute_gconttplus1 (struct of_geom *geom, FTYPE *gconttplus1)
 g^{tt}+1 accurate for non-rel gravity to order v^2 without machine precision problems More...
 
int OBtopr_general (FTYPE omegaf, FTYPE *Bccon, struct of_geom *geom, FTYPE *pr)
 input and B^i (code's version) and get back primitive assuming stationary/axisymmetric flow More...
 
int OBtopr_general2 (FTYPE omegaf, FTYPE v0, FTYPE *Bccon, struct of_geom *geom, FTYPE *pr)
 input , 3-vel along field (scalar quantity really), and B^i (code's version) and get back primitive assuming stationary/axisymmetric flow More...
 
int OBtopr_general3 (FTYPE omegaf, FTYPE v0, FTYPE *Bccon, struct of_geom *geom, FTYPE *pr)
 input , extra 3-vel along field (scalar quantity really), and B^i (code's version) and get back primitive assuming stationary/axisymmetric flow More...
 
int OBtopr_general3p (FTYPE omegaf, FTYPE v0, FTYPE *Bccon, struct of_geom *geom, FTYPE *pr)
 input , extra 3-vel along the poloidal field (scalar quantity really), and B^i (code's version) and get back primitive assuming stationary/axisymmetric flow More...
 
int OBtopr_general3n (FTYPE omegaf, FTYPE v0, FTYPE *Bccon, FTYPE *normalvec, struct of_geom *geom, FTYPE *pr)
 input , extra 3-vel along the normal field (scalar quantity really), and B^i (code's version) and get back primitive assuming stationary/axisymmetric flow More...
 
void raise_A (FTYPE(*Acov)[NDIM], struct of_geom *geom, FTYPE(*Acon)[NDIM])
 
void MtoF (int which, FTYPE(*invar)[NDIM], struct of_geom *geom, FTYPE(*outvar)[NDIM])
 Maxwell to Faraday which=0 : Mcon -> Fcov (for clean Mcon, Fcov has ) which=1 : Mcov -> Fcon (for clean Mcov) which=2 : Fcon -> Mcov which=3 : Fcov -> Mcon copies faraday_calc() in phys.c. More...
 
int dualf_calc (FTYPE *Bcon, FTYPE *vcon, FTYPE(*dualffull)[NDIM])
 Get dual of faraday for given B^i and v^i. More...
 
int entropy_calc (struct of_geom *ptrgeom, FTYPE *pr, FTYPE *entropy)
 entropy wrapper this function should NOT be called by utoprim_jon.c inversion More...
 
int entropy_calc_forcheckinversion (struct of_geom *ptrgeom, FTYPE *pr, FTYPE *entropy)
 entropy wrapper this function should NOT be called by utoprim_jon.c inversion More...
 
FTYPE pressure_rho0_u_simple_forcheckinversion (int i, int j, int k, int loc, FTYPE rho, FTYPE u)
 wrapper [assumed not called by utoprim_jon.c that could change EOS type] used for inversion check More...
 
FTYPE compute_entropy_simple_forcheckinversion (int i, int j, int k, int loc, FTYPE rho, FTYPE u)
 wrapper this function should NOT be called by utoprim_jon.c inversion More...
 

Detailed Description

All locally-related physics calculations THINGS IN HERE ARE PER-POINT and use only LOCAL variables (no globals)

Definition in file phys.tools.c.

Macro Definition Documentation

#define VARSTATIC

Definition at line 16 of file phys.tools.c.

Function Documentation

int advectedscalarflux_calc ( FTYPE pr,
int  dir,
struct of_state q,
FTYPE advectedscalarflux,
FTYPE advectedscalarfluxabs,
int  pnum 
)

flux of scalar

Definition at line 547 of file phys.tools.c.

Here is the call graph for this function:

void bcon_calc ( FTYPE pr,
FTYPE ucon,
FTYPE ucov,
FTYPE bcon 
)

calculate magnetic field four-vector

Definition at line 1092 of file phys.tools.c.

Here is the caller graph for this function:

void Bcon_calc ( struct of_state q,
FTYPE B 
)

inverse of bcon_calc()

Definition at line 1104 of file phys.tools.c.

Here is the caller graph for this function:

int bsq_calc_fromq_general ( FTYPE pr,
struct of_geom ptrgeom,
struct of_state q,
FTYPE bsq 
)

returns b^2 (i.e., twice magnetic pressure)

Definition at line 1716 of file phys.tools.c.

int bsq_calc_fromq_rel4vel ( FTYPE pr,
struct of_geom ptrgeom,
struct of_state q,
FTYPE bsq 
)

Definition at line 1740 of file phys.tools.c.

Here is the caller graph for this function:

int bsq_calc_general ( FTYPE pr,
struct of_geom ptrgeom,
FTYPE bsq 
)

returns b^2 (i.e., twice magnetic pressure)

Definition at line 1706 of file phys.tools.c.

Here is the call graph for this function:

int bsq_calc_rel4vel ( FTYPE pr,
struct of_geom ptrgeom,
FTYPE bsq 
)

returns b^2 (i.e., twice magnetic pressure)

Definition at line 1725 of file phys.tools.c.

Here is the call graph for this function:

void compute_1plusud0_general ( FTYPE pr,
struct of_geom geom,
struct of_state q,
FTYPE plus1ud0 
)

plus1ud0=(1+q->ucov[TT]) avoids both non-rel and rel limit issues with machine precision GODMARK: Slow, can one optmize this somehow? This computes 1+u_t , which for nonrelativistic cases is ~0 .

If computed as 1+u_t, then residual will be large error if small residual. old2 is newer than old

Definition at line 1555 of file phys.tools.c.

void compute_1plusud0_rel4vel ( FTYPE pr,
struct of_geom geom,
struct of_state q,
FTYPE plus1ud0 
)

latest method to compute 1+u_t without catastrophic cancellation

Definition at line 1593 of file phys.tools.c.

FTYPE compute_entropy_simple_forcheckinversion ( int  i,
int  j,
int  k,
int  loc,
FTYPE  rho,
FTYPE  u 
)

wrapper this function should NOT be called by utoprim_jon.c inversion

Definition at line 3886 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void compute_gconttplus1 ( struct of_geom geom,
FTYPE gconttplus1 
)

g^{tt}+1 accurate for non-rel gravity to order v^2 without machine precision problems

Definition at line 3067 of file phys.tools.c.

int dualf_calc ( FTYPE Bcon,
FTYPE vcon,
FTYPE(*)  dualffull[NDIM] 
)

Get dual of faraday for given B^i and v^i.

Definition at line 3697 of file phys.tools.c.

int dualfaradayspatial_calc ( FTYPE pr,
int  dir,
struct of_state q,
FTYPE dualf,
FTYPE dualfabs 
)

spatial part of dualfaraday

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

Here is the call graph for this function:

Here is the caller graph for this function:

int dualfullfaraday_calc ( FTYPE pr,
int  dir,
struct of_state q,
FTYPE dualffull 
)

Notation for HARM paper and JCM's GRFFE paper is that: B^ = *F^{} and for lab-frame we chose ={-1,0,0,0}.

One can then show that b^i u^j - b^j u^i = B^i v^j - B^j v^i where b^ = u_ *F^{} and v^i = u^i/u^t

The form using B^i and v^i avoids catastrophic cancellation because otherwise starting with B^i (as primitive) and converting to b^i leads to u^i u^j (u.B)/u^t term that cancels exactly Since this is quite a high order term, then for highly relativistic flows this causes catastrophic cancellation issues, so this is why we use the primitives directly even if more complicated looking and more expensive to compute stress tensor or maxwell tensor

returns ^{ dir} well, actually returns dualffull[dir], so gives columns instead of rows

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

Here is the caller graph for this function:

int entropy_calc ( struct of_geom ptrgeom,
FTYPE pr,
FTYPE entropy 
)

entropy wrapper this function should NOT be called by utoprim_jon.c inversion

Definition at line 3793 of file phys.tools.c.

int entropy_calc_forcheckinversion ( struct of_geom ptrgeom,
FTYPE pr,
FTYPE entropy 
)

entropy wrapper this function should NOT be called by utoprim_jon.c inversion

Definition at line 3803 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int entropyflux_calc ( FTYPE pr,
int  dir,
struct of_state q,
FTYPE entropyflux,
FTYPE entropyfluxabs 
)

flux of specific entropy

Definition at line 569 of file phys.tools.c.

Here is the caller graph for this function:

void faraday_calc ( int  which,
FTYPE b,
FTYPE u,
struct of_geom geom,
FTYPE(*)  faraday[NDIM] 
)

Compute faraday assumes b and u are inputted as bcov&ucov for F^{} and bcon&ucon for F_{}.

Definition at line 2895 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int gamma_calc_fromuconrel ( FTYPE uconrel,
struct of_geom geom,
FTYPE gamma,
FTYPE qsq 
)

find gamma-factor wrt normal observer This function and qsq_calc() have about the same cache miss amount now

Definition at line 2473 of file phys.tools.c.

Here is the caller graph for this function:

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

find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure}

Definition at line 1861 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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

separate function for getting geometry

Definition at line 2320 of file phys.tools.c.

Here is the caller graph for this function:

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

all get_state() things except the field quantities

Definition at line 1932 of file phys.tools.c.

Here is the call graph for this function:

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

find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure}

Definition at line 1901 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int get_state_norad_part2 ( int  needentropy,
FTYPE pr,
struct of_geom ptrgeom,
struct of_state q 
)

find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure}

Definition at line 1919 of file phys.tools.c.

Here is the caller graph for this function:

int get_state_prims ( FTYPE pr,
struct of_state q 
)

separate function for getting primitives

Definition at line 2306 of file phys.tools.c.

Here is the caller graph for this function:

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

find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure}

Definition at line 1888 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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

separate function for getting thermodynamical quantities

Definition at line 2291 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 2205 of file phys.tools.c.

Here is the caller graph for this function:

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

used to check inversion, which has consistent pressure used to get things as functions of instead of u in case of using jon's inversion

Definition at line 1952 of file phys.tools.c.

Here is the call graph for this function:

int invertentropyflux_calc ( struct of_geom ptrgeom,
FTYPE  entropyflux,
int  dir,
struct of_state q,
FTYPE pr 
)

ptrgeom->i,ptrgeom->j,ptrgeom->k,ptrgeom->p

Definition at line 2334 of file phys.tools.c.

Here is the call graph for this function:

FTYPE lc4 ( int  updown,
FTYPE  detg,
int  mu,
int  nu,
int  kappa,
int  lambda 
)

used Mathematica's MinimumChangePermutations and Signature updown = 0 : down updown = 1 : up

Definition at line 2873 of file phys.tools.c.

Here is the caller graph for this function:

void lowerf ( FTYPE fcon,
struct of_geom geom,
FTYPE fcov 
)

Definition at line 1797 of file phys.tools.c.

Here is the caller graph for this function:

int massflux_calc ( FTYPE pr,
int  dir,
struct of_state q,
FTYPE massflux,
FTYPE massfluxabs 
)

Definition at line 451 of file phys.tools.c.

Here is the caller graph for this function:

FTYPE max ( FTYPE  a,
FTYPE  b 
)

Definition at line 2948 of file phys.tools.c.

void mhd_calc ( FTYPE pr,
int  dir,
struct of_geom geom,
struct of_state q,
FTYPE mhd,
FTYPE mhdabs 
)

MHD stress tensor, with first index up, second index down mhd^dir_j.

Definition at line 1180 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void mhd_calc_0_em ( FTYPE pr,
int  dir,
struct of_state q,
FTYPE mhd,
FTYPE mhdabs 
)

EM part of stress-energy tensor.

Definition at line 1306 of file phys.tools.c.

Here is the caller graph for this function:

void mhd_calc_0_ma ( FTYPE pr,
int  dir,
struct of_state q,
FTYPE mhd,
FTYPE mhdabs,
FTYPE mhddiagpress,
FTYPE mhddiagpressabs 
)

MHD stress tensor, with first index up, second index down.

Definition at line 1262 of file phys.tools.c.

Here is the caller graph for this function:

void mhd_calc_em ( FTYPE pr,
int  dir,
struct of_geom geom,
struct of_state q,
FTYPE mhd,
FTYPE mhdabs 
)

MHD stress tensor, with first index up, second index down mhd^dir_j.

Definition at line 1211 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void mhd_calc_ma ( FTYPE pr,
int  dir,
struct of_geom geom,
struct of_state q,
FTYPE mhd,
FTYPE mhdabs,
FTYPE mhddiagpress,
FTYPE mhddiagpressabs 
)

MHD stress tensor, with first index up, second index down mhd^dir_j understood that mhddiagpress only contains non-zero element on mhddiagpress[dir] and all others should be 0.0.

Definition at line 1196 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void mhd_calc_norestmass ( FTYPE pr,
int  dir,
struct of_geom geom,
struct of_state q,
FTYPE mhd,
FTYPE mhdabs 
)

MHD stress tensor, with first index up, second index down avoids catastrophic cancellation with rest-mass density due to extracting velocity or internal energy from that conserved energy with order unity term from rest-mass also avoids catastrophic cancellation in field due to using 4-field.

Instead derive stress tensor from 3-velocity and 3-field usinc Mcon_calc() seems to work to avoid catastrophic cancellation with field, but maybe should use WHICHVEL=RELVEL4 directly? GODMARK T^dir_

Definition at line 1333 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void mhd_calc_norestmass_ma ( FTYPE pr,
int  dir,
struct of_geom geom,
struct of_state q,
FTYPE mhd,
FTYPE mhdabs,
FTYPE mhddiagpress,
FTYPE mhddiagpressabs 
)

MHD stress tensor, with first index up, second index down avoids catastrophic cancellation with rest-mass density due to extracting velocity or internal energy from that conserved energy with order unity term from rest-mass also avoids catastrophic cancellation in field due to using 4-field.

Instead derive stress tensor from 3-velocity and 3-field usinc Mcon_calc() seems to work to avoid catastrophic cancellation with field, but maybe should use WHICHVEL=RELVEL4 directly? GODMARK T^dir_

Definition at line 1362 of file phys.tools.c.

Here is the caller graph for this function:

void mhd_calc_primfield_em ( FTYPE pr,
int  dir,
struct of_geom geom,
struct of_state q,
FTYPE mhd,
FTYPE mhdabs 
)

MHD stress tensor, with first index up, second index down avoids catastrophic cancellation with rest-mass density due to extracting velocity or internal energy from that conserved energy with order unity term from rest-mass also avoids catastrophic cancellation in field due to using 4-field.

Instead derive stress tensor from 3-velocity and 3-field usinc Mcon_calc() seems to work to avoid catastrophic cancellation with field, but maybe should use WHICHVEL=RELVEL4 directly? GODMARK T^dir_ SHOULD NOT USE b^ b_ here

Definition at line 1445 of file phys.tools.c.

Here is the caller graph for this function:

FTYPE min ( FTYPE  a,
FTYPE  b 
)

Definition at line 2957 of file phys.tools.c.

void MtoF ( int  which,
FTYPE(*)  invar[NDIM],
struct of_geom geom,
FTYPE(*)  outvar[NDIM] 
)

Maxwell to Faraday which=0 : Mcon -> Fcov (for clean Mcon, Fcov has ) which=1 : Mcov -> Fcon (for clean Mcov) which=2 : Fcon -> Mcov which=3 : Fcov -> Mcon copies faraday_calc() in phys.c.

Definition at line 3668 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int OBtopr_general ( FTYPE  omegaf,
FTYPE Bccon,
struct of_geom geom,
FTYPE pr 
)

input and B^i (code's version) and get back primitive assuming stationary/axisymmetric flow

Definition at line 3334 of file phys.tools.c.

Here is the call graph for this function:

int OBtopr_general2 ( FTYPE  omegaf,
FTYPE  v0,
FTYPE Bccon,
struct of_geom geom,
FTYPE pr 
)

input , 3-vel along field (scalar quantity really), and B^i (code's version) and get back primitive assuming stationary/axisymmetric flow

Definition at line 3375 of file phys.tools.c.

Here is the call graph for this function:

int OBtopr_general3 ( FTYPE  omegaf,
FTYPE  v0,
FTYPE Bccon,
struct of_geom geom,
FTYPE pr 
)

input , extra 3-vel along field (scalar quantity really), and B^i (code's version) and get back primitive assuming stationary/axisymmetric flow

Definition at line 3416 of file phys.tools.c.

Here is the call graph for this function:

int OBtopr_general3n ( FTYPE  omegaf,
FTYPE  v0,
FTYPE Bccon,
FTYPE normalvec,
struct of_geom geom,
FTYPE pr 
)

input , extra 3-vel along the normal field (scalar quantity really), and B^i (code's version) and get back primitive assuming stationary/axisymmetric flow

Definition at line 3484 of file phys.tools.c.

Here is the call graph for this function:

int OBtopr_general3p ( FTYPE  omegaf,
FTYPE  v0,
FTYPE Bccon,
struct of_geom geom,
FTYPE pr 
)

input , extra 3-vel along the poloidal field (scalar quantity really), and B^i (code's version) and get back primitive assuming stationary/axisymmetric flow

Definition at line 3452 of file phys.tools.c.

Here is the call graph for this function:

FTYPE pressure_rho0_u_simple_forcheckinversion ( int  i,
int  j,
int  k,
int  loc,
FTYPE  rho,
FTYPE  u 
)

wrapper [assumed not called by utoprim_jon.c that could change EOS type] used for inversion check

Definition at line 3823 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int primtoflux ( int  returntype,
FTYPE pr,
struct of_state q,
int  dir,
struct of_geom geom,
FTYPE flux,
FTYPE fluxabs 
)

Calculate fluxes in direction dir and conserved variable U returntype==0 : flux with geometric factor geom->e (used by evolution code) returntype==1 : flux with physical geometry factor geom->gdet (used by diagnostics) see UtoU and source_conn() Note that if MAXWELL==PRIMMAXWELL then primtoflux doesn't use b^ or b_ (bcon and bcov)

Definition at line 33 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int primtoflux_em ( int *  returntype,
FTYPE pr,
struct of_state q,
int  dir,
struct of_geom geom,
FTYPE flux,
FTYPE fluxabs 
)

electromagnetic terms (as if rho=u=p=0)

Definition at line 409 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int primtoflux_ma ( int  needentropy,
int *  returntype,
FTYPE pr,
struct of_state q,
int  dir,
struct of_geom geom,
FTYPE flux,
FTYPE fluxabs,
FTYPE fluxdiag,
FTYPE fluxdiagabs 
)

matter only terms (as if B=0)

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

Here is the call graph for this function:

Here is the caller graph for this function:

int primtoflux_nonradonly ( int  needentropy,
FTYPE pr,
struct of_state q,
int  dir,
struct of_geom geom,
FTYPE flux,
FTYPE fluxabs 
)

Definition at line 105 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int primtoflux_rad ( int *  returntype,
FTYPE pr,
struct of_state q,
int  dir,
struct of_geom geom,
FTYPE flux,
FTYPE fluxabs 
)

radiation terms (as if rho=u=p=0)

Definition at line 374 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int primtoflux_radonly ( FTYPE pr,
struct of_state q,
int  dir,
struct of_geom geom,
FTYPE flux,
FTYPE fluxabs 
)

Definition at line 151 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int primtofullflux ( int  returntype,
FTYPE pr,
struct of_state q,
struct of_geom ptrgeom,
FTYPE(*)  flux[NPR],
FTYPE(*)  fluxabs[NPR] 
)

returns entire space-time(NDIM in size) / EOM(NPR in size) matrix

Definition at line 714 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int primtoU ( int  returntype,
FTYPE pr,
struct of_state q,
struct of_geom geom,
FTYPE U,
FTYPE Uabs 
)

calculate "conserved" quantities

Definition at line 728 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void projectionvec ( int  vcon,
int  vresultcon,
struct of_state q,
struct of_geom geom,
FTYPE v,
FTYPE vresult 
)

take projection of v onto u, both are 4-vectors vcon=0 or 1 : whether or not ucon (1=true, 0=ucov) same for vresultcon

Definition at line 3041 of file phys.tools.c.

void PtoP ( int  inputtype,
int  returntype,
struct of_geom ptrgeom,
FTYPE pin,
FTYPE pout 
)

standardized primitive form is assumed to be , u, {u}^ , *F^{it}=B^i where {u} is relative 4-velocity, as relative to $n_ = (-,0,0,0)$ and $^2=-1/g^{tt}$.

For any space-time with no time-like curves this 4-velocity is always single-valued (i.e. unique). It can also take on any value, so a reasonable primitive quantity. convert from one primitive form to another

Definition at line 1081 of file phys.tools.c.

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

find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure,g,e[pl],prim,Blower}

Definition at line 1981 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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

find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure,g,e[pl],prim,Blower}

Definition at line 2114 of file phys.tools.c.

Here is the call graph for this function:

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

find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure}

Definition at line 2086 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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

find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure}

Definition at line 2058 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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

find ucon, ucov, bcon, bcov from primitive variables when calling get_state, users of this function expect to get q->{ucon,ucov,bcon,bcov,pressure}

Definition at line 2028 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void raise_A ( FTYPE(*)  Acov[NDIM],
struct of_geom geom,
FTYPE(*)  Acon[NDIM] 
)

Definition at line 3589 of file phys.tools.c.

Here is the caller graph for this function:

FTYPE sign_bad ( FTYPE  a)

assumes below get inlined much faster than macro using ? : super slow for get_geometry()'s sign() call!

Definition at line 2914 of file phys.tools.c.

FTYPE sign_func ( FTYPE  a)

not any faster than above (except when used alot)

Definition at line 2923 of file phys.tools.c.

FTYPE signavoidzero ( FTYPE  a)

much faster than macro using ? : Generally avoid using, instead do: igdet = sign(geom.gdet)/(fabs(geom.gdet)+SMALL)

Definition at line 2936 of file phys.tools.c.

int source ( FTYPE pi,
FTYPE pr,
FTYPE pf,
int *  didreturnpf,
int *  eomtype,
struct of_geom ptrgeom,
struct of_state q,
FTYPE ui,
FTYPE uf,
FTYPE CUf,
FTYPE CUimp,
FTYPE  dissmeasure,
FTYPE dUriemann,
FTYPE(*)  dUcomp[NPR],
FTYPE dU 
)

add in source terms to equations of motion ui and dUriemann in UEVOLVE form assume q(pr) so consistent, but p or ui don't yet account for dUriemann!

Definition at line 1619 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

FTYPE taper_func ( FTYPE  R,
FTYPE  rin 
)

Definition at line 2856 of file phys.tools.c.

int ucon_calc_3vel ( FTYPE pr,
struct of_geom geom,
FTYPE ucon,
FTYPE others 
)

find contravariant four-velocity int ucon_calc(FTYPE *pr, struct of_geom *geom, FTYPE *ucon, FTYPE *others)

Definition at line 2544 of file phys.tools.c.

Here is the caller graph for this function:

int ucon_calc_4vel ( FTYPE pr,
struct of_geom geom,
FTYPE ucon,
FTYPE others 
)

find contravariant time component of four-velocity from the 4velocity (3 terms)

Definition at line 2772 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int ucon_calc_4vel_bothut ( FTYPE pr,
struct of_geom geom,
FTYPE ucon,
FTYPE ucon2,
FTYPE others 
)

find contravariant time component of four-velocity from the 4velocity (3 terms)

Definition at line 2724 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int ucon_calc_nonrel ( FTYPE pr,
struct of_geom geom,
FTYPE ucon,
FTYPE others 
)

find contravariant time component of four-velocity from the 4velocity (3 terms)

Definition at line 2842 of file phys.tools.c.

int ucon_calc_rel4vel ( FTYPE pr,
struct of_geom geom,
FTYPE ucon,
FTYPE others 
)

find contravariant four-velocity from the relative 4 velocity

Definition at line 2401 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int ucon_calc_rel4vel_fromuconrel ( FTYPE uconrel,
struct of_geom geom,
FTYPE ucon,
FTYPE others 
)

find u^ from {u}^ fill full 4-vector OPTMARK: Before storing , this was the most expensive function over the entire code [determined by avoiding inlining]

Definition at line 2360 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int ucon_calc_whichvel ( int  whichvel,
FTYPE pr,
struct of_geom geom,
FTYPE ucon,
FTYPE others 
)

Definition at line 2422 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int uconrel ( FTYPE ucon,
FTYPE uconrel,
struct of_geom geom 
)

find {u}^ from u^ only fill spatial parts so can feed in 3-vector

Definition at line 2387 of file phys.tools.c.

Here is the caller graph for this function:

int ufromentropy_calc ( struct of_geom ptrgeom,
FTYPE  entropy,
FTYPE pr 
)

u from entropy (uses pr[RHO]) wrapper

Definition at line 2347 of file phys.tools.c.

Here is the caller graph for this function:

void vbtopr ( FTYPE vcon,
FTYPE bcon,
struct of_geom geom,
FTYPE pr 
)

convert (e^=0 case) b^ and (3-velocity in coordinate lab frame) v^ to pr

Definition at line 1137 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int yflflux_calc ( struct of_geom ptrgeom,
FTYPE pr,
int  dir,
struct of_state q,
FTYPE advectedscalarflux,
FTYPE advectedscalarfluxabs,
int  pnum 
)

flux associated with Y_fl variable

Definition at line 465 of file phys.tools.c.

Here is the caller graph for this function:

int ylflux_calc ( struct of_geom ptrgeom,
FTYPE pr,
int  dir,
struct of_state q,
FTYPE advectedscalarflux,
FTYPE advectedscalarfluxabs,
int  pnum 
)

flux associated with Y_L variable

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

Here is the call graph for this function:

Here is the caller graph for this function:

int ynuflux_calc ( struct of_geom ptrgeom,
FTYPE pr,
int  dir,
struct of_state q,
FTYPE advectedscalarflux,
FTYPE advectedscalarfluxabs,
int  pnum 
)

flux asociated with Ynu variable

Definition at line 520 of file phys.tools.c.

Here is the call graph for this function:

Here is the caller graph for this function: