aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Haas <roland.haas@physics.gatech.edu>2012-09-07 23:18:34 -0400
committerRoland Haas <roland.haas@physics.gatech.edu>2012-09-07 23:18:34 -0400
commit48dcc7f4a3c0d67d3c572af47167d64258ee27a4 (patch)
treef6e7d458e0f57540a84ce9a2950edec10f3da632
parentfcd89f6124a498e089648ba2d203f768fa6ca073 (diff)
Carpet: insert routines into Boundary group to capture boundary update
reads and writes
-rw-r--r--Carpet/Carpet/interface.ccl5
-rw-r--r--Carpet/Carpet/schedule.ccl17
-rw-r--r--Carpet/Carpet/src/Requirements.cc66
3 files changed, 88 insertions, 0 deletions
diff --git a/Carpet/Carpet/interface.ccl b/Carpet/Carpet/interface.ccl
index 8ae894985..12a9f1432 100644
--- a/Carpet/Carpet/interface.ccl
+++ b/Carpet/Carpet/interface.ccl
@@ -372,6 +372,11 @@ CCTK_INT FUNCTION IO_TruncateOutputFiles \
REQUIRES FUNCTION IO_TruncateOutputFiles
+CCTK_INT FUNCTION Boundary_SelectedGVs(CCTK_POINTER_TO_CONST IN GH, \
+ CCTK_INT IN array_size, CCTK_INT ARRAY OUT var_indicies, \
+ CCTK_INT ARRAY OUT faces, CCTK_INT ARRAY OUT boundary_widths, \
+ CCTK_INT ARRAY OUT table_handles, CCTK_STRING IN bc_name)
+USES FUNCTION Boundary_SelectedGVs
# TODO: make this somehow public, e.g. by moving it into its own thorn
diff --git a/Carpet/Carpet/schedule.ccl b/Carpet/Carpet/schedule.ccl
index b4f543e20..215bcde7a 100644
--- a/Carpet/Carpet/schedule.ccl
+++ b/Carpet/Carpet/schedule.ccl
@@ -46,3 +46,20 @@ if (use_unusedpoints_mask)
LANG: C
} "Set mask of unused points"
}
+
+# Handle requirements of boundary and symmtery condition. This uses knowledge
+# of the internal workings of thorn boundary.
+if (check_requirements)
+{
+ schedule CarpetCheckReadsBeforeBoundary IN ApplyBCs BEFORE BoundaryConditions
+ {
+ LANG: C
+ OPTIONS: singlemap # local would also work but we don't really need it
+ } "Check that interior of grid function is valid before boundary conditions are applied"
+
+ schedule CarpetNotifyWritesAfterBoundary IN ApplyBCs AFTER Boundary_ApplyPhysicalBCs BEFORE Boundary_ClearSelection
+ {
+ LANG: C
+ OPTIONS: singlemap # local would also work but we don't really need it
+ } "Notify that grid functions with boundary condtions are valid in boundary"
+}
diff --git a/Carpet/Carpet/src/Requirements.cc b/Carpet/Carpet/src/Requirements.cc
index 434943db0..4cf769e57 100644
--- a/Carpet/Carpet/src/Requirements.cc
+++ b/Carpet/Carpet/src/Requirements.cc
@@ -1374,6 +1374,72 @@ namespace Carpet {
os << old_vars << std::endl;
}
+ // scheduled routines to handle boundary and symmetry conditions
+ extern "C"
+ void CarpetCheckReadsBeforeBoundary(CCTK_ARGUMENTS)
+ {
+ DECLARE_CCTK_ARGUMENTS;
+ int num_vars, err;
+ vector<CCTK_INT> vars, faces, widths, tables;
+
+ num_vars = Boundary_SelectedGVs(cctkGH, 0, NULL, NULL, NULL, NULL, NULL);
+ if (num_vars < 0) {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Error retrieving number of selected GVs: %d", num_vars);
+ }
+ vars.resize(num_vars);
+ faces.resize(num_vars);
+ widths.resize(num_vars);
+ tables.resize(num_vars);
+
+ /* get selected vars for all bc */
+ err = Boundary_SelectedGVs(cctkGH, num_vars, &vars[0], &faces[0], &widths[0], &tables[0],
+ NULL);
+ if (err<0) {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Error in Boundary_SelectedGVs for all boundary conditions");
+ } else if (err != num_vars) {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Boundary_SelectedGVs returned %d selected variables for "
+ "all boundary conditions, but %d expected\n", err,
+ num_vars);
+ }
+
+ Requirements_CheckReads(cctkGH, num_vars, &vars[0], "interior");
+ }
+
+ extern "C"
+ void CarpetNotifyWritesAfterBoundary(CCTK_ARGUMENTS)
+ {
+ DECLARE_CCTK_ARGUMENTS;
+ int num_vars, err;
+ vector<CCTK_INT> vars, faces, widths, tables;
+
+ num_vars = Boundary_SelectedGVs(cctkGH, 0, NULL, NULL, NULL, NULL, NULL);
+ if (num_vars < 0) {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Error retrieving number of selected GVs: %d", num_vars);
+ }
+ vars.resize(num_vars);
+ faces.resize(num_vars);
+ widths.resize(num_vars);
+ tables.resize(num_vars);
+
+ /* get selected vars for all bc */
+ err = Boundary_SelectedGVs(cctkGH, num_vars, &vars[0], &faces[0], &widths[0], &tables[0],
+ NULL);
+ if (err<0) {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Error in Boundary_SelectedGVs for all boundary conditions");
+ } else if (err != num_vars) {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Boundary_SelectedGVs returned %d selected variables for "
+ "all boundary conditions, but %d expected\n", err,
+ num_vars);
+ }
+
+ Requirements_NotifyWrites(cctkGH, num_vars, &vars[0], "boundary;boundary_ghostzones");
+ }
template ostream& output (ostream& os, const vector<clause_t>& v);