GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-847944e18e
n_solute_transport.c File Reference
#include <math.h>
#include <grass/N_solute_transport.h>
Include dependency graph for n_solute_transport.c:

Go to the source code of this file.

Functions

N_data_starN_callback_solute_transport_3d (void *solutedata, N_geom_data *geom, int col, int row, int depth)
 This is just a placeholder. More...
 
N_data_starN_callback_solute_transport_2d (void *solutedata, N_geom_data *geom, int col, int row)
 This callback function creates the mass balance of a 5 point star. More...
 
N_solute_transport_data3dN_alloc_solute_transport_data3d (int cols, int rows, int depths)
 Allocate memory for the solute transport data structure in three dimensions. More...
 
N_solute_transport_data2dN_alloc_solute_transport_data2d (int cols, int rows)
 Allocate memory for the solute transport data structure in two dimensions. More...
 
void N_free_solute_transport_data3d (N_solute_transport_data3d *data)
 Release the memory of the solute transport data structure in three dimensions. More...
 
void N_free_solute_transport_data2d (N_solute_transport_data2d *data)
 Release the memory of the solute transport data structure in two dimensions. More...
 
void N_calc_solute_transport_transmission_2d (N_solute_transport_data2d *data)
 Compute the transmission boundary condition in 2d. More...
 
void N_calc_solute_transport_disptensor_2d (N_solute_transport_data2d *data)
 Compute the dispersivity tensor based on the solute transport data in 2d. More...
 
void N_calc_solute_transport_disptensor_3d (N_solute_transport_data3d *data)
 Compute the dispersivity tensor based on the solute transport data in 3d. More...
 

Function Documentation

◆ N_alloc_solute_transport_data2d()

N_solute_transport_data2d* N_alloc_solute_transport_data2d ( int  cols,
int  rows 
)

Allocate memory for the solute transport data structure in two dimensions.

The solute transport data structure will be allocated including all appendant 2d arrays. The offset for the 2d 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 solute transport in porous media with the finite volume method.

Parameters
colsint
rowsint
Returns
N_solute_transport_data2d *

Definition at line 442 of file n_solute_transport.c.

◆ N_alloc_solute_transport_data3d()

N_solute_transport_data3d* N_alloc_solute_transport_data3d ( int  cols,
int  rows,
int  depths 
)

Allocate memory for the solute transport data structure in three dimensions.

The solute transport data structure will be allocated including all appendant 3d 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 solute transport in porous media with the finite volume method.

Parameters
colsint
rowsint
depthsint
Returns
N_solute_transport_data3d *

Definition at line 389 of file n_solute_transport.c.

◆ N_calc_solute_transport_disptensor_2d()

void N_calc_solute_transport_disptensor_2d ( N_solute_transport_data2d data)

Compute the dispersivity tensor based on the solute transport data in 2d.

The dispersivity tensor is stored in the data structure. To compute the dispersivity tensor, the dispersivity lengths and the gradient field must be present.

This is just a simple tensor computation which should be extended.

Todo:
Change the tensor calculation to a more realistic algorithm
Parameters
dataN_solute_transport_data2d *
Returns
void *

Definition at line 637 of file n_solute_transport.c.

◆ N_calc_solute_transport_disptensor_3d()

void N_calc_solute_transport_disptensor_3d ( N_solute_transport_data3d data)

Compute the dispersivity tensor based on the solute transport data in 3d.

The dispersivity tensor is stored in the data structure. To compute the dispersivity tensor, the dispersivity lengths and the gradient field must be present.

This is just a simple tensor computation which should be extended.

Todo:
Change the tensor calculation to a more realistic algorithm
Parameters
dataN_solute_transport_data3d *
Returns
void *

Definition at line 698 of file n_solute_transport.c.

◆ N_calc_solute_transport_transmission_2d()

void N_calc_solute_transport_transmission_2d ( N_solute_transport_data2d data)

Compute the transmission boundary condition in 2d.

This function calculates the transmission boundary condition for each cell with status N_CELL_TRANSMISSION. The surrounding gradient field is used to verfiy the flow direction. If a flow goes into a cell, the concentration (data->c) from the neighbour cell is added to the transmission cell. If the flow from several neighbour cells goes into the cell, the concentration mean is calculated.

The new concentrations are written into the data->c_start array, so they can be handled by the matrix assembling function.

Parameters
dataN_solute_transport_data2d *
Returns
void *

Definition at line 563 of file n_solute_transport.c.

◆ N_callback_solute_transport_2d()

N_data_star* N_callback_solute_transport_2d ( void *  solutedata,
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 solute transport equation:

\[\frac{\partial c_g}{\partial t} R = \nabla \cdot ({\bf D} \nabla c_g - {\bf u} c_g) + \sigma + \frac{q}{n_f}(c_g - c_in) \]

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

Parameters
solutedata* N_solute_transport_data2d - a void pointer to the data structure
geomN_geom_data *
colint
rowint
Returns
N_data_star * - a five point data star

Definition at line 180 of file n_solute_transport.c.

References N, NE, NW, SE, SW, and W.

◆ N_callback_solute_transport_3d()

N_data_star* N_callback_solute_transport_3d ( void *  solutedata,
N_geom_data geom,
int  col,
int  row,
int  depth 
)

This is just a placeholder.

Definition at line 27 of file n_solute_transport.c.

◆ N_free_solute_transport_data2d()

void N_free_solute_transport_data2d ( N_solute_transport_data2d data)

Release the memory of the solute transport data structure in two dimensions.

Parameters
dataN_solute_transport_data2d *
Returns
void *

Definition at line 521 of file n_solute_transport.c.

◆ N_free_solute_transport_data3d()

void N_free_solute_transport_data3d ( N_solute_transport_data3d data)

Release the memory of the solute transport data structure in three dimensions.

Parameters
dataN_solute_transport_data2d *
Returns
void *

Definition at line 483 of file n_solute_transport.c.