-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add two apple-with-apple tests (#625)
* fixing ricci scalar * spin for kerr-schild * strong stability test * input script for stability test * fix bug and cleanup * delete unused variables * gauge wave test * add input for gauge wave, test still failing * add initial lapse, still does not fix the error * update input files * moving the awa tests to the pgen folder * fix default build --------- Co-authored-by: Hengrui Zhu <[email protected]>
- Loading branch information
1 parent
ab90fba
commit 49909af
Showing
5 changed files
with
529 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# AthenaXXX input file for Z4c linear wave tests | ||
|
||
<comment> | ||
problem = z4c linear waves | ||
reference = e.g. Daverio et al. arxiv:1810.12346 (2018) | ||
|
||
<job> | ||
basename = gauge # problem ID: basename of output filenames | ||
|
||
<mesh> | ||
nghost = 2 # Number of ghost cells | ||
nx1 = 50 # Number of zones in X1-direction | ||
x1min = 0.0 # minimum value of X1 | ||
x1max = 1.0 # maximum value of X1 | ||
ix1_bc = periodic # inner-X1 boundary flag | ||
ox1_bc = periodic # outer-X1 boundary flag | ||
|
||
nx2 = 4 # Number of zones in X2-direction | ||
x2min = 0.0 # minimum value of X2 | ||
x2max = 1.0 # maximum value of X2 | ||
ix2_bc = periodic # inner-X2 boundary flag | ||
ox2_bc = periodic # outer-X2 boundary flag | ||
|
||
nx3 = 4 # Number of zones in X3-direction | ||
x3min = 0.0 # minimum value of X3 | ||
x3max = 1.0 # maximum value of X3 | ||
ix3_bc = periodic # inner-X3 boundary flag | ||
ox3_bc = periodic # outer-X3 boundary flag | ||
|
||
<meshblock> | ||
nx1 = 50 # Number of cells in each MeshBlock, X1-dir | ||
nx2 = 4 # Number of cells in each MeshBlock, X2-dir | ||
nx3 = 4 # Number of cells in each MeshBlock, X3-dir | ||
|
||
<time> | ||
evolution = dynamic # dynamic/kinematic/static | ||
integrator = rk4 # time integration algorithm | ||
cfl_number = 0.5 # The Courant, Friedrichs, & Lewy (CFL) Number | ||
nlim = -1 # cycle limit (no limit if <0) | ||
tlim = 1000.0 # time limit | ||
ndiag = 1 # cycles between diagostic output | ||
|
||
<z4c> | ||
lapse_harmonic = 0.0 # Harmonic lapse parameter mu_L | ||
lapse_oplog = 2.0 # 1+log lapse parameter | ||
shift_eta = 2.0 # Shift damping term | ||
diss = 0.02 # Kreiss-Oliger dissipation parameter | ||
chi_div_floor = 0.00001 # Floor on the conformal factor | ||
damp_kappa1 = 0.02 # Constraint damping factor 1 | ||
damp_kappa2 = 0.0 # Constraint damping factor 2 | ||
|
||
<problem> | ||
pgen_name = z4c_gauge_wave # problem generator name | ||
amp = 0.01 | ||
|
||
<output1> | ||
file_type = tab # legacy VTK output | ||
variable = z4c # variables to be output | ||
dt = 1 # time increment between outputs | ||
slice_x2 = 0.5 | ||
slice_x3 = 0.5 | ||
ghost_zones = true # switch to output ghost cells | ||
|
||
<output2> | ||
file_type = hst # history data dump | ||
user_hist = false | ||
data_format = %12.5e # Optional data format string | ||
dt = 1 # time increment between outputs | ||
|
||
#<output3> | ||
#file_type = tab # legacy VTK output | ||
#variable = z4c # variables to be output | ||
#dt = 0.025 # time increment between outputs | ||
#slice_x2 = 0.5 | ||
#slice_x3 = 0.5 | ||
#ghost_zones = true # switch to output ghost cells |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# AthenaXXX input file for Z4c linear wave tests | ||
|
||
<comment> | ||
problem = z4c linear waves | ||
reference = e.g. Daverio et al. arxiv:1810.12346 (2018) | ||
|
||
<job> | ||
basename = stability # problem ID: basename of output filenames | ||
|
||
<mesh> | ||
nghost = 2 # Number of ghost cells | ||
nx1 = 4 # Number of zones in X1-direction | ||
x1min = 0.0 # minimum value of X1 | ||
x1max = 1.0 # maximum value of X1 | ||
ix1_bc = periodic # inner-X1 boundary flag | ||
ox1_bc = periodic # outer-X1 boundary flag | ||
|
||
nx2 = 4 # Number of zones in X2-direction | ||
x2min = 0.0 # minimum value of X2 | ||
x2max = 1.0 # maximum value of X2 | ||
ix2_bc = periodic # inner-X2 boundary flag | ||
ox2_bc = periodic # outer-X2 boundary flag | ||
|
||
nx3 = 50 # Number of zones in X3-direction | ||
x3min = 0.0 # minimum value of X3 | ||
x3max = 1.0 # maximum value of X3 | ||
ix3_bc = periodic # inner-X3 boundary flag | ||
ox3_bc = periodic # outer-X3 boundary flag | ||
|
||
<meshblock> | ||
nx1 = 4 # Number of cells in each MeshBlock, X1-dir | ||
nx2 = 4 # Number of cells in each MeshBlock, X2-dir | ||
nx3 = 50 # Number of cells in each MeshBlock, X3-dir | ||
|
||
<time> | ||
evolution = dynamic # dynamic/kinematic/static | ||
integrator = rk4 # time integration algorithm | ||
cfl_number = 0.5 # The Courant, Friedrichs, & Lewy (CFL) Number | ||
nlim = -1 # cycle limit (no limit if <0) | ||
tlim = 1000.0 # time limit | ||
ndiag = 1 # cycles between diagostic output | ||
|
||
<z4c> | ||
diss = 0.02 | ||
lapse_harmonic = 0.0 # Harmonic lapse parameter mu_L | ||
lapse_oplog = 1.0 # 1+log lapse parameter | ||
shift_eta = 2.0 # Shift damping term | ||
chi_div_floor = 0.00001 | ||
damp_kappa1 = 0.00 # Constraint damping factor 1 | ||
damp_kappa2 = 0.02 | ||
|
||
|
||
<problem> | ||
pgen_name = z4c_stability # problem generator name | ||
user_hist = true # enroll user-defined history function | ||
rho = 1 | ||
|
||
<output1> | ||
file_type = tab # legacy VTK output | ||
variable = z4c # variables to be output | ||
dt = 100 # time increment between outputs | ||
slice_x1 = 0.5 | ||
slice_x2 = 0.5 | ||
ghost_zones = true # switch to output ghost cells | ||
|
||
<output2> | ||
file_type = hst # history data dump | ||
user_hist = true | ||
data_format = %12.5e # Optional data format string | ||
dt = 1 # time increment between outputs | ||
|
||
<output2> | ||
file_type = hst # history data dump | ||
user_hist = false | ||
data_format = %12.5e # Optional data format string | ||
dt = 1 # time increment between outputs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
//======================================================================================== | ||
// AthenaXXX astrophysical plasma code | ||
// Copyright(C) 2020 James M. Stone <[email protected]> and the Athena code team | ||
// Licensed under the 3-clause BSD License (the "LICENSE") | ||
//======================================================================================== | ||
//! \file z4c_gauge_wave.cpp | ||
//! \brief z4c gauge wave test | ||
|
||
|
||
// C/C++ headers | ||
#include <algorithm> // min, max | ||
#include <cmath> // sqrt() | ||
#include <cstdio> // fopen(), fprintf(), freopen() | ||
#include <iostream> // endl | ||
#include <sstream> // stringstream | ||
#include <string> // c_str() | ||
#include <limits> | ||
|
||
// Athena++ headers | ||
#include "athena.hpp" | ||
#include "globals.hpp" | ||
#include "parameter_input.hpp" | ||
#include "coordinates/cell_locations.hpp" | ||
#include "coordinates/adm.hpp" | ||
#include "mesh/mesh.hpp" | ||
#include "z4c/z4c.hpp" | ||
#include "driver/driver.hpp" | ||
#include "pgen/pgen.hpp" | ||
|
||
// function to compute errors in solution at end of run | ||
void Z4cGaugeWaveErrors(ParameterInput *pin, Mesh *pm); | ||
|
||
//---------------------------------------------------------------------------------------- | ||
//! \fn void ProblemGenerator::UserProblem() | ||
//! \brief Sets initial conditions for gw linear wave tests | ||
|
||
void ProblemGenerator::UserProblem(ParameterInput *pin, const bool restart) { | ||
if (restart) | ||
return; | ||
|
||
MeshBlockPack *pmbp = pmy_mesh_->pmb_pack; | ||
if (pmbp->pz4c == nullptr) { | ||
std::cout << "### FATAL ERROR in " << __FILE__ << " at line " << __LINE__ << std::endl | ||
<< "Z4c Wave test can only be run in Z4c, but no <z4c> block " | ||
<< "in input file" << std::endl; | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
// Prepare Initial Data | ||
|
||
// capture variables for the kernel | ||
auto &indcs = pmbp->pmesh->mb_indcs; | ||
auto &size = pmbp->pmb->mb_size; | ||
int &is = indcs.is; | ||
int &ie = indcs.ie; | ||
int &js = indcs.js; | ||
int &je = indcs.je; | ||
int &ks = indcs.ks; | ||
int &ke = indcs.ke; | ||
|
||
int isg = is-indcs.ng; int ieg = ie+indcs.ng; | ||
int jsg = js-indcs.ng; int jeg = je+indcs.ng; | ||
int ksg = ks-indcs.ng; int keg = ke+indcs.ng; | ||
|
||
auto &pz4c = pmbp->pz4c; | ||
auto &adm = pmbp->padm->adm; | ||
Real x1size = pmy_mesh_->mesh_size.x1max - pmy_mesh_->mesh_size.x1min; | ||
std::cout << x1size << std::endl; | ||
|
||
// Wave amplitude | ||
Real amp = pin->GetOrAddReal("problem", "amp", 0.001); | ||
|
||
par_for("pgen_gauge_wave", DevExeSpace(), 0, (pmbp->nmb_thispack - 1), | ||
ksg, keg, jsg, jeg, isg, ieg, KOKKOS_LAMBDA(int m, int k, int j, int i) { | ||
Real &x1min = size.d_view(m).x1min; | ||
Real &x1max = size.d_view(m).x1max; | ||
|
||
int nx1 = indcs.nx1; | ||
|
||
Real x1v = CellCenterX(i - is, nx1, x1min, x1max); | ||
Real H = amp * sin(2 * M_PI * x1v / x1size); | ||
Real dH_dt = - amp * 2 * M_PI / x1size * | ||
cos(2 * M_PI * x1v / x1size); | ||
|
||
adm.g_dd(m,0,0,k,j,i) = 1 - H; | ||
adm.g_dd(m,0,1,k,j,i) = 0; | ||
adm.g_dd(m,0,2,k,j,i) = 0; | ||
adm.g_dd(m,1,1,k,j,i) = 1; | ||
adm.g_dd(m,1,2,k,j,i) = 0; | ||
adm.g_dd(m,2,2,k,j,i) = 1; | ||
|
||
adm.vK_dd(m,0,0,k,j,i) = 0.5 * dH_dt / sqrt(adm.g_dd(m,0,0,k,j,i)); | ||
adm.vK_dd(m,0,1,k,j,i) = 0; | ||
adm.vK_dd(m,0,2,k,j,i) = 0; | ||
adm.vK_dd(m,1,1,k,j,i) = 0; | ||
adm.vK_dd(m,1,2,k,j,i) = 0; | ||
adm.vK_dd(m,2,2,k,j,i) = 0; | ||
|
||
adm.alpha(m,k,j,i) = sqrt(1 - H); | ||
}); | ||
switch (indcs.ng) { | ||
case 2: pmbp->pz4c->ADMToZ4c<2>(pmbp, pin); | ||
break; | ||
case 3: pmbp->pz4c->ADMToZ4c<3>(pmbp, pin); | ||
break; | ||
case 4: pmbp->pz4c->ADMToZ4c<4>(pmbp, pin); | ||
break; | ||
} | ||
pmbp->pz4c->Z4cToADM(pmbp); | ||
switch (indcs.ng) { | ||
case 2: pmbp->pz4c->ADMConstraints<2>(pmbp); | ||
break; | ||
case 3: pmbp->pz4c->ADMConstraints<3>(pmbp); | ||
break; | ||
case 4: pmbp->pz4c->ADMConstraints<4>(pmbp); | ||
break; | ||
} | ||
return; | ||
} |
Oops, something went wrong.