Skip to content

Commit

Permalink
TestSubcyclingMC: add flag isrmbndry to distingish refinement boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
lwJi committed Apr 16, 2024
1 parent e0fc16f commit 582a01c
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
6 changes: 6 additions & 0 deletions TestSubcyclingMC/interface.ccl
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,9 @@ CCTK_REAL error TYPE=gf TAGS='checkpoint="no"'
u_err
rho_err
} "Error in scalar wave state vector"



CCTK_REAL level_neighbor TYPE=gf TAGS='checkpoint="no"' "Level of its neighbor which will fill in this ghost point"

CCTK_REAL isrmbndry TYPE=gf TAGS='checkpoint="no"' "If this ghost point is at refinement boundary or not"
24 changes: 24 additions & 0 deletions TestSubcyclingMC/schedule.ccl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,30 @@ SCHEDULE TestSubcyclingMC_Sync AT postregrid
SYNC: ustate
} "Synchronize"


SCHEDULE GROUP TestSubcyclingMC_RMBndryGroup AT initial BEFORE TestSubcyclingMC_Initial
{
} "Check if the ghost points are at refinement boundary"

SCHEDULE GROUP TestSubcyclingMC_RMBndryGroup AT postregrid BEFORE TestSubcyclingMC_Sync
{
} "Check if the ghost points are at refinement boundary"

SCHEDULE TestSubcyclingMC_SetLevelNeighbor IN TestSubcyclingMC_RMBndryGroup
{
LANG: C
WRITES: level_neighbor(interior)
SYNC: level_neighbor
} "Set level_neighbor"

SCHEDULE TestSubcyclingMC_SetIsRMBndry IN TestSubcyclingMC_RMBndryGroup AFTER TestSubcyclingMC_SetLevelNeighbor
{
LANG: C
READS: level_neighbor(everywhere)
WRITES: isrmbndry(everywhere)
} "Set isrmbndry"


SCHEDULE GROUP TestSubcyclingMC_RK4Group AT evol
{
} "RK4"
Expand Down
22 changes: 22 additions & 0 deletions TestSubcyclingMC/src/testsubcyclingmc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,28 @@ extern "C" void TestSubcyclingMC_Sync(CCTK_ARGUMENTS) {
// do nothing
}

extern "C" void TestSubcyclingMC_SetLevelNeighbor(CCTK_ARGUMENTS) {
DECLARE_CCTK_ARGUMENTSX_TestSubcyclingMC_SetLevelNeighbor;
grid.loop_int_device<0, 0, 0>(
grid.nghostzones,
[=] CCTK_DEVICE(const Loop::PointDesc &p)
CCTK_ATTRIBUTE_ALWAYS_INLINE { level_neighbor(p.I) = cctk_level; });
}

extern "C" void TestSubcyclingMC_SetIsRMBndry(CCTK_ARGUMENTS) {
DECLARE_CCTK_ARGUMENTSX_TestSubcyclingMC_SetIsRMBndry;
grid.loop_all_device<0, 0, 0>(
grid.nghostzones,
[=] CCTK_DEVICE(const Loop::PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
isrmbndry(p.I) = 0;
});
grid.loop_ghosts_device<0, 0, 0>(
grid.nghostzones,
[=] CCTK_DEVICE(const Loop::PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
isrmbndry(p.I) = (level_neighbor(p.I) == cctk_level) ? 0 : 1;
});
}

extern "C" void TestSubcyclingMC_Error(CCTK_ARGUMENTS) {
DECLARE_CCTK_ARGUMENTSX_TestSubcyclingMC_Error;
DECLARE_CCTK_PARAMETERS;
Expand Down

0 comments on commit 582a01c

Please sign in to comment.