From 2a2e8fc02735673e8377f479261745df20d3060e Mon Sep 17 00:00:00 2001 From: Liwei Ji Date: Mon, 1 Jul 2024 16:36:04 -0400 Subject: [PATCH] Z4co: copy ccl files from Z4c --- Z4co/configuration.ccl | 3 + Z4co/interface.ccl | 52 ++++++++ Z4co/param.ccl | 103 +++++++++++++++ Z4co/schedule.ccl | 289 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 447 insertions(+) create mode 100644 Z4co/configuration.ccl create mode 100644 Z4co/interface.ccl create mode 100644 Z4co/param.ccl create mode 100644 Z4co/schedule.ccl diff --git a/Z4co/configuration.ccl b/Z4co/configuration.ccl new file mode 100644 index 00000000..81712b09 --- /dev/null +++ b/Z4co/configuration.ccl @@ -0,0 +1,3 @@ +# Configuration definitions for thorn Z4co + +REQUIRES Arith Loop NewRadX diff --git a/Z4co/interface.ccl b/Z4co/interface.ccl new file mode 100644 index 00000000..4ef00bca --- /dev/null +++ b/Z4co/interface.ccl @@ -0,0 +1,52 @@ +# Interface definition for thorn Z4co + +IMPLEMENTS: Z4co + +INHERITS: ADMBaseX TmunuBaseX + +USES INCLUDE HEADER: defs.hxx +USES INCLUDE HEADER: div.hxx +USES INCLUDE HEADER: dual.hxx +USES INCLUDE HEADER: loop_device.hxx +USES INCLUDE HEADER: mat.hxx +USES INCLUDE HEADER: simd.hxx +USES INCLUDE HEADER: sum.hxx +USES INCLUDE HEADER: vec.hxx +USES INCLUDE HEADER: vect.hxx + +USES INCLUDE HEADER: newradx.hxx + + +CCTK_INT FUNCTION GetCallFunctionCount() +REQUIRES FUNCTION GetCallFunctionCount + + + +# All variables have been shifted so that they tend to zero in flat space + +CCTK_REAL chi TYPE=gf TAGS='rhs="chi_rhs" dependents="ADMBaseX::metric"' "chi" +CCTK_REAL gamma_tilde TYPE=gf TAGS='parities={+1 +1 +1 -1 -1 +1 -1 +1 -1 +1 +1 +1 +1 -1 -1 +1 +1 +1} rhs="gamma_tilde_rhs" dependents="ADMBaseX::metric"' { gammatxx gammatxy gammatxz gammatyy gammatyz gammatzz } "gamma-tilde" +CCTK_REAL K_hat TYPE=gf TAGS='rhs="K_hat_rhs" dependents="ADMBaseX::curv"' { Kh } "K-hat" +CCTK_REAL A_tilde TYPE=gf TAGS='parities={+1 +1 +1 -1 -1 +1 -1 +1 -1 +1 +1 +1 +1 -1 -1 +1 +1 +1} rhs="A_tilde_rhs" dependents="ADMBaseX::curv"' { Atxx Atxy Atxz Atyy Atyz Atzz } "A-tilde" +CCTK_REAL Gam_tilde TYPE=gf TAGS='parities={-1 +1 +1 +1 -1 +1 +1 +1 -1} rhs="Gam_tilde_rhs"' { Gamtx Gamty Gamtz } "Gamma-tilde" +CCTK_REAL Theta TYPE=gf TAGS='rhs="Theta_rhs" dependents="ADMBaseX::curv"' "Theta" +CCTK_REAL alphaG TYPE=gf TAGS='rhs="alphaG_rhs" dependents="ADMBaseX::lapse ADMBaseX::dtlapse"' "alpha" +CCTK_REAL betaG TYPE=gf TAGS='parities={-1 +1 +1 +1 -1 +1 +1 +1 -1} rhs="betaG_rhs" dependents="ADMBaseX::shift ADMBaseX::dtshift"' { betaGx betaGy betaGz } "beta" + + + +CCTK_REAL ZtC TYPE=gf TAGS='parities={-1 +1 +1 +1 -1 +1 +1 +1 -1} checkpoint="no"' { ZtCx ZtCy ZtCz } "Z-tilde" +CCTK_REAL HC TYPE=gf TAGS='checkpoint="no"' "H" +CCTK_REAL MtC TYPE=gf TAGS='parities={-1 +1 +1 +1 -1 +1 +1 +1 -1} checkpoint="no"' { MtCx MtCy MtCz } "M-tilde" +CCTK_REAL allC TYPE=gf TAGS='checkpoint="no"' "constraint monitor" + + + +CCTK_REAL chi_rhs TYPE=gf TAGS='checkpoint="no"' "chi" +CCTK_REAL gamma_tilde_rhs TYPE=gf TAGS='parities={+1 +1 +1 -1 -1 +1 -1 +1 -1 +1 +1 +1 +1 -1 -1 +1 +1 +1} checkpoint="no"' { gammatxx_rhs gammatxy_rhs gammatxz_rhs gammatyy_rhs gammatyz_rhs gammatzz_rhs } "gamma-tilde" +CCTK_REAL K_hat_rhs TYPE=gf TAGS='checkpoint="no"' { Kh_rhs } "K-hat" +CCTK_REAL A_tilde_rhs TYPE=gf TAGS='parities={+1 +1 +1 -1 -1 +1 -1 +1 -1 +1 +1 +1 +1 -1 -1 +1 +1 +1} checkpoint="no"' { Atxx_rhs Atxy_rhs Atxz_rhs Atyy_rhs Atyz_rhs Atzz_rhs } "A-tilde" +CCTK_REAL Gam_tilde_rhs TYPE=gf TAGS='parities={-1 +1 +1 +1 -1 +1 +1 +1 -1} checkpoint="no"' { Gamtx_rhs Gamty_rhs Gamtz_rhs } "Gamma-tilde" +CCTK_REAL Theta_rhs TYPE=gf TAGS='checkpoint="no"' "Theta" +CCTK_REAL alphaG_rhs TYPE=gf TAGS='checkpoint="no"' "alpha" +CCTK_REAL betaG_rhs TYPE=gf TAGS='parities={-1 +1 +1 +1 -1 +1 +1 +1 -1} checkpoint="no"' { betaGx_rhs betaGy_rhs betaGz_rhs } "beta" diff --git a/Z4co/param.ccl b/Z4co/param.ccl new file mode 100644 index 00000000..c1a439fd --- /dev/null +++ b/Z4co/param.ccl @@ -0,0 +1,103 @@ +# Parameter definitions for thorn Z4co + +BOOLEAN calc_ADM_vars "Calculate ADM variables" STEERABLE=recover +{ +} yes + +BOOLEAN calc_ADMRHS_vars "Calculate RHS of ADM variables" STEERABLE=recover +{ +} yes + +BOOLEAN calc_constraints "Calculate constraints" STEERABLE=recover +{ +} yes + + +BOOLEAN set_Theta_zero "set Theta to zero, which converts Z4c to BSSN" +{ +} no + +CCTK_REAL kappa1 "kappa1" STEERABLE=always +{ + *:* :: "" +} 0.02 + +CCTK_REAL kappa2 "kappa2" STEERABLE=always +{ + *:* :: "" +} 0.0 + +CCTK_REAL f_mu_L "mu_L = f_mu_L / alpha" STEERABLE=always +{ + *:* :: "" +} 2.0 + +CCTK_REAL f_mu_S "mu_S = f_mu_S / alpha^2" STEERABLE=always +{ + *:* :: "" +} 1.0 + +CCTK_REAL eta "eta" STEERABLE=always +{ + *:* :: "" +} 2.0 + +CCTK_REAL chi_floor "Floor for chi" STEERABLE=always +{ + (0:* :: "" +} 1.0e-10 + +CCTK_REAL alphaG_floor "Floor for alphaG" STEERABLE=always +{ + (0:* :: "" +} 1.0e-10 + +CCTK_REAL epsdiss "Dissipation coefficient " STEERABLE=always +{ + 0.0:* :: "" +} 0.32 + +KEYWORD boundary_conditions "boundary conditions"{ + "NewRadX" :: "radiative boundary conditions using NewRadX" + "CarpetX" :: "use CarpetX default boundary conditions" +} "CarpetX" + +CCTK_INT n_chi "n power of outgoing boundary r^n fall off rate for chi" +{ + 0:2 :: "1 is reasonable" +} 1 + +CCTK_INT n_gammat "n power of outgoing boundary r^n fall off rate for gammat_ij" +{ + 0:2 :: "1 is reasonable" +} 1 + +CCTK_INT n_Kh "n power of outgoing boundary r^n fall off rate for Kh" +{ + 0:2 :: "Maybe 1?" +} 1 + +CCTK_INT n_At "n power of outgoing boundary r^n fall off rate for At_ij" +{ + 0:2 :: "Maybe 1?" +} 1 + +CCTK_INT n_Gamt "n power of outgoing boundary r^n fall off rate for Gamt^i" +{ + 0:2 :: "Maybe 1?" +} 1 + +CCTK_INT n_Theta "n power of outgoing boundary r^n fall off rate for Theta" +{ + 0:2 :: "Maybe 1?" +} 1 + +CCTK_INT n_alphaG "n power of outgoing boundary r^n fall off rate for alpha" +{ + 0:2 :: "1 is my guess" +} 1 + +CCTK_INT n_betaG "n power of outgoing boundary r^n fall off rate for beta" +{ + 0:2 :: "1 is my guess" +} 1 diff --git a/Z4co/schedule.ccl b/Z4co/schedule.ccl new file mode 100644 index 00000000..9788366c --- /dev/null +++ b/Z4co/schedule.ccl @@ -0,0 +1,289 @@ +# Schedule definitions for thorn Z4co + +STORAGE: chi +STORAGE: gamma_tilde +STORAGE: K_hat +STORAGE: A_tilde +STORAGE: Gam_tilde +STORAGE: Theta +STORAGE: alphaG +STORAGE: betaG + +STORAGE: ZtC +STORAGE: HC +STORAGE: MtC +STORAGE: allC + +STORAGE: chi_rhs +STORAGE: gamma_tilde_rhs +STORAGE: K_hat_rhs +STORAGE: A_tilde_rhs +STORAGE: Gam_tilde_rhs +STORAGE: Theta_rhs +STORAGE: alphaG_rhs +STORAGE: betaG_rhs + + + +################################################################################ + + + +SCHEDULE GROUP Z4co_InitialGroup AT initial AFTER ADMBaseX_PostInitial +{ +} "Convert ADM to Z4c variables" + +SCHEDULE GROUP Z4co_PostStepGroup AT initial AFTER Z4co_InitialGroup BEFORE ADMBaseX_SetADMVars +{ +} "Post-process Z4c variables" + +SCHEDULE GROUP Z4co_PostStepGroup2 AT initial AFTER (TmunuBaseX_SetTmunuVars, Z4co_PostStepGroup) BEFORE ADMBaseX_SetADMRHS +{ +} "Post-process Z4c variables, part 2" + + + +SCHEDULE GROUP Z4co_PostStepGroup AT postregrid BEFORE ADMBaseX_SetADMVars +{ +} "Post-process Z4c variables" + +SCHEDULE GROUP Z4co_PostStepGroup2 AT postregrid AFTER (TmunuBaseX_SetTmunuVars, Z4co_PostStepGroup) BEFORE ADMBaseX_SetADMRHS +{ +} "Post-process Z4c variables, part 2" + + + +SCHEDULE GROUP Z4co_AnalysisGroup AT analysis +{ +} "Analyse Z4c variables" + + + +SCHEDULE GROUP Z4co_PostStepGroup IN ODESolvers_PostStep BEFORE ADMBaseX_SetADMVars +{ +} "Post-process Z4c variables" + +SCHEDULE GROUP Z4co_PostStepGroup2 IN ODESolvers_PostStep AFTER (TmunuBaseX_SetTmunuVars, Z4co_PostStepGroup) BEFORE ADMBaseX_SetADMRHS +{ +} "Post-process Z4c variables, part 2" + +SCHEDULE GROUP Z4co_RHSGroup IN ODESolvers_RHS +{ +} "Calculate Z4c RHS" + + + +################################################################################ + + + +SCHEDULE Z4co_Test AT wragh +{ + LANG: C + OPTIONS: meta +} "Self-test" + + + +# We have 4 schedule groups: +# 1. initial: set up core Z4c variables from ADM variables +# 2. poststep: post-process core Z4c variables and calculate other variables +# 3. analysis: calculate constraints etc. +# 4. rhs: calculate RHS of Z4c variables + + + +SCHEDULE Z4co_Initial1 IN Z4co_InitialGroup +{ + LANG: C + READS: ADMBaseX::metric(interior) + READS: ADMBaseX::curv(interior) + READS: ADMBaseX::lapse(interior) + READS: ADMBaseX::shift(interior) + WRITES: chi(interior) + WRITES: gamma_tilde(interior) + WRITES: K_hat(interior) + WRITES: A_tilde(interior) + WRITES: Theta(interior) + WRITES: alphaG(interior) + WRITES: betaG(interior) + # SYNC: chi + SYNC: gamma_tilde + # SYNC: K_hat + # SYNC: A_tilde + # SYNC: Theta + # SYNC: alphaG + # SYNC: betaG +} "Convert ADM to Z4c variables, part 1" + +SCHEDULE Z4co_Initial2 IN Z4co_InitialGroup AFTER Z4co_Initial1 +{ + LANG: C + READS: gamma_tilde(everywhere) + WRITES: Gam_tilde(interior) + # SYNC: Gam_tilde +} "Convert ADM to Z4c variables, part 2" + + + +SCHEDULE Z4co_Enforce IN Z4co_PostStepGroup +{ + LANG: C + READS: chi(interior) + READS: gamma_tilde(interior) + READS: A_tilde(interior) + READS: alphaG(interior) + WRITES: chi(interior) + WRITES: gamma_tilde(interior) + WRITES: A_tilde(interior) + WRITES: alphaG(interior) + SYNC: chi + SYNC: gamma_tilde + SYNC: K_hat + SYNC: A_tilde + SYNC: Gam_tilde + SYNC: Theta + SYNC: alphaG + SYNC: betaG +} "Enforce algebraic Z4c constraints" + +if (calc_ADM_vars) { + SCHEDULE Z4co_ADM IN Z4co_PostStepGroup AFTER Z4co_Enforce + { + LANG: C + READS: chi(everywhere) + READS: gamma_tilde(everywhere) + READS: K_hat(everywhere) + READS: A_tilde(everywhere) + READS: Gam_tilde(everywhere) + READS: Theta(everywhere) + READS: alphaG(everywhere) + READS: betaG(everywhere) + # READS: TmunuBaseX::eTtt(interior) + # READS: TmunuBaseX::eTti(interior) + # READS: TmunuBaseX::eTij(interior) + WRITES: ADMBaseX::metric(everywhere) + WRITES: ADMBaseX::curv(everywhere) + WRITES: ADMBaseX::lapse(everywhere) + WRITES: ADMBaseX::dtlapse(everywhere) + WRITES: ADMBaseX::shift(everywhere) + WRITES: ADMBaseX::dtshift(everywhere) + } "Convert Z4c to ADM variables" +} + +if (calc_ADMRHS_vars) { + SCHEDULE Z4co_ADM2 IN Z4co_PostStepGroup2 + { + LANG: C + READS: chi(everywhere) + READS: gamma_tilde(everywhere) + READS: K_hat(everywhere) + READS: A_tilde(everywhere) + READS: Gam_tilde(everywhere) + READS: Theta(everywhere) + READS: alphaG(everywhere) + READS: betaG(everywhere) + READS: TmunuBaseX::eTtt(interior) + READS: TmunuBaseX::eTti(interior) + READS: TmunuBaseX::eTij(interior) + WRITES: ADMBaseX::dtcurv(interior) + WRITES: ADMBaseX::dt2lapse(interior) + WRITES: ADMBaseX::dt2shift(interior) + SYNC: ADMBaseX::dtcurv + SYNC: ADMBaseX::dt2lapse + SYNC: ADMBaseX::dt2shift + } "Calculate second time derivatives of ADM variables" +} + + + +if (calc_constraints) { + SCHEDULE Z4co_Constraints IN Z4co_AnalysisGroup + { + LANG: C + READS: chi(everywhere) + READS: gamma_tilde(everywhere) + READS: K_hat(everywhere) + READS: A_tilde(everywhere) + READS: Gam_tilde(everywhere) + READS: Theta(everywhere) + READS: alphaG(everywhere) + READS: betaG(everywhere) + READS: TmunuBaseX::eTtt(interior) + READS: TmunuBaseX::eTti(interior) + READS: TmunuBaseX::eTij(interior) + WRITES: ZtC(interior) + WRITES: HC(interior) + WRITES: MtC(interior) + WRITES: allC(interior) + # SYNC: ZtC + # SYNC: HC + # SYNC: MtC + # SYNC: allC + } "Calculate Z4c constraints" +} + + + +SCHEDULE Z4co_RHS IN Z4co_RHSGroup +{ + LANG: C + READS: chi(everywhere) + READS: gamma_tilde(everywhere) + READS: K_hat(everywhere) + READS: A_tilde(everywhere) + READS: Gam_tilde(everywhere) + READS: Theta(everywhere) + READS: alphaG(everywhere) + READS: betaG(everywhere) + READS: TmunuBaseX::eTtt(interior) + READS: TmunuBaseX::eTti(interior) + READS: TmunuBaseX::eTij(interior) + WRITES: chi_rhs(interior) + WRITES: gamma_tilde_rhs(interior) + WRITES: K_hat_rhs(interior) + WRITES: A_tilde_rhs(interior) + WRITES: Gam_tilde_rhs(interior) + WRITES: Theta_rhs(interior) + WRITES: alphaG_rhs(interior) + WRITES: betaG_rhs(interior) + SYNC: chi_rhs + SYNC: gamma_tilde_rhs + SYNC: K_hat_rhs + SYNC: A_tilde_rhs + SYNC: Gam_tilde_rhs + SYNC: Theta_rhs + SYNC: alphaG_rhs + SYNC: betaG_rhs +} "Calculate Z4c RHS" + +if (CCTK_Equals(boundary_conditions, "NewRadX")) { + SCHEDULE Z4co_apply_newradx_boundary_conditions IN Z4co_RHSGroup AFTER Z4co_RHS + { + LANG: C + READS: chi(everywhere) + READS: gamma_tilde(everywhere) + READS: K_hat(everywhere) + READS: A_tilde(everywhere) + READS: Gam_tilde(everywhere) + READS: Theta(everywhere) + READS: alphaG(everywhere) + READS: betaG(everywhere) + READS: chi_rhs(everywhere) + READS: gamma_tilde_rhs(everywhere) + READS: K_hat_rhs(everywhere) + READS: A_tilde_rhs(everywhere) + READS: Gam_tilde_rhs(everywhere) + READS: Theta_rhs(everywhere) + READS: alphaG_rhs(everywhere) + READS: betaG_rhs(everywhere) + WRITES: chi_rhs(interior) + WRITES: gamma_tilde_rhs(interior) + WRITES: K_hat_rhs(interior) + WRITES: A_tilde_rhs(interior) + WRITES: Gam_tilde_rhs(interior) + WRITES: Theta_rhs(interior) + WRITES: alphaG_rhs(interior) + WRITES: betaG_rhs(interior) + } "Apply radiative boundary conditions to Z4c RHS variables using NewRadX" +}