19 #include <grass/N_gwflow.h>
266 double hc_e = 0, hc_w = 0, hc_n = 0, hc_s = 0, hc_t = 0, hc_b = 0;
267 double dx, dy, dz, Ax, Ay, Az;
268 double hc_x, hc_y, hc_z;
269 double hc_xw, hc_yn, hc_zt;
270 double hc_xe, hc_ys, hc_zb;
273 double C, W, E, N, S, T, B, V;
284 Ay = geom->
dx * geom->
dz;
285 Ax = geom->
dz * geom->
dy;
316 W = -1 * Ax * hc_w / dx;
318 E = -1 * Ax * hc_e / dx;
320 N = -1 * Ay * hc_n / dy;
322 S = -1 * Ay * hc_s / dy;
324 T = -1 * Az * hc_t / dz;
326 B = -1 * Az * hc_b / dz;
332 C = -1 * (W + E + N + S + T + B - Ss / data->
dt * Az);
335 V = (q + hc_start * Ss / data->
dt * Az);
338 if (depth == geom->
depths - 2) {
343 G_debug(5,
"N_callback_gwflow_3d: called [%i][%i][%i]", depth, col, row);
384 for (z = 0; z < depths; z++) {
385 for (y = 0; y < rows; y++) {
387 for (
x = 0;
x < cols;
x++) {
401 val += dstar->
E * (hc - h);
405 val += dstar->
W * (hc - h);
409 val += dstar->
S * (hc - h);
413 val += dstar->
N * (hc - h);
417 val += dstar->
T * (hc - h);
421 val += dstar->
B * (hc - h);
428 Rast_set_null_value(&val, 1, DCELL_TYPE);
435 if(fabs(sum) < 0.0000000001)
436 G_message(_(
"The total sum of the water budget: %g\n"), sum);
438 G_warning(_(
"The total sum of the water budget is significantly larger then 0: %g\n"), sum);
467 double T_e = 0, T_w = 0, T_n = 0, T_s = 0;
468 double z_e = 0, z_w = 0, z_n = 0, z_s = 0;
478 double C, W, E, N, S, V;
481 double river_vect = 0;
482 double river_mat = 0;
483 double drain_vect = 0;
484 double drain_mat = 0;
545 if (z_w > 0 || z_w < 0 || z_w == 0)
549 if (z_e > 0 || z_e < 0 || z_e == 0)
553 if (z_n > 0 || z_n < 0 || z_n == 0)
557 if (z_s > 0 || z_s < 0 || z_s == 0)
614 W = -1 * T_w * dy / dx;
616 E = -1 * T_e * dy / dx;
618 N = -1 * T_n * dx / dy;
620 S = -1 * T_s * dx / dy;
623 C = -1 * (W + E + N + S - Az *Ss / data->
dt - river_mat * Az -
627 V = (q + hc_start * Az * Ss / data->
dt) +
r + river_vect * Az +
630 G_debug(5,
"N_callback_gwflow_2d: called [%i][%i]", row, col);
672 for (y = 0; y < rows; y++) {
674 for (
x = 0;
x < cols;
x++) {
688 val += dstar->
E * (hc - h);
692 val += dstar->
W * (hc - h);
696 val += dstar->
S * (hc - h);
700 val += dstar->
N * (hc - h);
708 Rast_set_null_value(&val, 1, DCELL_TYPE);
714 if(fabs(sum) < 0.0000000001)
715 G_message(_(
"The total sum of the water budget: %g\n"), sum);
717 G_warning(_(
"The total sum of the water budget is significantly larger then 0: %g\n"), sum);