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

All things related to vector potential: A_mu. More...

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

Go to the source code of this file.

Functions

int get_fluxpldirs (int *Nvec, int dir, int *fluxdir, int *pldir, int *plforflux, FTYPE *signflux)
 get directions for cyclic variables signflux determines signature of relationship between flux and A_i and likewise the EMF_i = - E_i As in fluxct.c: For evolution: d_t A1 = EMF1 = - E1 = F2[B3] = -F3[B2] d_t A2 = EMF2 = - E2 = F3[B1] = -F1[B3] d_t A3 = EMF3 = - E3 = F1[B2] = -F2[B1] More...
 
int vpot2field (SFTYPE time, FTYPE(*A)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE(*pfield)[NSTORE2][NSTORE3][NPR], FTYPE(*pstag)[NSTORE2][NSTORE3][NPR], FTYPE(*ucons)[NSTORE2][NSTORE3][NPR], FTYPE(*Bhat)[NSTORE2][NSTORE3][NPR], FTYPE(*F1)[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*F2)[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*F3)[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*Atemp)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE(*uconstemp)[NSTORE2][NSTORE3][NPR])
 assumes normal field p pleft used as temp var if FLUXB==FLUXCTSTAG assigns conserved field in UEVOLVE form (i.e. More...
 
int ucons2upointppoint (SFTYPE boundtime, FTYPE(*pfield)[NSTORE2][NSTORE3][NPR], FTYPE(*pstag)[NSTORE2][NSTORE3][NPR], FTYPE(*unew)[NSTORE2][NSTORE3][NPR], FTYPE(*ulast)[NSTORE2][NSTORE3][NPR], FTYPE(*pcent)[NSTORE2][NSTORE3][NPR])
 convert conservative U to stag point P and CENT point U and CENT point primitive More...
 
int init_vpot (FTYPE(*prim)[NSTORE2][NSTORE3][NPR], FTYPE(*pstag)[NSTORE2][NSTORE3][NPR], FTYPE(*ucons)[NSTORE2][NSTORE3][NPR], FTYPE(*vpot)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE(*Bhat)[NSTORE2][NSTORE3][NPR], FTYPE(*F1)[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*F2)[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*F3)[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*Atemp)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3])
 initialize vector potential given user function assumes normal non-staggered field in pr Notice that if using F (flux), then location can be different for (e.g.) F1[B2] and F2[B1] while if using A_3 then no choice in varying positions More...
 
int get_vpot_fluxctstag_primecoords (SFTYPE time, int i, int j, int k, FTYPE(*prim)[NSTORE2][NSTORE3][NPR], FTYPE *vpot)
 get A_i in PRIMECOORDS for FLUXB==FLUXCTSTAG at CORNi for each A_i, the natural staggered field locations for A_i (i.e. not all same location for all A_i) More...
 
int init_vpot_justAcov (SFTYPE time, FTYPE(*prim)[NSTORE2][NSTORE3][NPR], FTYPE(*A)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3])
 initialize vector potential given user function assumes normal non-staggered field in pr More...
 
int init_vpot_toF (FTYPE(*A)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE(*F1)[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*F2)[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*F3)[NSTORE2][NSTORE3][NPR+NSPECIAL])
 initialize vector potential given user function assumes normal non-staggered field in pr Notice that if using F (flux), then location can be different for (e.g.) F1[B2] and F2[B1] while if using A_3 then no choice in varying positions More...
 
void setfdivb (FTYPE *divb, FTYPE(*p)[NSTORE2][NSTORE3][NPR], FTYPE(*pstag)[NSTORE2][NSTORE3][NPR], FTYPE(*U)[NSTORE2][NSTORE3][NPR], FTYPE(*Bhat)[NSTORE2][NSTORE3][NPR], int i, int j, int k)
 find divb if higher order method, then must use conserved value U[] assumed to then exist and be used for field More...
 
int vpot2field_useflux (int *fieldloc, FTYPE(*pfield)[NSTORE2][NSTORE3][NPR], FTYPE(*ufield)[NSTORE2][NSTORE3][NPR], FTYPE(*F1)[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*F2)[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*F3)[NSTORE2][NSTORE3][NPR+NSPECIAL])
 Used with FLUXB==FLUXCTHLL actually uses F1/F2/F3 instead of inputted A[] When using FLUXCTHLL, doesn't preserve divb, but gives correct CENT position of field given face vector potential If flux is really vector potential at corners and vector potential is direction-dependent quasi-deaveraged version. More...
 
int update_vpot (int whichmethod, int stage, FTYPE(*pr)[NSTORE2][NSTORE3][NPR], FTYPE(*fluxvec[NDIM])[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*emf)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE *CUf, FTYPE *CUnew, SFTYPE fluxdt, FTYPE(*vpot)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE(*vpot0)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE(*vpotlast)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE(*vpotcum)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3])
 update A_i More...
 
int set_emfflux (int whichmethod, int stage, FTYPE(*pr)[NSTORE2][NSTORE3][NPR], FTYPE(*fluxvec[NDIM])[NSTORE2][NSTORE3][NPR+NSPECIAL], FTYPE(*emf)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE *CUf, FTYPE *CUnew, SFTYPE fluxdt, FTYPE(*vpot)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE(*vpot0)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE(*vpotlast)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3])
 fix EMF_i (in Flux space so ready to be used) from A_i and Aold_i pretty similar to update_vpot(), but inverted assignment. More...
 
int normalize_field_withnorm (FTYPE norm, FTYPE(*prim)[NSTORE2][NSTORE3][NPR], FTYPE(*pstag)[NSTORE2][NSTORE3][NPR], FTYPE(*ucons)[NSTORE2][NSTORE3][NPR], FTYPE(*vpot)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE(*Bhat)[NSTORE2][NSTORE3][NPR])
 renormalize field using user norm GODMARK: in reality should renormalize A_i and then recompute and can renormalize each A_i independently this type of function assumes renormalizing field energy density in lab-frame More...
 
int assign_fieldconservatives_pointvalues (FTYPE(*prim)[NSTORE2][NSTORE3][NPR], FTYPE(*pstag)[NSTORE2][NSTORE3][NPR], FTYPE(*ucons)[NSTORE2][NSTORE3][NPR])
 used when not using vector potential and just assigning conserved quantities as point values from primitives for field uses global p and pstagscratch More...
 
int assignrough_primitive_pstag (int i, int j, int k, FTYPE(*p)[NSTORE2][NSTORE3][NPR], FTYPE(*pstag)[NSTORE2][NSTORE3][NPR], FTYPE(*ucons)[NSTORE2][NSTORE3][NPR])
 this assigns rough pstag value from p in case not using vector potential More...
 
int init_zero_field (FTYPE(*prim)[NSTORE2][NSTORE3][NPR], FTYPE(*pstag)[NSTORE2][NSTORE3][NPR], FTYPE(*ucons)[NSTORE2][NSTORE3][NPR], FTYPE(*vpot)[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3], FTYPE(*Bhat)[NSTORE2][NSTORE3][NPR])
 zero-out field for primitives (and pstag too) More...
 

Detailed Description

All things related to vector potential: A_mu.

Definition in file fluxvpot.c.

Function Documentation

int assign_fieldconservatives_pointvalues ( FTYPE(*)  prim[NSTORE2][NSTORE3][NPR],
FTYPE(*)  pstag[NSTORE2][NSTORE3][NPR],
FTYPE(*)  ucons[NSTORE2][NSTORE3][NPR] 
)

used when not using vector potential and just assigning conserved quantities as point values from primitives for field uses global p and pstagscratch

Definition at line 1670 of file fluxvpot.c.

int assignrough_primitive_pstag ( int  i,
int  j,
int  k,
FTYPE(*)  p[NSTORE2][NSTORE3][NPR],
FTYPE(*)  pstag[NSTORE2][NSTORE3][NPR],
FTYPE(*)  ucons[NSTORE2][NSTORE3][NPR] 
)

this assigns rough pstag value from p in case not using vector potential

Definition at line 1717 of file fluxvpot.c.

Here is the caller graph for this function:

int get_fluxpldirs ( int *  Nvec,
int  dir,
int *  fluxdir,
int *  pldir,
int *  plforflux,
FTYPE signflux 
)

get directions for cyclic variables signflux determines signature of relationship between flux and A_i and likewise the EMF_i = - E_i As in fluxct.c: For evolution: d_t A1 = EMF1 = - E1 = F2[B3] = -F3[B2] d_t A2 = EMF2 = - E2 = F3[B1] = -F1[B3] d_t A3 = EMF3 = - E3 = F1[B2] = -F2[B1]

For initialization: A1 = F2[B3] = -F3[B2] A2 = F3[B1] = -F1[B3] A3 = F1[B2] = -F2[B1] B1 = d_2 A3 - d_3 A2 B2 = d_3 A1 - d_1 A3 B3 = d_1 A2 - d_2 A1

opposite ordering required to be used when F[odir1] doesn't exist because N[odir1]==1 Should use signflux when changing between A_i <-> flux

Definition at line 25 of file fluxvpot.c.

Here is the caller graph for this function:

int get_vpot_fluxctstag_primecoords ( SFTYPE  time,
int  i,
int  j,
int  k,
FTYPE(*)  prim[NSTORE2][NSTORE3][NPR],
FTYPE vpot 
)

get A_i in PRIMECOORDS for FLUXB==FLUXCTSTAG at CORNi for each A_i, the natural staggered field locations for A_i (i.e. not all same location for all A_i)

Definition at line 428 of file fluxvpot.c.

Here is the call graph for this function:

int init_vpot ( FTYPE(*)  prim[NSTORE2][NSTORE3][NPR],
FTYPE(*)  pstag[NSTORE2][NSTORE3][NPR],
FTYPE(*)  ucons[NSTORE2][NSTORE3][NPR],
FTYPE(*)  vpot[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE(*)  Bhat[NSTORE2][NSTORE3][NPR],
FTYPE(*)  F1[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  F2[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  F3[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  Atemp[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3] 
)

initialize vector potential given user function assumes normal non-staggered field in pr Notice that if using F (flux), then location can be different for (e.g.) F1[B2] and F2[B1] while if using A_3 then no choice in varying positions

Definition at line 387 of file fluxvpot.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int init_vpot_justAcov ( SFTYPE  time,
FTYPE(*)  prim[NSTORE2][NSTORE3][NPR],
FTYPE(*)  A[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3] 
)

initialize vector potential given user function assumes normal non-staggered field in pr

Definition at line 473 of file fluxvpot.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int init_vpot_toF ( FTYPE(*)  A[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE(*)  F1[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  F2[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  F3[NSTORE2][NSTORE3][NPR+NSPECIAL] 
)

initialize vector potential given user function assumes normal non-staggered field in pr Notice that if using F (flux), then location can be different for (e.g.) F1[B2] and F2[B1] while if using A_3 then no choice in varying positions

Definition at line 603 of file fluxvpot.c.

Here is the caller graph for this function:

int init_zero_field ( FTYPE(*)  prim[NSTORE2][NSTORE3][NPR],
FTYPE(*)  pstag[NSTORE2][NSTORE3][NPR],
FTYPE(*)  ucons[NSTORE2][NSTORE3][NPR],
FTYPE(*)  vpot[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE(*)  Bhat[NSTORE2][NSTORE3][NPR] 
)

zero-out field for primitives (and pstag too)

Definition at line 1770 of file fluxvpot.c.

Here is the caller graph for this function:

int normalize_field_withnorm ( FTYPE  norm,
FTYPE(*)  prim[NSTORE2][NSTORE3][NPR],
FTYPE(*)  pstag[NSTORE2][NSTORE3][NPR],
FTYPE(*)  ucons[NSTORE2][NSTORE3][NPR],
FTYPE(*)  vpot[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE(*)  Bhat[NSTORE2][NSTORE3][NPR] 
)

renormalize field using user norm GODMARK: in reality should renormalize A_i and then recompute and can renormalize each A_i independently this type of function assumes renormalizing field energy density in lab-frame

Definition at line 1598 of file fluxvpot.c.

Here is the caller graph for this function:

int set_emfflux ( int  whichmethod,
int  stage,
FTYPE(*)  pr[NSTORE2][NSTORE3][NPR],
FTYPE(*[])  NDIM[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  emf[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE CUf,
FTYPE CUnew,
SFTYPE  fluxdt,
FTYPE(*)  vpot[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE(*)  vpot0[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE(*)  vpotlast[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3] 
)

fix EMF_i (in Flux space so ready to be used) from A_i and Aold_i pretty similar to update_vpot(), but inverted assignment.

So removed detailed comments/debug from this function.

Definition at line 1481 of file fluxvpot.c.

Here is the call graph for this function:

void setfdivb ( FTYPE divb,
FTYPE(*)  p[NSTORE2][NSTORE3][NPR],
FTYPE(*)  pstag[NSTORE2][NSTORE3][NPR],
FTYPE(*)  U[NSTORE2][NSTORE3][NPR],
FTYPE(*)  Bhat[NSTORE2][NSTORE3][NPR],
int  i,
int  j,
int  k 
)

find divb if higher order method, then must use conserved value U[] assumed to then exist and be used for field

Definition at line 875 of file fluxvpot.c.

Here is the caller graph for this function:

int ucons2upointppoint ( SFTYPE  boundtime,
FTYPE(*)  pfield[NSTORE2][NSTORE3][NPR],
FTYPE(*)  pstag[NSTORE2][NSTORE3][NPR],
FTYPE(*)  unew[NSTORE2][NSTORE3][NPR],
FTYPE(*)  ulast[NSTORE2][NSTORE3][NPR],
FTYPE(*)  pcent[NSTORE2][NSTORE3][NPR] 
)

convert conservative U to stag point P and CENT point U and CENT point primitive

Definition at line 309 of file fluxvpot.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int update_vpot ( int  whichmethod,
int  stage,
FTYPE(*)  pr[NSTORE2][NSTORE3][NPR],
FTYPE(*[])  NDIM[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  emf[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE CUf,
FTYPE CUnew,
SFTYPE  fluxdt,
FTYPE(*)  vpot[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE(*)  vpot0[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE(*)  vpotlast[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE(*)  vpotcum[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3] 
)

update A_i

#if((SIMULBCCALC==2)&&(TYPE2==1)) COMPFZLOOP(is,js,ks) else

Definition at line 1317 of file fluxvpot.c.

Here is the call graph for this function:

int vpot2field ( SFTYPE  time,
FTYPE(*)  A[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE(*)  pfield[NSTORE2][NSTORE3][NPR],
FTYPE(*)  pstag[NSTORE2][NSTORE3][NPR],
FTYPE(*)  ucons[NSTORE2][NSTORE3][NPR],
FTYPE(*)  Bhat[NSTORE2][NSTORE3][NPR],
FTYPE(*)  F1[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  F2[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  F3[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  Atemp[NSTORE1+SHIFTSTORE1][NSTORE2+SHIFTSTORE2][NSTORE3+SHIFTSTORE3],
FTYPE(*)  uconstemp[NSTORE2][NSTORE3][NPR] 
)

assumes normal field p pleft used as temp var if FLUXB==FLUXCTSTAG assigns conserved field in UEVOLVE form (i.e.

with gdet always) implicitly Flux F1,F2,F3 are inputted into function

Definition at line 158 of file fluxvpot.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int vpot2field_useflux ( int *  fieldloc,
FTYPE(*)  pfield[NSTORE2][NSTORE3][NPR],
FTYPE(*)  ufield[NSTORE2][NSTORE3][NPR],
FTYPE(*)  F1[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  F2[NSTORE2][NSTORE3][NPR+NSPECIAL],
FTYPE(*)  F3[NSTORE2][NSTORE3][NPR+NSPECIAL] 
)

Used with FLUXB==FLUXCTHLL actually uses F1/F2/F3 instead of inputted A[] When using FLUXCTHLL, doesn't preserve divb, but gives correct CENT position of field given face vector potential If flux is really vector potential at corners and vector potential is direction-dependent quasi-deaveraged version.

Definition at line 937 of file fluxvpot.c.

Here is the caller graph for this function: