VTDUSVEON4HPCZBSLNN4XUWV5WCDV7WFLXTQ336ADWT6S6MOZE3QC
"USES CCTK_INT lapse_timelevels # Needed to ensure ADMBase gridfunctions are allocated (see top of schedule.ccl)\n",
"USES CCTK_INT shift_timelevels # Needed to ensure ADMBase gridfunctions are allocated (see top of schedule.ccl)\n",
"USES CCTK_INT metric_timelevels # Needed to ensure ADMBase gridfunctions are allocated (see top of schedule.ccl)\n",
"\n",
"EXTENDS CCTK_KEYWORD evolution_method \"evolution_method\"\n",
"{\n",
" \"BaikalETK\" :: \"\"\n",
"} \n",
"\n",
"EXTENDS CCTK_KEYWORD lapse_evolution_method \"lapse_evolution_method\"\n",
"{\n",
" \"BaikalETK\" :: \"\"\n",
"} \n",
"\n",
"EXTENDS CCTK_KEYWORD shift_evolution_method \"shift_evolution_method\"\n",
"{\n",
" \"BaikalETK\" :: \"\"\n",
"} \n",
"\n",
"EXTENDS CCTK_KEYWORD dtshift_evolution_method \"dtshift_evolution_method\"\n",
"{\n",
" \"BaikalETK\" :: \"\"\n",
"} \n",
"\n",
"EXTENDS CCTK_KEYWORD dtlapse_evolution_method \"dtlapse_evolution_method\"\n",
"{\n",
" \"BaikalETK\" :: \"\"\n",
"} \n",
"\n",
"# Needed for EinsteinEvolve/NewRad outer boundary condition driver:\n",
"CCTK_INT FUNCTION \\\\\n",
" NewRad_Apply \\\\\n",
" (CCTK_POINTER_TO_CONST IN cctkGH, \\\\\n",
" CCTK_REAL ARRAY IN var, \\\\\n",
" CCTK_REAL ARRAY INOUT rhs, \\\\\n",
" CCTK_REAL IN var0, \\\\\n",
" CCTK_REAL IN v0, \\\\\n",
" CCTK_INT IN radpower)\n",
"REQUIRES FUNCTION NewRad_Apply\n",
"\n",
"# Needed to convert ADM initial data into BSSN initial data (gamma extrapolation)\n",
"CCTK_INT FUNCTION \\\\\n",
" ExtrapolateGammas \\\\\n",
" (CCTK_POINTER_TO_CONST IN cctkGH, \\\\\n",
" CCTK_REAL ARRAY INOUT var)\n",
"REQUIRES FUNCTION ExtrapolateGammas\n",
"\n",
"# Tell the Toolkit that we want all gridfunctions\n",
"# to be visible to other thorns by using \n",
"# the keyword \"public\". Note that declaring these \n",
"# gridfunctions *does not* allocate memory for them;\n",
"# that is done by the schedule.ccl file.\n",
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with open(append_to_make_code_defn_list(\"RegisterSlicing.c\"),\"w\") as file:\n",
" file.write(\"\"\" \n",
"#include \"cctk.h\"\n",
"\n",
"#include \"Slicing.h\"\n",
"\n",
"int BaikalETK_RegisterSlicing (void)\n",
"{\n",
" Einstein_RegisterSlicing (\"BaikalETK\");\n",
" return 0;\n",
"}\"\"\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"# Next registration with the Method of Lines thorn\n",
"with open(append_to_make_code_defn_list(\"MoL_registration.c\"),\"w\") as file:\n",
" file.write(\"\"\"\n",
"//--------------------------------------------------------------------------\n",
"// Register with the Method of Lines time stepper\n",
"// (MoL thorn, found in arrangements/CactusBase/MoL)\n",
"// MoL documentation located in arrangements/CactusBase/MoL/doc\n",
"//--------------------------------------------------------------------------\n",
"#include <stdio.h>\n",
"\n",
"#include \"cctk.h\"\n",
"#include \"cctk_Parameters.h\"\n",
"#include \"cctk_Arguments.h\"\n",
"\n",
"#include \"Symmetry.h\"\n",
"\n",
"void BaikalETK_MoL_registration(CCTK_ARGUMENTS)\n",
"{\n",
" DECLARE_CCTK_ARGUMENTS;\n",
" DECLARE_CCTK_PARAMETERS;\n",
" \n",
" CCTK_INT ierr = 0, group, rhs;\n",
"\n",
" // Register evolution & RHS gridfunction groups with MoL, so it knows\n",
"\n",
" group = CCTK_GroupIndex(\"BaikalETK::evol_variables\");\n",
" rhs = CCTK_GroupIndex(\"BaikalETK::evol_variables_rhs\");\n",
" ierr += MoLRegisterEvolvedGroup(group, rhs);\n",
" \n",
" if (ierr) CCTK_ERROR(\"Problems registering with MoL\");\n",
"}\n",
"\"\"\")"
" CCTK_REAL *alphaSphorCartGF = alp;\n",
"\"\"\")\n",
"# \"\"\" // make copies of ADMBase variables where we expect them\"\"\" \n",
"# copy_admbase_vars = []\n",
"# copy_admbase_vars.append(\"alphaSphorCartGF[CCTK_GFINDEX3D(cctkGH,i0,i1,i2)] = alp[CCTK_GFINDEX3D(cctkGH,i0,i1,i2)];\\n\")\n",
"# # It's ugly if we output code in the following ordering, so we'll first\n",
"# # output to a string and then sort the string to beautify the code a bit.\n",
"# for i in range(DIM):\n",
"# copy_admbase_vars.append(\"betaSphorCartU\"+str(i)+\"GF[CCTK_GFINDEX3D(cctkGH,i0,i1,i2)] = beta\"+chr(ord('x')+i)+\"[CCTK_GFINDEX3D(cctkGH,i0,i1,i2)];\\n\")\n",
"# copy_admbase_vars.append(\"BSphorCartU\"+str(i)+\"GF[CCTK_GFINDEX3D(cctkGH,i0,i1,i2)] = dtbeta\"+chr(ord('x')+i)+\"[CCTK_GFINDEX3D(cctkGH,i0,i1,i2)];\\n\")\n",
"# for j in range(i,DIM):\n",
"# copy_admbase_vars.append(\"gammaSphorCartDD\"+str(i)+str(j)+\"GF[CCTK_GFINDEX3D(cctkGH,i0,i1,i2)] = g\"+chr(ord('x')+i)+chr(ord('x')+j)+\"[CCTK_GFINDEX3D(cctkGH,i0,i1,i2)];\\n\")\n",
"# copy_admbase_vars.append(\"KSphorCartDD\"+str(i)+str(j)+\"GF[CCTK_GFINDEX3D(cctkGH,i0,i1,i2)] = k\"+chr(ord('x')+i)+chr(ord('x')+j)+\"[CCTK_GFINDEX3D(cctkGH,i0,i1,i2)];\\n\")\n",
"# copy_admbase_vars.sort()\n",
"# file.write(lp.loop([\"i2\",\"i1\",\"i0\"],[\"0\", \"0\", \"0\"],\n",
"# [\"cctk_lsh[2]\",\"cctk_lsh[1]\",\"cctk_lsh[0]\"],\n",
"# [\"1\",\"1\",\"1\"],\n",
"# [\"#pragma omp parallel for\",\"\",\"\",],\"\",\"\".join(copy_admbase_vars)))\n",
"\n",
" file.write(\"\"\"\n",
"CCTK_REAL *alphaSphorCartGF = alp;\n",