#include #include #include #include #include #include #include #include using namespace std; extern "C" void ID_Mag_NS_initialise (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; CCTK_INFO ("Setting up LORENE Mag_NS initial data"); // Meudon data are distributed in SI units (MKSA). Here are some // conversion factors. // Defined constants CCTK_REAL const c_light = 299792458.0; // speed of light [m/s] CCTK_REAL const mu0 = 4*M_PI * 1.0e-7; // vacuum permeability [N/A^2] CCTK_REAL const eps0 = 1 / (mu0 * pow(c_light,2)); // Constants of nature (IAU, CODATA): CCTK_REAL const G_grav = 6.67428e-11; // gravitational constant [m^3/kg/s^2] CCTK_REAL const M_sun = 1.98892e+30; // solar mass [kg] // Cactus units in terms of SI units: // (These are derived from M = M_sun, c = G = 1, and using 1/M_sun // for the magnetic field) CCTK_REAL const cactusM = M_sun; CCTK_REAL const cactusL = cactusM * G_grav / pow(c_light,2); CCTK_REAL const cactusT = cactusL / c_light; CCTK_REAL const cactusB = sqrt(4*M_PI) / cactusL / sqrt(4*M_PI * eps0 * G_grav / pow(c_light,2)); // Other quantities in terms of Cactus units CCTK_REAL const coord_unit = cactusL / 1.0e+3; // from km CCTK_REAL const rho_unit = cactusM / pow(cactusL,3); // from kg/m^3 CCTK_REAL const ener_unit = pow(cactusL,2); // from c^2 CCTK_REAL const vel_unit = cactusL / cactusT / c_light; // from c CCTK_REAL const B_unit = cactusB / 1.0e+9; // from 10^9 T CCTK_INFO ("Setting up coordinates"); int const npoints = cctk_lsh[0] * cctk_lsh[1] * cctk_lsh[2]; vector xx(npoints), yy(npoints), zz(npoints); #pragma omp parallel for for (int i=0; i