GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71933
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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)
 Alllocate memory for the solute transport data structure in three dimensions. More...
 
N_solute_transport_data2dN_alloc_solute_transport_data2d (int cols, int rows)
 Alllocate 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_solute_transport_data2d* N_alloc_solute_transport_data2d ( int  cols,
int  rows 
)

Alllocate 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 457 of file n_solute_transport.c.

References N_solute_transport_data2d::bottom, N_solute_transport_data2d::c, N_solute_transport_data2d::c_start, N_solute_transport_data2d::cin, N_solute_transport_data2d::cs, DCELL_TYPE, N_solute_transport_data2d::diff_x, N_solute_transport_data2d::diff_y, N_solute_transport_data2d::disp_xx, N_solute_transport_data2d::disp_xy, N_solute_transport_data2d::disp_yy, N_solute_transport_data2d::grad, N_alloc_array_2d(), N_alloc_gradient_field_2d(), N_UPWIND_EXP, N_solute_transport_data2d::nf, NULL, N_solute_transport_data2d::q, N_solute_transport_data2d::R, N_solute_transport_data2d::stab, N_solute_transport_data2d::status, and N_solute_transport_data2d::top.

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

Alllocate 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 402 of file n_solute_transport.c.

References N_solute_transport_data3d::c, N_solute_transport_data3d::c_start, N_solute_transport_data3d::cin, N_solute_transport_data3d::cs, DCELL_TYPE, N_solute_transport_data3d::diff_x, N_solute_transport_data3d::diff_y, N_solute_transport_data3d::diff_z, N_solute_transport_data3d::disp_xx, N_solute_transport_data3d::disp_xy, N_solute_transport_data3d::disp_xz, N_solute_transport_data3d::disp_yy, N_solute_transport_data3d::disp_yz, N_solute_transport_data3d::disp_zz, N_solute_transport_data3d::grad, N_alloc_array_3d(), N_alloc_gradient_field_3d(), N_UPWIND_EXP, N_solute_transport_data3d::nf, NULL, N_solute_transport_data3d::q, N_solute_transport_data3d::R, N_solute_transport_data3d::stab, and N_solute_transport_data3d::status.

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 lentghs 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 mor realistic algorithm
Parameters
dataN_solute_transport_data2d *
Returns
void *

Definition at line 651 of file n_solute_transport.c.

References N_solute_transport_data2d::al, N_solute_transport_data2d::at, N_gradient_field_2d::cols, N_solute_transport_data2d::disp_xx, N_solute_transport_data2d::disp_xy, N_solute_transport_data2d::disp_yy, N_gradient_2d::EC, G_debug(), N_solute_transport_data2d::grad, N_get_gradient_2d(), N_put_array_2d_d_value(), N_gradient_2d::NC, N_gradient_field_2d::rows, N_gradient_2d::SC, and N_gradient_2d::WC.

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 lentghs 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 mor realistic algorithm
Parameters
dataN_solute_transport_data3d *
Returns
void *

Definition at line 710 of file n_solute_transport.c.

References N_solute_transport_data3d::al, N_solute_transport_data3d::at, N_gradient_3d::BC, N_gradient_field_3d::cols, N_gradient_field_3d::depths, N_solute_transport_data3d::disp_xx, N_solute_transport_data3d::disp_xy, N_solute_transport_data3d::disp_xz, N_solute_transport_data3d::disp_yy, N_solute_transport_data3d::disp_yz, N_solute_transport_data3d::disp_zz, N_gradient_3d::EC, G_debug(), N_solute_transport_data3d::grad, N_get_gradient_3d(), N_put_array_3d_d_value(), N_gradient_3d::NC, N_gradient_field_3d::rows, N_gradient_3d::SC, N_gradient_3d::TC, and N_gradient_3d::WC.

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 578 of file n_solute_transport.c.

References N_solute_transport_data2d::c, N_solute_transport_data2d::c_start, N_gradient_field_2d::cols, count, N_gradient_2d::EC, G_debug(), N_solute_transport_data2d::grad, N_CELL_TRANSMISSION, N_get_array_2d_d_value(), N_get_gradient_2d(), N_is_array_2d_value_null(), N_put_array_2d_d_value(), N_gradient_2d::NC, N_gradient_field_2d::rows, N_gradient_2d::SC, N_solute_transport_data2d::status, and N_gradient_2d::WC.

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