Skip to content

Commit

Permalink
Z4cow: add Z4cow_set_ADM.hxx
Browse files Browse the repository at this point in the history
  • Loading branch information
lwJi committed Sep 11, 2024
1 parent 520ae4c commit 1411c9f
Show file tree
Hide file tree
Showing 2 changed files with 179 additions and 0 deletions.
126 changes: 126 additions & 0 deletions Z4cow/wolfram/Z4cow_set_ADM.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/* Z4cow_set_ADM.hxx */
/* Produced with Mathematica */

#ifndef Z4COW_SET_ADM_HXX
#define Z4COW_SET_ADM_HXX

const GF3D2<CCTK_REAL> &local_ADMgam11 = gf_ADMgam(0,0);
const GF3D2<CCTK_REAL> &local_ADMgam12 = gf_ADMgam(0,1);
const GF3D2<CCTK_REAL> &local_ADMgam13 = gf_ADMgam(0,2);
const GF3D2<CCTK_REAL> &local_ADMgam22 = gf_ADMgam(1,1);
const GF3D2<CCTK_REAL> &local_ADMgam23 = gf_ADMgam(1,2);
const GF3D2<CCTK_REAL> &local_ADMgam33 = gf_ADMgam(2,2);
const GF3D2<CCTK_REAL> &local_ADMK11 = gf_ADMK(0,0);
const GF3D2<CCTK_REAL> &local_ADMK12 = gf_ADMK(0,1);
const GF3D2<CCTK_REAL> &local_ADMK13 = gf_ADMK(0,2);
const GF3D2<CCTK_REAL> &local_ADMK22 = gf_ADMK(1,1);
const GF3D2<CCTK_REAL> &local_ADMK23 = gf_ADMK(1,2);
const GF3D2<CCTK_REAL> &local_ADMK33 = gf_ADMK(2,2);
const GF3D2<CCTK_REAL> &local_ADMalpha = gf_ADMalpha;
const GF3D2<CCTK_REAL> &local_ADMbeta1 = gf_ADMbeta(0);
const GF3D2<CCTK_REAL> &local_ADMbeta2 = gf_ADMbeta(1);
const GF3D2<CCTK_REAL> &local_ADMbeta3 = gf_ADMbeta(2);

grid.loop_all_device<0, 0, 0, vsize>(
grid.nghostzones, [=] ARITH_DEVICE(const PointDesc &p) ARITH_INLINE {
const vbool mask = mask_for_loop_tail<vbool>(p.i, p.imax);
const GF3D2index index2(layout2, p.I);

const auto &tmp_W = gf_W(mask, index2);
const auto &tmp_gamt = gf_gamt(mask, index2);
const auto &tmp_exKh = gf_exKh(mask, index2);
const auto &tmp_exAt = gf_exAt(mask, index2);
const auto &tmp_Theta = gf_Theta(mask, index2);
const auto &tmp_alpha = gf_alpha(mask, index2);
const auto &tmp_beta = gf_beta(mask, index2);

const vreal W = tmp_W;
const vreal gamt11 = tmp_gamt(0,0);
const vreal gamt12 = tmp_gamt(0,1);
const vreal gamt13 = tmp_gamt(0,2);
const vreal gamt22 = tmp_gamt(1,1);
const vreal gamt23 = tmp_gamt(1,2);
const vreal gamt33 = tmp_gamt(2,2);
const vreal exKh = tmp_exKh;
const vreal exAt11 = tmp_exAt(0,0);
const vreal exAt12 = tmp_exAt(0,1);
const vreal exAt13 = tmp_exAt(0,2);
const vreal exAt22 = tmp_exAt(1,1);
const vreal exAt23 = tmp_exAt(1,2);
const vreal exAt33 = tmp_exAt(2,2);
const vreal Theta = tmp_Theta;
const vreal alpha = tmp_alpha;
const vreal beta1 = tmp_beta(0);
const vreal beta2 = tmp_beta(1);
const vreal beta3 = tmp_beta(2);

local_ADMgam11.store(mask, index2,
gamt11/Power(W,2)
);

local_ADMgam12.store(mask, index2,
gamt12/Power(W,2)
);

local_ADMgam13.store(mask, index2,
gamt13/Power(W,2)
);

local_ADMgam22.store(mask, index2,
gamt22/Power(W,2)
);

local_ADMgam23.store(mask, index2,
gamt23/Power(W,2)
);

local_ADMgam33.store(mask, index2,
gamt33/Power(W,2)
);

local_ADMK11.store(mask, index2,
(exAt11 + (gamt11*(exKh + 2*Theta))/3.)/Power(W,2)
);

local_ADMK12.store(mask, index2,
(exAt12 + (gamt12*(exKh + 2*Theta))/3.)/Power(W,2)
);

local_ADMK13.store(mask, index2,
(exAt13 + (gamt13*(exKh + 2*Theta))/3.)/Power(W,2)
);

local_ADMK22.store(mask, index2,
(exAt22 + (gamt22*(exKh + 2*Theta))/3.)/Power(W,2)
);

local_ADMK23.store(mask, index2,
(exAt23 + (gamt23*(exKh + 2*Theta))/3.)/Power(W,2)
);

local_ADMK33.store(mask, index2,
(exAt33 + (gamt33*(exKh + 2*Theta))/3.)/Power(W,2)
);

local_ADMalpha.store(mask, index2,
alpha
);

local_ADMbeta1.store(mask, index2,
beta1
);

local_ADMbeta2.store(mask, index2,
beta2
);

local_ADMbeta3.store(mask, index2,
beta3
);


});

#endif // #ifndef Z4COW_SET_ADM_HXX

/* Z4cow_set_ADM.hxx */
53 changes: 53 additions & 0 deletions Z4cow/wolfram/Z4cow_set_ADM.wl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
(* ::Package:: *)

(* Z4c_set_rhs.wl *)

(* (c) Liwei Ji, 07/2024 *)

Needs["xAct`xCoba`", FileNameJoin[{Environment["GENERATO"], "src/Generato.wl"
}]]

SetPVerbose[False];

SetPrintDate[False];

SetGridPointIndex[""];

SetTempVariableType["vreal"];

DefManifold[M3, 3, IndexRange[a, z]];

DefChart[cart, M3, {1, 2, 3}, {X[], Y[], Z[]}, ChartColor -> Blue];

(* Define Variables *)

<<wl/Z4c_vars.wl

<<wl/ADM_vars.wl

<<wl/ADM_rhs.wl

SetOutputFile[FileNameJoin[{Directory[], "Z4cow_set_ADM.hxx"}]];

$MainPrint[] :=
Module[{},
PrintInitializations[{Mode -> "MainOut"}, ADMVarlist];
pr[];

pr["grid.loop_all_device<0, 0, 0, vsize>("];
pr[" grid.nghostzones, [=] ARITH_DEVICE(const PointDesc &p) ARITH_INLINE {"];
pr[" const vbool mask = mask_for_loop_tail<vbool>(p.i, p.imax);"];
pr[" const GF3D2index index2(layout2, p.I);"];
pr[];

PrintListInitializations[Drop[EvolVarlist, {5}], "gf_", "index2"];
pr[];

PrintInitializations[{Mode -> "MainIn"}, Drop[EvolVarlist, {5}]];
pr[];
PrintEquations[{Mode -> "Main"}, ADMVarlist];
pr[];
pr["});"];
];

Import[FileNameJoin[{Environment["GENERATO"], "codes/CarpetX.wl"}]];

0 comments on commit 1411c9f

Please sign in to comment.