diff options
author | Anton Khirnov <anton@khirnov.net> | 2019-08-13 16:09:38 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2019-08-13 16:09:38 +0200 |
commit | d9cf5af0b60265ef672cf41b12277e04b3d637e6 (patch) | |
tree | 23fcf205c1b78ea9e68ce5f7f15bd5c81968b544 | |
parent | 0d7e22cdf73067739cb27a60f8699e487351f71c (diff) |
Make the solver boundary position configurable.
-rw-r--r-- | param.ccl | 6 | ||||
-rw-r--r-- | src/qms.c | 8 |
2 files changed, 11 insertions, 3 deletions
@@ -59,6 +59,12 @@ CCTK_INT exact_size "" STEERABLE=always } 5 RESTRICTED: +CCTK_INT boundary_offset "number of points the elliptic solve boundary is offset from the level interior boundary to the outside (positive) or inside (negative)" STEERABLE=always +{ + : :: "" +} 2 + +RESTRICTED: CCTK_REAL tol_residual_base "maximum absolute value of the residual for dx=1.0, scaled by 1/(dx ** 2)" STEERABLE=always { 0: :: "" @@ -52,6 +52,7 @@ typedef struct QMSMGContext { double tol_residual_base; double cfl_factor; int solve_level; + int boundary_offset; CoordPatch *patches; int nb_patches; @@ -156,7 +157,7 @@ static CoordPatch *get_coord_patch(QMSMGContext *ms, int level) offset_right = gh->cctk_nghostzones[2 * dir]; if (cp->level > 0) { offset_right *= integrator_substeps * 2; - offset_right -= 2; + offset_right -= ms->boundary_offset; } solver_size[dir] = cp->grid_size[2 * dir] - cp->offset_left[dir] - offset_right; @@ -1032,7 +1033,7 @@ void qms_mg_eval(CCTK_ARGUMENTS) static int context_init(cGH *gh, int solve_level, int fd_stencil, int maxiter, int exact_size, int nb_cycles, int nb_relax_pre, int nb_relax_post, double tol_residual_base, - double cfl_factor, const char *loglevel_str, + double cfl_factor, const char *loglevel_str, int boundary_offset, QMSMGContext **ctx) { QMSMGContext *qms; @@ -1054,6 +1055,7 @@ static int context_init(cGH *gh, int solve_level, int fd_stencil, int maxiter, i qms->nb_relax_post = nb_relax_post; qms->tol_residual_base = tol_residual_base; qms->cfl_factor = cfl_factor; + qms->boundary_offset = boundary_offset; for (int i = 0; i < ARRAY_ELEMS(log_levels); i++) { if (!strcmp(loglevel_str, log_levels[i].str)) { @@ -1088,7 +1090,7 @@ void qms_mg_init(CCTK_ARGUMENTS) if (!qms_context) { ret = context_init(cctkGH, solve_level, fd_stencil, maxiter, exact_size, nb_cycles, nb_relax_pre, nb_relax_post, tol_residual_base, - cfl_factor, loglevel, &qms_context); + cfl_factor, loglevel, boundary_offset, &qms_context); if (ret < 0) CCTK_WARN(0, "Error initializing the solver context"); } |