GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-b4e4cb0fe9
N_gwflow.h File Reference
#include "N_pde.h"
#include <math.h>
Include dependency graph for N_gwflow.h:

Go to the source code of this file.

Data Structures

struct  N_gwflow_data3d
 This data structure contains all data needed to compute the groundwater mass balance in three dimension. More...
 
struct  N_gwflow_data2d
 This data structure contains all data needed to compute the groundwater mass balance in two dimension. More...
 

Macros

#define N_GW_CONFINED   0 /*confined groundwater */
 
#define N_GW_UNCONFINED   1 /*unconfined groundwater */
 
#define N_GW_DRY_CELL   0 /*a dry cell */
 
#define N_GW_SURFACE_CELL   1 /*a surface cell */
 
#define N_GW_NORMAL_CELL   2 /*a normal wet cell */
 

Functions

N_data_starN_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. More...
 
N_data_starN_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. More...
 
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. More...
 
void N_gwflow_2d_calc_water_budget (N_gwflow_data2d *data, N_geom_data *geom, N_array_2d *balance)
 This function computes the water budget of the entire groundwater. More...
 
N_gwflow_data3dN_alloc_gwflow_data3d (int cols, int rows, int depths, int river, int drain)
 Allocate memory for the groundwater calculation data structure in 3 dimensions. More...
 
N_gwflow_data2dN_alloc_gwflow_data2d (int cols, int rows, int river, int drain)
 Allocate memory for the groundwater calculation data structure in 2 dimensions. More...
 
void N_free_gwflow_data3d (N_gwflow_data3d *data)
 Release the memory of the groundwater flow data structure in three dimensions. More...
 
void N_free_gwflow_data2d (N_gwflow_data2d *data)
 Release the memory of the groundwater flow data structure in two dimensions. More...
 

Macro Definition Documentation

◆ N_GW_CONFINED

#define N_GW_CONFINED   0 /*confined groundwater */

Definition at line 23 of file N_gwflow.h.

◆ N_GW_DRY_CELL

#define N_GW_DRY_CELL   0 /*a dry cell */

Definition at line 26 of file N_gwflow.h.

◆ N_GW_NORMAL_CELL

#define N_GW_NORMAL_CELL   2 /*a normal wet cell */

Definition at line 28 of file N_gwflow.h.

◆ N_GW_SURFACE_CELL

#define N_GW_SURFACE_CELL   1 /*a surface cell */

Definition at line 27 of file N_gwflow.h.

◆ N_GW_UNCONFINED

#define N_GW_UNCONFINED   1 /*unconfined groundwater */

Definition at line 24 of file N_gwflow.h.

Function Documentation

◆ N_alloc_gwflow_data2d()

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.

The groundwater calculation data structure will be allocated including all appendant 2d arrays. The offset for the 3d arrays is one to establish homogeneous Neumann boundary conditions at the calculation area border. This data structure is used to create a linear equation system based on the computation of groundwater flow in porous media with the finite volume method.

Parameters
colsint
rowsint
Returns
N_gwflow_data2d *

Definition at line 149 of file n_gwflow.c.

◆ N_alloc_gwflow_data3d()

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.

The groundwater calculation data structure will be allocated including all appendant 3d and 2d arrays. The offset for the 3d arrays is one to establish homogeneous Neumann boundary conditions at the calculation area border. This data structure is used to create a linear equation system based on the computation of groundwater flow in porous media with the finite volume method.

Parameters
colsint
rowsint
depthsint
Returns
N_gwflow_data3d *

Definition at line 39 of file n_gwflow.c.

◆ N_callback_gwflow_2d()

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.

The mass balance is based on the common groundwater flow equation:

\[Ss \frac{\partial h}{\partial t} = \nabla {\bf K} \nabla h + q \]

This equation is discretizised with the finite volume method in two dimensions.

Parameters
gwdataN_gwflow_data2d *
geomN_geom_data *
colint
rowint
Returns
N_data_star *

Definition at line 474 of file n_gwflow.c.

References N, r, and W.

◆ N_callback_gwflow_3d()

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.

The mass balance is based on the common groundwater flow equation:

\[Ss \frac{\partial h}{\partial t} = \nabla {\bf K} \nabla h + q \]

This equation is discretizised with the finite volume method in three dimensions.

Parameters
gwdataN_gwflow_data3d *
geomN_geom_data *
colint
rowint
depthint
Returns
N_data_star *

Definition at line 265 of file n_gwflow.c.

◆ N_free_gwflow_data2d()

void N_free_gwflow_data2d ( N_gwflow_data2d data)

Release the memory of the groundwater flow data structure in two dimensions.

Parameters
dataN_gwflow_data2d *
Returns
void

Definition at line 200 of file n_gwflow.c.

◆ N_free_gwflow_data3d()

void N_free_gwflow_data3d ( N_gwflow_data3d data)

Release the memory of the groundwater flow data structure in three dimensions.

Parameters
dataN_gwflow_data3d *
Returns
void *

Definition at line 91 of file n_gwflow.c.

◆ N_gwflow_2d_calc_water_budget()

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.

The water budget is calculated for each active and dirichlet cell from its surrounding neighbours. This is based on the 5 star mass balance computation of N_callback_gwflow_2d and the gradient of the water heights in the cells. The sum of the water budget of each active/dirichlet cell must be near zero due the effect of numerical inaccuracy of cpu's.

Parameters
gwdataN_gwflow_data2d *
geomN_geom_data *
budgetN_array_2d
Returns
void

Definition at line 657 of file n_gwflow.c.

◆ N_gwflow_3d_calc_water_budget()

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.

The water budget is calculated for each active and dirichlet cell from its surrounding neighbours. This is based on the 7 star mass balance computation of N_callback_gwflow_3d and the gradient of the water heights in the cells. The sum of the water budget of each active/dirichlet cell must be near zero due the effect of numerical inaccuracy of cpu's.

Parameters
gwdataN_gwflow_data3d *
geomN_geom_data *
budgetN_array_3d
Returns
void

Definition at line 371 of file n_gwflow.c.