#include #include #include #include #include "cctk.h" #include "cctk_Parameters.h" #include "cctk_Arguments.h" #include "cctk_Functions.h" #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) // some prototypes CCTK_INT GRHydro_UseGeneralCoordinates(const cGH * cctkGH); static inline double SpatialDeterminantC(double gxx, double gxy, double gxz, double gyy, double gyz, double gzz); static inline __attribute__((always_inline)) void prim2conC(double *w, double *dens, double *sx, double *sy, double *sz, double *tau, const double gxx, const double gxy, const double gxz, const double gyy, const double gyz, const double gzz, const double sdet, const double rho, const double vx, const double vy, const double vz, const double eps, const double press); void Primitive2ConservativeC(CCTK_ARGUMENTS); CCTK_FCALL void CCTK_FNAME(Primitive2ConservativeCforF)(cGH ** p_cctkGH) { Primitive2ConservativeC(*p_cctkGH); } void Primitive2ConservativeC(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; // save memory when multipatch is not used CCTK_REAL * restrict g11, * restrict g12, * restrict g13; CCTK_REAL * restrict g22, * restrict g23, * restrict g33; if(GRHydro_UseGeneralCoordinates(cctkGH)) { g11 = gaa; g12 = gab; g13 = gac; g22 = gbb; g23 = gbc; g33 = gcc; } else { g11 = gxx; g12 = gxy; g13 = gxz; g22 = gyy; g23 = gyz; g33 = gzz; } // if padding is used the the "extra" vector elements could contain junk // which we do not know how to handle assert(cctk_lsh[0] == cctk_ash[0]); assert(cctk_lsh[1] == cctk_ash[1]); assert(cctk_lsh[2] == cctk_ash[2]); // EOS calls (now GF-wide) if(!*evolve_temper) { // n needs to be computed using ash since ash is used when computing the // linear index in CCTK_GFINDEX3D int n = cctk_ash[0]*cctk_ash[1]*cctk_ash[2]; int *keyerr = malloc(sizeof(*keyerr)*n); int anyerr = 0; int keytemp = 0; // don't need special error handling for analytic EOS #pragma omp parallel for for(int k=0;k