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

Go to the source code of this file.

## Functions

N_data_star * | N_alloc_5star (void)
| allocate a 5 point star data structure
N_data_star * | N_alloc_7star (void)
| allocate a 7 point star data structure
N_data_star * | N_alloc_9star (void)
| allocate a 9 point star data structure
N_data_star * | N_alloc_27star (void)
| allocate a 27 point star data structure
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
N_data_star * | N_create_9star (double C, double W, double E, double N, double S, double NW, double SW, double NE, double SE, double V)
| allocate and initialize a 9 point star data structure
N_data_star * | N_create_27star (double C, double W, double E, double N, double S, double NW, double SW, double NE, double SE, double T, double W_T, double E_T, double N_T, double S_T, double NW_T, double SW_T, double NE_T, double SE_T, double B, double W_B, double E_B, double N_B, double S_B, double NW_B, double SW_B, double NE_B, double SE_B, double V)
| allocate and initialize a 27 point star data structure
void | N_set_les_callback_3d_func (N_les_callback_3d *data, N_data_star *(*callback_func_3d)(void *, N_geom_data *, int, int, int))
| Set the callback function which is called while assembling the les in 3d.
void | N_set_les_callback_2d_func (N_les_callback_2d *data, N_data_star *(*callback_func_2d)(void *, N_geom_data *, int, int))
| Set the callback function which is called while assembling the les in 2d.
N_les_callback_3d * | N_alloc_les_callback_3d (void)
| Allocate the structure holding the callback function.
N_les_callback_2d * | N_alloc_les_callback_2d (void)
| Allocate the structure holding the callback function.
N_data_star * | N_callback_template_3d (void *data, N_geom_data *geom, int col, int row, int depth)
| A callback template creates a 7 point star structure.
N_data_star * | N_callback_template_2d (void *data, N_geom_data *geom, int col, int row)
| A callback template creates a 9 point star structure.
N_les * | N_assemble_les_2d (int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *call)
| Assemble a linear equation system (les) based on 2d location data (raster) and active cells.
N_les * | N_assemble_les_2d_active (int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *call)
| Assemble a linear equation system (les) based on 2d location data (raster) and active cells.
N_les * | N_assemble_les_2d_dirichlet (int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *call)
| Assemble a linear equation system (les) based on 2d location data (raster) and active and dirichlet cells.
N_les * | N_assemble_les_2d_param (int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *call, int cell_type)
| Assemble a linear equation system (les) based on 2d location data (raster).
int | N_les_integrate_dirichlet_2d (N_les *les, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val)
| Integrate Dirichlet or Transmission boundary conditions into the les (2s).
N_les * | N_assemble_les_3d (int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *call)
| Assemble a linear equation system (les) based on 3d location data (g3d) active cells.
N_les * | N_assemble_les_3d_active (int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *call)
| Assemble a linear equation system (les) based on 3d location data (g3d) active cells.
N_les * | N_assemble_les_3d_dirichlet (int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *call)
| Assemble a linear equation system (les) based on 3d location data (g3d) active and dirichlet cells.
N_les * | N_assemble_les_3d_param (int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *call, int cell_type)
| Assemble a linear equation system (les) based on 3d location data (g3d).
int | N_les_integrate_dirichlet_3d (N_les *les, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val)
| Integrate Dirichlet or Transmission boundary conditions into the les (3d).

## Function Documentation

## N_alloc_27star()

N_data_star * N_alloc_27star | ( | void |  | ) |

allocate a 27 point star data structure

Returns
  N_data_star *

Attention
  The 27 point start is not yet implemented in the matrix assembling function

Definition at line 101 of file n_les_assemble.c.

References N_data_star::count, N_27_POINT_STAR, and N_data_star::type.

Referenced by N_create_27star().

## N_alloc_5star()

N_data_star * N_alloc_5star | ( | void |  | ) |

allocate a 5 point star data structure

Returns
  N_data_star *

Definition at line 42 of file n_les_assemble.c.

References N_data_star::count, N_5_POINT_STAR, and N_data_star::type.

Referenced by N_create_5star().

## N_alloc_7star()

N_data_star * N_alloc_7star | ( | void |  | ) |

allocate a 7 point star data structure

Returns
  N_data_star *

Definition at line 59 of file n_les_assemble.c.

References N_data_star::count, N_7_POINT_STAR, and N_data_star::type.

Referenced by N_callback_template_3d(), and N_create_7star().

## N_alloc_9star()

N_data_star * N_alloc_9star | ( | void |  | ) |

allocate a 9 point star data structure

Returns
  N_data_star *

Attention
  The 9 point start is not yet implemented in the matrix assembling function

Definition at line 80 of file n_les_assemble.c.

References N_data_star::count, N_9_POINT_STAR, and N_data_star::type.

Referenced by N_callback_template_2d(), and N_create_9star().

## N_alloc_les_callback_2d()

N_les_callback_2d * N_alloc_les_callback_2d | ( | void |  | ) |

Allocate the structure holding the callback function.

A template callback is set. Use N_set_les_callback_2d_func to set up a specific function.

Returns
  N_les_callback_2d *

Definition at line 400 of file n_les_assemble.c.

References N_les_callback_2d::callback, and N_callback_template_2d().

## N_alloc_les_callback_3d()

N_les_callback_3d * N_alloc_les_callback_3d | ( | void |  | ) |

Allocate the structure holding the callback function.

A template callback is set. Use N_set_les_callback_3d_func to set up a specific function.

Returns
  N_les_callback_3d *

Definition at line 379 of file n_les_assemble.c.

References N_les_callback_3d::callback, and N_callback_template_3d().

## N_assemble_les_2d()

N_les * N_assemble_les_2d | ( | int | les_type,
|  | N_geom_data * | geom,
|  | N_array_2d * | status,
|  | N_array_2d * | start_val,
|  | void * | data,
|  | N_les_callback_2d * | call )

Assemble a linear equation system (les) based on 2d location data (raster) and active cells.

This function calls N_assemble_les_2d_param

Definition at line 495 of file n_les_assemble.c.

References N_assemble_les_2d_param(), and N_CELL_ACTIVE.

## N_assemble_les_2d_active()

N_les * N_assemble_les_2d_active | ( | int | les_type,
|  | N_geom_data * | geom,
|  | N_array_2d * | status,
|  | N_array_2d * | start_val,
|  | void * | data,
|  | N_les_callback_2d * | call )

Assemble a linear equation system (les) based on 2d location data (raster) and active cells.

This function calls N_assemble_les_2d_param

Definition at line 510 of file n_les_assemble.c.

References N_assemble_les_2d_param(), and N_CELL_ACTIVE.

## N_assemble_les_2d_dirichlet()

N_les * N_assemble_les_2d_dirichlet | ( | int | les_type,
|  | N_geom_data * | geom,
|  | N_array_2d * | status,
|  | N_array_2d * | start_val,
|  | void * | data,
|  | N_les_callback_2d * | call )

Assemble a linear equation system (les) based on 2d location data (raster) and active and dirichlet cells.

This function calls N_assemble_les_2d_param

Definition at line 525 of file n_les_assemble.c.

References N_assemble_les_2d_param(), and N_CELL_DIRICHLET.

## N_assemble_les_2d_param()

N_les * N_assemble_les_2d_param | ( | int | les_type,
|  | N_geom_data * | geom,
|  | N_array_2d * | status,
|  | N_array_2d * | start_val,
|  | void * | data,
|  | N_les_callback_2d * | call,
|  | int | cell_type )

Assemble a linear equation system (les) based on 2d location data (raster).

The linear equation system type can be set to N_NORMAL_LES to create a regular matrix, or to N_SPARSE_LES to create a sparse matrix. This function returns a new created linear equation system which can be solved with linear equation solvers. An 2d array with start values and an 2d status array must be provided as well as the location geometry and a void pointer to data passed to the callback which creates the les row entries. This callback must be defined in the N_les_callback_2d structure.

The creation of the les is parallelized with OpenMP. If you implement new callbacks, please make sure that the function calls are thread safe.

the les can be created in two ways, with dirichlet and similar cells and without them, to spare some memory. If the les is created with dirichlet cell, the dirichlet boundary condition must be added.

Parameters

  les_type | int
  geom | N_geom_data*
  status | N_array_2d *
  start_val | N_array_2d *
  data | void *
  cell_type | int – les assemble based on N_CELL_ACTIVE or N_CELL_DIRICHLET
  call | N_les_callback_2d *

Returns
  N_les *

Definition at line 563 of file n_les_assemble.c.

References N_les::A, N_les::Asp, N_les::b, N_data_star::C, N_les_callback_2d::callback, N_geom_data::cols, count, N_data_star::count, N_data_star::E, G_debug(), G_fatal_error(), G_free(), G_math_add_spvector(), G_math_alloc_spvector(), N_data_star::N, N_9_POINT_STAR, N_alloc_array_2d(), N_alloc_les_Ax_b(), N_CELL_ACTIVE, N_CELL_DIRICHLET, N_CELL_INACTIVE, N_free_array_2d(), N_get_array_2d_c_value(), N_get_array_2d_d_value(), N_MAX_CELL_STATE, N_put_array_2d_c_value(), N_SPARSE_LES, N_data_star::NE, NULL, N_data_star::NW, N_geom_data::rows, N_data_star::S, N_data_star::SE, N_data_star::SW, N_data_star::type, N_les::type, N_data_star::V, N_data_star::W, and N_les::x.

Referenced by N_assemble_les_2d(), N_assemble_les_2d_active(), and N_assemble_les_2d_dirichlet().

## N_assemble_les_3d()

N_les * N_assemble_les_3d | ( | int | les_type,
|  | N_geom_data * | geom,
|  | N_array_3d * | status,
|  | N_array_3d * | start_val,
|  | void * | data,
|  | N_les_callback_3d * | call )

Assemble a linear equation system (les) based on 3d location data (g3d) active cells.

This function calls N_assemble_les_3d_param

Definition at line 958 of file n_les_assemble.c.

References N_assemble_les_3d_param(), and N_CELL_ACTIVE.

## N_assemble_les_3d_active()

N_les * N_assemble_les_3d_active | ( | int | les_type,
|  | N_geom_data * | geom,
|  | N_array_3d * | status,
|  | N_array_3d * | start_val,
|  | void * | data,
|  | N_les_callback_3d * | call )

Assemble a linear equation system (les) based on 3d location data (g3d) active cells.

This function calls N_assemble_les_3d_param

Definition at line 972 of file n_les_assemble.c.

References N_assemble_les_3d_param(), and N_CELL_ACTIVE.

## N_assemble_les_3d_dirichlet()

N_les * N_assemble_les_3d_dirichlet | ( | int | les_type,
|  | N_geom_data * | geom,
|  | N_array_3d * | status,
|  | N_array_3d * | start_val,
|  | void * | data,
|  | N_les_callback_3d * | call )

Assemble a linear equation system (les) based on 3d location data (g3d) active and dirichlet cells.

This function calls N_assemble_les_3d_param

Definition at line 986 of file n_les_assemble.c.

References N_assemble_les_3d_param(), and N_CELL_DIRICHLET.

## N_assemble_les_3d_param()

N_les * N_assemble_les_3d_param | ( | int | les_type,
|  | N_geom_data * | geom,
|  | N_array_3d * | status,
|  | N_array_3d * | start_val,
|  | void * | data,
|  | N_les_callback_3d * | call,
|  | int | cell_type )

Assemble a linear equation system (les) based on 3d location data (g3d).

The linear equation system type can be set to N_NORMAL_LES to create a regular matrix, or to N_SPARSE_LES to create a sparse matrix. This function returns a new created linear equation system which can be solved with linear equation solvers. An 3d array with start values and an 3d status array must be provided as well as the location geometry and a void pointer to data passed to the callback which creates the les row entries. This callback must be defined in the N_les_callback_3d structure.

The creation of the les is parallelized with OpenMP. If you implement new callbacks, please make sure that the function calls are thread safe.

the les can be created in two ways, with dirichlet and similar cells and without them, to spare some memory. If the les is created with dirichlet cell, the dirichlet boundary condition must be added.

Parameters

  les_type | int
  geom | N_geom_data*
  status | N_array_3d *
  start_val | N_array_3d *
  data | void *
  call | N_les_callback_3d *
  cell_type | int – les assemble based on N_CELL_ACTIVE or N_CELL_DIRICHLET

Returns
  N_les *

Definition at line 1023 of file n_les_assemble.c.

References N_les::A, N_les::Asp, N_data_star::B, N_les::b, N_data_star::C, N_les_callback_3d::callback, N_geom_data::cols, count, N_data_star::count, N_geom_data::depths, N_data_star::E, G_debug(), G_fatal_error(), G_free(), G_math_add_spvector(), G_math_alloc_spvector(), N_data_star::N, N_27_POINT_STAR, N_7_POINT_STAR, N_alloc_array_3d(), N_alloc_les_Ax_b(), N_CELL_ACTIVE, N_CELL_DIRICHLET, N_CELL_INACTIVE, N_free_array_3d(), N_get_array_3d_d_value(), N_MAX_CELL_STATE, N_put_array_3d_d_value(), N_SPARSE_LES, NULL, N_geom_data::rows, N_data_star::S, N_data_star::T, N_data_star::type, N_les::type, N_data_star::V, N_data_star::W, and N_les::x.

Referenced by N_assemble_les_3d(), N_assemble_les_3d_active(), and N_assemble_les_3d_dirichlet().

## N_callback_template_2d()

N_data_star * N_callback_template_2d | ( | void * | data,
|  | N_geom_data * | geom,
|  | int | col,
|  | int | row )

A callback template creates a 9 point star structure.

This is a template callback for mass balance calculation with 9 point stars based on 2d data (raster).

Parameters

  data | void * (unused)
  geom | N_geom_data *
  col | int (unused)
  row | int (unused)

Returns
  N_data_star *

Definition at line 465 of file n_les_assemble.c.

References N_data_star::C, N_geom_data::dx, N_geom_data::dy, N_data_star::E, N_data_star::N, N_alloc_9star(), N_data_star::NE, N_data_star::NW, N_data_star::S, N_data_star::SE, N_data_star::SW, N_data_star::V, and N_data_star::W.

Referenced by N_alloc_les_callback_2d().

## N_callback_template_3d()

N_data_star * N_callback_template_3d | ( | void * | data,
|  | N_geom_data * | geom,
|  | int | col,
|  | int | row,
|  | int | depth )

A callback template creates a 7 point star structure.

This is a template callback for mass balance calculation with 7 point stars based on 3d data (g3d).

Parameters

  data | void * (unused)
  geom | N_geom_data *
  depth | int (unused)
  row | int (unused)
  col | int (unused)

Returns
  N_data_star *

Definition at line 427 of file n_les_assemble.c.

References N_data_star::B, N_data_star::C, N_geom_data::dx, N_geom_data::dy, N_geom_data::dz, N_data_star::E, G_debug(), N_data_star::N, N_alloc_7star(), N_data_star::S, N_data_star::T, N_data_star::V, and N_data_star::W.

Referenced by N_alloc_les_callback_3d().

## N_create_27star()

N_data_star * N_create_27star | ( | double | C,
|  | double | W,
|  | double | E,
|  | double | N,
|  | double | S,
|  | double | NW,
|  | double | SW,
|  | double | NE,
|  | double | SE,
|  | double | T,
|  | double | W_T,
|  | double | E_T,
|  | double | N_T,
|  | double | S_T,
|  | double | NW_T,
|  | double | SW_T,
|  | double | NE_T,
|  | double | SE_T,
|  | double | B,
|  | double | W_B,
|  | double | E_B,
|  | double | N_B,
|  | double | S_B,
|  | double | NW_B,
|  | double | SW_B,
|  | double | NE_B,
|  | double | SE_B,
|  | double | V )

allocate and initialize a 27 point star data structure

Parameters

  C | double
  W | double
  E | double
  N | double
  S | double
  NW | double
  SW | double
  NE | double
  SE | double
  T | double
  W_T | double
  E_T | double
  N_T | double
  S_T | double
  NW_T | double
  SW_T | double
  NE_T | double
  SE_T | double
  B | double
  W_B | double
  E_B | double
  N_B | double
  S_B | double
  NW_B | double
  SW_B | double
  NE_B | double
  SE_B | double
  V | double

Returns
  N_data_star *

Definition at line 264 of file n_les_assemble.c.

References N_data_star::B, N_data_star::C, N_data_star::E, N_data_star::E_B, N_data_star::E_T, G_debug(), N_data_star::N, N_alloc_27star(), N_data_star::N_B, N_data_star::N_T, N_data_star::NE, NE, N_data_star::NE_B, N_data_star::NE_T, N_data_star::NW, NW, N_data_star::NW_B, N_data_star::NW_T, N_data_star::S, N_data_star::S_B, N_data_star::S_T, N_data_star::SE, SE, N_data_star::SE_B, N_data_star::SE_T, N_data_star::SW, SW, N_data_star::SW_B, N_data_star::SW_T, N_data_star::T, N_data_star::V, N_data_star::W, N_data_star::W_B, and N_data_star::W_T.

## N_create_5star()

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

Parameters

  C | double
  W | double
  E | double
  N | double
  S | double
  V | double

Returns
  N_data_star *

Definition at line 124 of file n_les_assemble.c.

References N_data_star::C, N_data_star::E, G_debug(), N_data_star::N, N_alloc_5star(), N_data_star::S, N_data_star::V, and N_data_star::W.

Referenced by N_callback_gwflow_2d().

## N_create_7star()

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

Parameters

  C | double
  W | double
  E | double
  N | double
  S | double
  T | double
  B | double
  V | double

Returns
  N_data_star *

Definition at line 159 of file n_les_assemble.c.

References N_data_star::B, N_data_star::C, N_data_star::E, G_debug(), N_data_star::N, N_alloc_7star(), N_data_star::S, N_data_star::T, N_data_star::V, and N_data_star::W.

Referenced by N_callback_gwflow_3d(), and N_callback_solute_transport_3d().

## N_create_9star()

N_data_star * N_create_9star | ( | double | C,
|  | double | W,
|  | double | E,
|  | double | N,
|  | double | S,
|  | double | NW,
|  | double | SW,
|  | double | NE,
|  | double | SE,
|  | double | V )

allocate and initialize a 9 point star data structure

Parameters

  C | double
  W | double
  E | double
  N | double
  S | double
  NW | double
  SW | double
  NE | double
  SE | double
  V | double

Returns
  N_data_star *

Definition at line 200 of file n_les_assemble.c.

References N_data_star::C, N_data_star::E, G_debug(), N_data_star::N, N_alloc_9star(), N_data_star::NE, NE, N_data_star::NW, NW, N_data_star::S, N_data_star::SE, SE, N_data_star::SW, SW, N_data_star::V, and N_data_star::W.

Referenced by N_callback_solute_transport_2d().

## N_les_integrate_dirichlet_2d()

int N_les_integrate_dirichlet_2d | ( | N_les * | les,
|  | N_geom_data * | geom,
|  | N_array_2d * | status,
|  | N_array_2d * | start_val )

Integrate Dirichlet or Transmission boundary conditions into the les (2s).

Dirichlet and Transmission boundary conditions will be integrated into the provided linear equation system. This is meaningful if the les was created with N_assemble_les_2d_dirichlet, because in this case Dirichlet boundary conditions are not automatically included.

The provided les will be modified:

Ax = b will be split into Ax_u + Ax_d = b

x_u - the unknowns x_d - the Dirichlet cells

Ax_u = b -Ax_d will be computed. Then the matrix A will be modified to

| A_u 0 | x_u | 0 I | x_d

Parameters

  les | N_les* – the linear equation system
  geom | N_geom_data* – geometrical data information
  status | N_array_2d* – the status array containing the cell types
  start_val | N_array_2d* – an array with start values

Returns
  int – 1 = success, 0 = failure

Definition at line 793 of file n_les_assemble.c.

References N_les::A, N_les::Asp, N_les::b, N_geom_data::cols, N_les::cols, count, G_debug(), G_free(), G_math_Ax_sparse(), G_math_d_Ax(), N_CELL_ACTIVE, N_get_array_2d_c_value(), N_get_array_2d_d_value(), N_MAX_CELL_STATE, N_SPARSE_LES, N_geom_data::rows, N_les::rows, N_les::type, and x.

## N_les_integrate_dirichlet_3d()

int N_les_integrate_dirichlet_3d | ( | N_les * | les,
|  | N_geom_data * | geom,
|  | N_array_3d * | status,
|  | N_array_3d * | start_val )

Integrate Dirichlet or Transmission boundary conditions into the les (3d).

Dirichlet and Transmission boundary conditions will be integrated into the provided linear equation system. This is meaningful if the les was created with N_assemble_les_2d_dirichlet, because in this case Dirichlet boundary conditions are not automatically included.

The provided les will be modified:

Ax = b will be split into Ax_u + Ax_d = b

x_u - the unknowns x_d - the Dirichlet cells

Ax_u = b -Ax_d will be computed. Then the matrix A will be modified to

| A_u 0 | x_u | 0 I | x_d

Parameters

  les | N_les* – the linear equation system
  geom | N_geom_data* – geometrical data information
  status | N_array_2d* – the status array containing the cell types
  start_val | N_array_2d* – an array with start values

Returns
  int – 1 = success, 0 = failure

Definition at line 1252 of file n_les_assemble.c.

References N_les::A, N_les::Asp, N_les::b, N_geom_data::cols, N_les::cols, count, N_geom_data::depths, G_debug(), G_free(), G_math_Ax_sparse(), G_math_d_Ax(), N_CELL_ACTIVE, N_get_array_3d_d_value(), N_MAX_CELL_STATE, N_SPARSE_LES, N_geom_data::rows, N_les::rows, N_les::type, and x.

## N_set_les_callback_2d_func()

void N_set_les_callback_2d_func | ( | N_les_callback_2d * | data,
|  | N_data_star *(* | callback_func_2d )(void *, N_geom_data *, int, int) )

Set the callback function which is called while assembling the les in 2d.

Parameters

  data | N_les_callback_2d *
  callback_func_2d | N_data_star *

Returns
  void

Definition at line 360 of file n_les_assemble.c.

## N_set_les_callback_3d_func()

void N_set_les_callback_3d_func | ( | N_les_callback_3d * | data,
|  | N_data_star *(* | callback_func_3d )(void *, N_geom_data *, int, int, int) )

Set the callback function which is called while assembling the les in 3d.

Parameters

  data | N_les_callback_3d *
  callback_func_3d | N_data_star *

Returns
  void

Definition at line 341 of file n_les_assemble.c.