15#include <grass/N_gwflow.h>
268 double dx, dy, dz,
Ax,
Ay, Az;
269 double hc_x, hc_y, hc_z;
274 double C,
W, E,
N, S, T, B, V;
325 T = -1 * Az *
hc_t / dz;
327 B = -1 * Az *
hc_b / dz;
333 C = -1 * (
W + E +
N + S + T + B -
Ss / data->
dt * Az);
339 if (depth ==
geom->depths - 2) {
344 G_debug(5,
"N_callback_gwflow_3d: called [%i][%i][%i]", depth,
col, row);
385 for (z = 0; z < depths; z++) {
386 for (y = 0; y < rows; y++) {
388 for (
x = 0;
x < cols;
x++) {
443 if (
fabs(sum) < 0.0000000001)
444 G_message(
_(
"The total sum of the water budget: %g\n"), sum);
446 G_warning(
_(
"The total sum of the water budget is significantly larger "
487 double C,
W, E,
N, S, V;
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;
630 G_debug(5,
"N_callback_gwflow_2d: called [%i][%i]", row,
col);
670 for (y = 0; y < rows; y++) {
672 for (
x = 0;
x < cols;
x++) {
717 if (
fabs(sum) < 0.0000000001)
718 G_message(
_(
"The total sum of the water budget: %g\n"), sum);
720 G_warning(
_(
"The total sum of the water budget is significantly larger "
double N_calc_arith_mean(double a, double b)
Calculate the arithmetic mean of values a and b.
double N_calc_harmonic_mean(double a, double b)
Calculate the harmonical mean of values a and b.
void G_percent(long, long, int)
Print percent complete messages.
void G_free(void *)
Free allocated memory.
void G_warning(const char *,...) __attribute__((format(printf
void G_message(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
void Rast_set_null_value(void *, int, RASTER_MAP_TYPE)
To set one or more raster values to null.
N_array_3d * N_alloc_array_3d(int cols, int rows, int depths, int offset, int type)
Allocate memory for a N_array_3d data structure.
CELL N_get_array_2d_c_value(N_array_2d *data, int col, int row)
Returns the value of type CELL at position col, row.
void N_free_array_3d(N_array_3d *data)
Release the memory of a N_array_3d.
DCELL N_get_array_2d_d_value(N_array_2d *data, int col, int row)
Returns the value of type DCELL at position col, row.
void N_free_array_2d(N_array_2d *data)
Release the memory of a N_array_2d structure.
void N_put_array_3d_d_value(N_array_3d *data, int col, int row, int depth, double value)
Writes a double value to the N_array_3d struct at position col, row, depth.
N_array_2d * N_alloc_array_2d(int cols, int rows, int offset, int type)
Allocate memory for a N_array_2d data structure.
double N_get_array_3d_d_value(N_array_3d *data, int col, int row, int depth)
This function returns the value of type float at position col, row, depth.
void N_put_array_2d_d_value(N_array_2d *data, int col, int row, DCELL value)
Writes a DCELL value to the N_array_2d struct at position col, row.
double N_get_geom_data_area_of_cell(N_geom_data *geom, int row)
Get the areay size in square meter of one cell (x*y) at row.
N_data_star * N_callback_gwflow_2d(void *gwdata, N_geom_data *geom, int col, int row)
This callback function creates the mass balance of a 5 point star.
void N_gwflow_3d_calc_water_budget(N_gwflow_data3d *data, N_geom_data *geom, N_array_3d *budget)
This function computes the water budget of the entire groundwater.
N_gwflow_data2d * N_alloc_gwflow_data2d(int cols, int rows, int river, int drain)
Allocate memory for the groundwater calculation data structure in 2 dimensions.
void N_gwflow_2d_calc_water_budget(N_gwflow_data2d *data, N_geom_data *geom, N_array_2d *budget)
This function computes the water budget of the entire groundwater.
void N_free_gwflow_data3d(N_gwflow_data3d *data)
Release the memory of the groundwater flow data structure in three dimensions.
N_gwflow_data3d * N_alloc_gwflow_data3d(int cols, int rows, int depths, int river, int drain)
Allocate memory for the groundwater calculation data structure in 3 dimensions.
void N_free_gwflow_data2d(N_gwflow_data2d *data)
Release the memory of the groundwater flow data structure in two dimensions.
N_data_star * N_callback_gwflow_3d(void *gwdata, N_geom_data *geom, int col, int row, int depth)
This callback function creates the mass balance of a 7 point star.
N_data_star * N_create_5star(double C, double W, double E, double N, double S, double V)
allocate and initialize a 5 point star data structure
N_data_star * N_create_7star(double C, double W, double E, double N, double S, double T, double B, double V)
allocate and initialize a 7 point star data structure
Matrix entries for a mass balance 5/7/9 star system.
Geometric information about the structured grid.
This data structure contains all data needed to compute the groundwater mass balance in two dimension...
This data structure contains all data needed to compute the groundwater mass balance in three dimensi...