Skip to content

Commit

Permalink
TestODESolvers2: Apply boundary conditions properly
Browse files Browse the repository at this point in the history
  • Loading branch information
eschnett committed Jun 8, 2024
1 parent 4ed5513 commit 6bc9ff5
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 20 deletions.
24 changes: 13 additions & 11 deletions TestODESolvers2/schedule.ccl
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,28 @@ STORAGE: state rhs error order
SCHEDULE TestODESolvers2_Initial AT initial
{
LANG: C
WRITES: state(everywhere)
WRITES: state(interior)
SYNC: state
} "Initialize state vector"

SCHEDULE TestODESolvers2_RHS IN ODESolvers_RHS
{
LANG: C
READS: state(everywhere)
WRITES: rhs(everywhere)
READS: state(interior)
WRITES: rhs(interior)
} "RHS function"

# SCHEDULE TestODESolvers2_Boundary AT poststep
# {
# LANG: C
# OPTIONS: global
# SYNC: state
# } "Apply boundary conditions to state vector"
SCHEDULE TestODESolvers2_Boundary IN ODESolvers_PostStep
{
LANG: C
OPTIONS: global
SYNC: state
} "Apply boundary conditions to state vector"

SCHEDULE TestODESolvers2_Error AT analysis
{
LANG: C
READS: state(everywhere)
WRITES: error(everywhere) order(everywhere)
READS: state(interior)
WRITES: error(interior) order(interior)
SYNC: error order
} "Calculate error in state vector"
18 changes: 9 additions & 9 deletions TestODESolvers2/src/odes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ extern "C" void TestODESolvers2_Initial(CCTK_ARGUMENTS) {
const Loop::GF3D<CCTK_REAL, 1, 1, 1> exp1_(cctkGH, exp1);
const Loop::GF3D<CCTK_REAL, 1, 1, 1> exp2_(cctkGH, exp2);

Loop::loop_all<1, 1, 1>(cctkGH, [&](const Loop::PointDesc &p) {
Loop::loop_int<1, 1, 1>(cctkGH, [&](const Loop::PointDesc &p) {
time_(p.I) = cctk_time;
poly_(p.I) = pow(1 + cctk_time, porder);
exp1_(p.I) = exp(cctk_time);
exp2_(p.I) = exp(cctk_time / 2);
});
}

// extern "C" void TestODESolvers2_Boundary(CCTK_ARGUMENTS) {
// DECLARE_CCTK_ARGUMENTS_TestODESolvers2_Boundary;
// DECLARE_CCTK_PARAMETERS;
//
// // do nothing
// }
extern "C" void TestODESolvers2_Boundary(CCTK_ARGUMENTS) {
DECLARE_CCTK_ARGUMENTS_TestODESolvers2_Boundary;
DECLARE_CCTK_PARAMETERS;

// do nothing
}

extern "C" void TestODESolvers2_RHS(CCTK_ARGUMENTS) {
DECLARE_CCTK_ARGUMENTS_TestODESolvers2_RHS;
Expand All @@ -66,7 +66,7 @@ extern "C" void TestODESolvers2_RHS(CCTK_ARGUMENTS) {
const Loop::GF3D<CCTK_REAL, 1, 1, 1> exp1_rhs_(cctkGH, exp1_rhs);
const Loop::GF3D<CCTK_REAL, 1, 1, 1> exp2_rhs_(cctkGH, exp2_rhs);

Loop::loop_all<1, 1, 1>(cctkGH, [&](const Loop::PointDesc &p) {
Loop::loop_int<1, 1, 1>(cctkGH, [&](const Loop::PointDesc &p) {
if (porder > 0)
if (abs(time_(p.I) - cctk_time) >
10 * numeric_limits<CCTK_REAL>::epsilon())
Expand All @@ -92,7 +92,7 @@ extern "C" void TestODESolvers2_Error(CCTK_ARGUMENTS) {
const Loop::GF3D<CCTK_REAL, 1, 1, 1> poly_err_(cctkGH, poly_err);
const Loop::GF3D<CCTK_REAL, 1, 1, 1> exp_order_(cctkGH, exp_order);

Loop::loop_all<1, 1, 1>(cctkGH, [&](const Loop::PointDesc &p) {
Loop::loop_int<1, 1, 1>(cctkGH, [&](const Loop::PointDesc &p) {
time_err_(p.I) = time_(p.I) - cctk_time;
poly_err_(p.I) = poly_(p.I) - pow(1 + cctk_time, porder);
if (cctk_iteration == 0) {
Expand Down
7 changes: 7 additions & 0 deletions TestODESolvers2/test/test-dp87.par
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ CarpetX::blocking_factor_z = 1

CarpetX::ghost_size = 0

CarpetX::boundary_x = "dirichlet"
CarpetX::boundary_y = "dirichlet"
CarpetX::boundary_z = "dirichlet"
CarpetX::boundary_upper_x = "dirichlet"
CarpetX::boundary_upper_y = "dirichlet"
CarpetX::boundary_upper_z = "dirichlet"

CarpetX::dtfac = 1.0
Cactus::cctk_itlast = 1

Expand Down
7 changes: 7 additions & 0 deletions TestODESolvers2/test/test-euler.par
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ CarpetX::blocking_factor_z = 1

CarpetX::ghost_size = 0

CarpetX::boundary_x = "dirichlet"
CarpetX::boundary_y = "dirichlet"
CarpetX::boundary_z = "dirichlet"
CarpetX::boundary_upper_x = "dirichlet"
CarpetX::boundary_upper_y = "dirichlet"
CarpetX::boundary_upper_z = "dirichlet"

CarpetX::dtfac = 1.0
Cactus::cctk_itlast = 1

Expand Down
7 changes: 7 additions & 0 deletions TestODESolvers2/test/test-rk2.par
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ CarpetX::blocking_factor_z = 1

CarpetX::ghost_size = 0

CarpetX::boundary_x = "dirichlet"
CarpetX::boundary_y = "dirichlet"
CarpetX::boundary_z = "dirichlet"
CarpetX::boundary_upper_x = "dirichlet"
CarpetX::boundary_upper_y = "dirichlet"
CarpetX::boundary_upper_z = "dirichlet"

CarpetX::dtfac = 1.0
Cactus::cctk_itlast = 1

Expand Down
7 changes: 7 additions & 0 deletions TestODESolvers2/test/test-rk3.par
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ CarpetX::blocking_factor_z = 1

CarpetX::ghost_size = 0

CarpetX::boundary_x = "dirichlet"
CarpetX::boundary_y = "dirichlet"
CarpetX::boundary_z = "dirichlet"
CarpetX::boundary_upper_x = "dirichlet"
CarpetX::boundary_upper_y = "dirichlet"
CarpetX::boundary_upper_z = "dirichlet"

CarpetX::dtfac = 1.0
Cactus::cctk_itlast = 1

Expand Down
7 changes: 7 additions & 0 deletions TestODESolvers2/test/test-rk4.par
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ CarpetX::blocking_factor_z = 1

CarpetX::ghost_size = 0

CarpetX::boundary_x = "dirichlet"
CarpetX::boundary_y = "dirichlet"
CarpetX::boundary_z = "dirichlet"
CarpetX::boundary_upper_x = "dirichlet"
CarpetX::boundary_upper_y = "dirichlet"
CarpetX::boundary_upper_z = "dirichlet"

CarpetX::dtfac = 1.0
Cactus::cctk_itlast = 1

Expand Down
7 changes: 7 additions & 0 deletions TestODESolvers2/test/test-rkf78.par
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ CarpetX::blocking_factor_z = 1

CarpetX::ghost_size = 0

CarpetX::boundary_x = "dirichlet"
CarpetX::boundary_y = "dirichlet"
CarpetX::boundary_z = "dirichlet"
CarpetX::boundary_upper_x = "dirichlet"
CarpetX::boundary_upper_y = "dirichlet"
CarpetX::boundary_upper_z = "dirichlet"

CarpetX::dtfac = 1.0
Cactus::cctk_itlast = 1

Expand Down
7 changes: 7 additions & 0 deletions TestODESolvers2/test/test-ssprk3.par
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ CarpetX::blocking_factor_z = 1

CarpetX::ghost_size = 0

CarpetX::boundary_x = "dirichlet"
CarpetX::boundary_y = "dirichlet"
CarpetX::boundary_z = "dirichlet"
CarpetX::boundary_upper_x = "dirichlet"
CarpetX::boundary_upper_y = "dirichlet"
CarpetX::boundary_upper_z = "dirichlet"

CarpetX::dtfac = 1.0
Cactus::cctk_itlast = 1

Expand Down

0 comments on commit 6bc9ff5

Please sign in to comment.