Loading...
Searching...
No Matches
n_gwflow.c File Reference
`#include <grass/N_gwflow.h>`
Include dependency graph for n_gwflow.c:

Go to the source code of this file.

## Functions

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_data3d (N_gwflow_data3d *data)
| Release the memory of the groundwater flow data structure in three dimensions.
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_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.
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_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_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.

## 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

  cols | int
  rows | int
  river |
  drain |

Returns
  N_gwflow_data2d *

Definition at line 151 of file n_gwflow.c.

References N_alloc_array_2d(), NULL, and N_gwflow_data2d::phead.

## 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

  cols | int
  rows | int
  depths | int

Returns
  N_gwflow_data3d *

Definition at line 39 of file n_gwflow.c.

References N_alloc_array_2d(), N_alloc_array_3d(), NULL, and N_gwflow_data3d::phead.

## 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:

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

Parameters

  gwdata | N_gwflow_data2d *
  geom | N_geom_data *
  col | int
  row | int

Returns
  N_data_star *

Definition at line 476 of file n_gwflow.c.

References N_geom_data::dx, N_geom_data::dy, G_debug(), N_calc_arith_mean(), N_calc_harmonic_mean(), N_create_5star(), N_get_array_2d_d_value(), N_get_geom_data_area_of_cell(), and r.

Referenced by N_gwflow_2d_calc_water_budget().

## 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:

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

Parameters

  gwdata | N_gwflow_data3d *
  geom | N_geom_data *
  col | int
  row | int
  depth | int

Returns
  N_data_star *

Definition at line 267 of file n_gwflow.c.

References N_geom_data::depths, N_geom_data::dx, N_geom_data::dy, N_geom_data::dz, G_debug(), N_calc_harmonic_mean(), N_create_7star(), N_get_array_2d_d_value(), N_get_array_3d_d_value(), N_get_geom_data_area_of_cell(), and r.

Referenced by N_gwflow_3d_calc_water_budget().

## 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

  data | N_gwflow_data2d *

Returns
  void

Definition at line 202 of file n_gwflow.c.

References G_free(), N_free_array_2d(), and NULL.

## 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

  data | N_gwflow_data3d *

Returns
  void *

Definition at line 91 of file n_gwflow.c.

References G_free(), N_free_array_2d(), N_free_array_3d(), and NULL.

## 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

  data | N_gwflow_data2d *
  geom | N_geom_data *
  budget | N_array_2d

Returns
  void

Definition at line 659 of file n_gwflow.c.

References N_data_star::E, G_free(), G_message(), G_percent(), G_warning(), N_data_star::N, N_callback_gwflow_2d(), N_CELL_INACTIVE, N_get_array_2d_c_value(), N_get_array_2d_d_value(), N_put_array_2d_d_value(), N_data_star::S, N_data_star::W, and x.

## 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

  gwdata | N_gwflow_data3d *
  geom | N_geom_data *
  budget | N_array_3d

Returns
  void

Definition at line 373 of file n_gwflow.c.

References N_data_star::B, N_data_star::E, G_free(), G_message(), G_percent(), G_warning(), N_data_star::N, N_callback_gwflow_3d(), N_CELL_INACTIVE, N_get_array_3d_d_value(), N_put_array_3d_d_value(), N_data_star::S, N_data_star::T, N_data_star::W, and x.