programmer's documentation
Macros | Functions | Variables
cs_equation_common.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <string.h>
#include <bft_mem.h>
#include "cs_boundary_zone.h"
#include "cs_cdo_local.h"
#include "cs_cdovb_scaleq.h"
#include "cs_cdovb_vecteq.h"
#include "cs_cdovcb_scaleq.h"
#include "cs_cdofb_navsto.h"
#include "cs_cdofb_scaleq.h"
#include "cs_cdofb_vecteq.h"
#include "cs_hho_scaleq.h"
#include "cs_hho_vecteq.h"
#include "cs_log.h"
#include "cs_math.h"
#include "cs_parall.h"
#include "cs_xdef_eval.h"
#include "cs_equation_common.h"
Include dependency graph for cs_equation_common.c:

Macros

#define CS_EQUATION_COMMON_DBG   0
 

Functions

void cs_equation_common_allocate (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step, const cs_domain_cdo_context_t *cc)
 Allocate a pointer to a buffer of size at least the 2*n_cells for managing temporary usage of memory when dealing with equations Call specific structure allocation related to a numerical scheme according the scheme flag The size of the temporary buffer can be bigger according to the numerical settings Set also shared pointers from the main domain members. More...
 
void cs_equation_common_free (const cs_domain_cdo_context_t *cc)
 Allocate a pointer to a buffer of size at least the 2*n_cells for managing temporary usage of memory when dealing with equations Call specific structure allocation related to a numerical scheme according the scheme flag The size of the temporary buffer can be bigger according to the numerical settings. More...
 
cs_equation_builder_tcs_equation_init_builder (const cs_equation_param_t *eqp, const cs_mesh_t *mesh)
 Allocate a new structure to handle the building of algebraic system related to a cs_equation_t structure. More...
 
void cs_equation_free_builder (cs_equation_builder_t **p_builder)
 Free a cs_equation_builder_t structure. More...
 
cs_gnum_t cs_equation_prepare_system (int stride, cs_lnum_t x_size, const cs_real_t *x0, const cs_real_t *rhs, const cs_matrix_t *matrix, cs_range_set_t *rset, cs_real_t *p_x[], cs_real_t *p_rhs[])
 Prepare a linear system and synchronize buffers to handle parallelism. Transfer a mesh-based description of arrays x0 and rhs into an algebraic description for the linear system in x and b. More...
 
void cs_equation_write_monitoring (const char *eqname, const cs_equation_builder_t *eqb)
 Print a message in the performance output file related to the monitoring of equation. More...
 
void cs_equation_init_cell_sys_bc (const cs_equation_builder_t *eqb, const cs_cell_mesh_t *cm, cs_cell_sys_t *csys)
 Set members of the cs_cell_sys_t structure related to the boundary conditions. Only the generic part is done here. The remaining part is performed in _init_cell_system() for each scheme. More...
 
void cs_equation_init_properties (const cs_equation_param_t *eqp, const cs_equation_builder_t *eqb, cs_real_t t_eval, cs_cell_builder_t *cb)
 Initialize all properties for an algebraic system. More...
 
void cs_equation_set_diffusion_property (const cs_equation_param_t *eqp, cs_lnum_t c_id, cs_real_t t_eval, cs_flag_t c_flag, cs_cell_builder_t *cb)
 Set the diffusion property inside a cell and its related quantities. More...
 
void cs_equation_set_diffusion_property_cw (const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_real_t t_eval, cs_flag_t c_flag, cs_cell_builder_t *cb)
 Set the diffusion property inside a cell and its related quantities. Cellwise version using a cs_cell_mesh_t structure. More...
 
void cs_equation_enforced_internal_dofs (const cs_equation_param_t *eqp, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
 Take into account the enforcement of internal DoFs. Apply an algebraic manipulation. More...
 
void cs_equation_assemble_matrix (const cs_cell_sys_t *csys, const cs_range_set_t *rset, cs_matrix_assembler_values_t *mav)
 Assemble a cellwise system into the global algebraic system. More...
 
void cs_equation_assemble_block_matrix (const cs_cell_sys_t *csys, const cs_range_set_t *rset, int n_x_dofs, cs_matrix_assembler_values_t *mav)
 Assemble a cellwise system defined by blocks into the global algebraic system. More...
 
const cs_adjacency_tcs_equation_get_v2v_index (void)
 Get the connectivity vertex->vertices for the local rank. More...
 
const cs_adjacency_tcs_equation_get_f2f_index (void)
 Get the connectivity face->faces for the local rank. More...
 
cs_real_tcs_equation_get_tmpbuf (void)
 Retrieve a pointer to a buffer of size at least the 2*n_cells The size of the temporary buffer can be bigger according to the numerical settings. More...
 
size_t cs_equation_get_tmpbuf_size (void)
 Get the allocation size of the temporary buffer. More...
 
cs_equation_balance_tcs_equation_balance_create (cs_flag_t location, cs_lnum_t size)
 Allocate a cs_equation_balance_t structure. More...
 
void cs_equation_balance_reset (cs_equation_balance_t *b)
 Reset a cs_equation_balance_t structure. More...
 
void cs_equation_balance_sync (const cs_cdo_connect_t *connect, cs_equation_balance_t *b)
 Synchronize balance terms if this is a parallel computation. More...
 
void cs_equation_balance_destroy (cs_equation_balance_t **p_balance)
 Free a cs_equation_balance_t structure. More...
 

Variables

static size_t cs_equation_common_work_buffer_size = 0
 
static cs_real_tcs_equation_common_work_buffer = NULL
 
static cs_matrix_assembler_t ** cs_equation_common_ma = NULL
 
static cs_matrix_structure_t ** cs_equation_common_ms = NULL
 
static cs_adjacency_tcs_connect_v2v = NULL
 
static cs_adjacency_tcs_connect_f2f = NULL
 
static const cs_cdo_quantities_tcs_shared_quant
 
static const cs_cdo_connect_tcs_shared_connect
 
static const cs_time_step_tcs_shared_time_step
 
static cs_timer_counter_t tca
 
static cs_timer_counter_t tcc
 

Macro Definition Documentation

◆ CS_EQUATION_COMMON_DBG

#define CS_EQUATION_COMMON_DBG   0

Function Documentation

◆ cs_equation_assemble_block_matrix()

void cs_equation_assemble_block_matrix ( const cs_cell_sys_t csys,
const cs_range_set_t rset,
int  n_x_dofs,
cs_matrix_assembler_values_t mav 
)

Assemble a cellwise system defined by blocks into the global algebraic system.

Parameters
[in]csyscellwise view of the algebraic system
[in]rsetpointer to a cs_range_set_t structure
[in]n_x_dofsnumber of DoFs per entity (= size of the block)
[in,out]mavpointer to a matrix assembler structure

◆ cs_equation_assemble_matrix()

void cs_equation_assemble_matrix ( const cs_cell_sys_t csys,
const cs_range_set_t rset,
cs_matrix_assembler_values_t mav 
)

Assemble a cellwise system into the global algebraic system.

Parameters
[in]csyscellwise view of the algebraic system
[in]rsetpointer to a cs_range_set_t structure
[in,out]mavpointer to a matrix assembler structure

◆ cs_equation_balance_create()

cs_equation_balance_t* cs_equation_balance_create ( cs_flag_t  location,
cs_lnum_t  size 
)

Allocate a cs_equation_balance_t structure.

Parameters
[in]locationwhere the balance is performed
[in]sizesize of arrays in the structure
Returns
a pointer to the new allocated structure

◆ cs_equation_balance_destroy()

void cs_equation_balance_destroy ( cs_equation_balance_t **  p_balance)

Free a cs_equation_balance_t structure.

Parameters
[in,out]p_balancepointer to the pointer to free

◆ cs_equation_balance_reset()

void cs_equation_balance_reset ( cs_equation_balance_t b)

Reset a cs_equation_balance_t structure.

Parameters
[in,out]bpointer to a cs_equation_balance_t to reset

◆ cs_equation_balance_sync()

void cs_equation_balance_sync ( const cs_cdo_connect_t connect,
cs_equation_balance_t b 
)

Synchronize balance terms if this is a parallel computation.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in,out]bpointer to a cs_equation_balance_t to rsync

◆ cs_equation_common_allocate()

void cs_equation_common_allocate ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_time_step_t time_step,
const cs_domain_cdo_context_t cc 
)

Allocate a pointer to a buffer of size at least the 2*n_cells for managing temporary usage of memory when dealing with equations Call specific structure allocation related to a numerical scheme according the scheme flag The size of the temporary buffer can be bigger according to the numerical settings Set also shared pointers from the main domain members.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to additional mesh quantities struct.
[in]time_steppointer to a time step structure
[in]ccpointer to a cs_domain_cdo_context_t struct.

◆ cs_equation_common_free()

void cs_equation_common_free ( const cs_domain_cdo_context_t cc)

Allocate a pointer to a buffer of size at least the 2*n_cells for managing temporary usage of memory when dealing with equations Call specific structure allocation related to a numerical scheme according the scheme flag The size of the temporary buffer can be bigger according to the numerical settings.

Parameters
[in]ccpointer to a structure storing CDO/HHO metadata

◆ cs_equation_enforced_internal_dofs()

void cs_equation_enforced_internal_dofs ( const cs_equation_param_t eqp,
cs_cell_builder_t cb,
cs_cell_sys_t csys 
)

Take into account the enforcement of internal DoFs. Apply an algebraic manipulation.

| | | | | | | | | | | Aii | Aie | | Aii | 0 | |bi| |bi -Aid.x_enf| |---------—| –> |---------—| and |–| –> |----------—| | | | | | | | | | | | Aei | Aee | | 0 | Id | |be| | x_enf |

where x_enf is the value of the enforcement for the selected internal DoFs

Parameters
[in]eqppointer to a cs_equation_param_t struct.
[in,out]cbpointer to a cs_cell_builder_t structure
[in,out]csysstructure storing the cell-wise system

◆ cs_equation_free_builder()

void cs_equation_free_builder ( cs_equation_builder_t **  p_builder)

Free a cs_equation_builder_t structure.

Parameters
[in,out]p_builderpointer of pointer to the cs_equation_builder_t structure to free

◆ cs_equation_get_f2f_index()

const cs_adjacency_t* cs_equation_get_f2f_index ( void  )

Get the connectivity face->faces for the local rank.

Returns
a pointer to a cs_adjacency_t structure

◆ cs_equation_get_tmpbuf()

cs_real_t* cs_equation_get_tmpbuf ( void  )

Retrieve a pointer to a buffer of size at least the 2*n_cells The size of the temporary buffer can be bigger according to the numerical settings.

Returns
a pointer to an array of double

◆ cs_equation_get_tmpbuf_size()

size_t cs_equation_get_tmpbuf_size ( void  )

Get the allocation size of the temporary buffer.

Returns
the size of the temporary buffer

◆ cs_equation_get_v2v_index()

const cs_adjacency_t* cs_equation_get_v2v_index ( void  )

Get the connectivity vertex->vertices for the local rank.

Returns
a pointer to a cs_adjacency_t structure

◆ cs_equation_init_builder()

cs_equation_builder_t* cs_equation_init_builder ( const cs_equation_param_t eqp,
const cs_mesh_t mesh 
)

Allocate a new structure to handle the building of algebraic system related to a cs_equation_t structure.

Allocate a new structure to handle the building of algebraic system related to an cs_equation_t structure.

Parameters
[in]eqppointer to a cs_equation_param_t structure
[in]meshpointer to a cs_mesh_t structure
Returns
a pointer to a new allocated cs_equation_builder_t structure

◆ cs_equation_init_cell_sys_bc()

void cs_equation_init_cell_sys_bc ( const cs_equation_builder_t eqb,
const cs_cell_mesh_t cm,
cs_cell_sys_t csys 
)

Set members of the cs_cell_sys_t structure related to the boundary conditions. Only the generic part is done here. The remaining part is performed in _init_cell_system() for each scheme.

Parameters
[in]eqbpointer to a cs_equation_builder_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]csyspointer to a cs_cell_system_t structure

◆ cs_equation_init_properties()

void cs_equation_init_properties ( const cs_equation_param_t eqp,
const cs_equation_builder_t eqb,
cs_real_t  t_eval,
cs_cell_builder_t cb 
)

Initialize all properties for an algebraic system.

Parameters
[in]eqppointer to a cs_equation_param_t structure
[in]eqbpointer to a cs_equation_builder_t structure
[in]t_evaltime at which one performs the evaluation
[in,out]cbpointer to a cs_cell_builder_t structure (diffusion property is stored inside)

◆ cs_equation_prepare_system()

cs_gnum_t cs_equation_prepare_system ( int  stride,
cs_lnum_t  x_size,
const cs_real_t x0,
const cs_real_t rhs,
const cs_matrix_t matrix,
cs_range_set_t rset,
cs_real_t p_x[],
cs_real_t p_rhs[] 
)

Prepare a linear system and synchronize buffers to handle parallelism. Transfer a mesh-based description of arrays x0 and rhs into an algebraic description for the linear system in x and b.

Parameters
[in]stridestride to apply to the range set operations
[in]x_sizesize of the vector unknows (scatter view)
[in]x0pointer to an array (unknows to compute)
[in]rhspointer to an array (right-hand side)
[in]matrixpointer to a cs_matrix_t structure
[in]rsetpointer to a range set structure
[in,out]p_xpointer of pointer to the linear solver unknows
[in,out]p_rhspointer of pointer to the right-hand side
Returns
the number of non-zeros in the matrix

◆ cs_equation_set_diffusion_property()

void cs_equation_set_diffusion_property ( const cs_equation_param_t eqp,
cs_lnum_t  c_id,
cs_real_t  t_eval,
cs_flag_t  c_flag,
cs_cell_builder_t cb 
)

Set the diffusion property inside a cell and its related quantities.

Parameters
[in]eqppointer to a cs_equation_param_t structure
[in]c_idid of the cell to deal with
[in]t_evaltime at which one performs the evaluation
[in]c_flagflag related to this cell
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_equation_set_diffusion_property_cw()

void cs_equation_set_diffusion_property_cw ( const cs_equation_param_t eqp,
const cs_cell_mesh_t cm,
cs_real_t  t_eval,
cs_flag_t  c_flag,
cs_cell_builder_t cb 
)

Set the diffusion property inside a cell and its related quantities. Cellwise version using a cs_cell_mesh_t structure.

Parameters
[in]eqppointer to a cs_equation_param_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in]t_evaltime at which one performs the evaluation
[in]c_flagflag related to this cell
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_equation_write_monitoring()

void cs_equation_write_monitoring ( const char *  eqname,
const cs_equation_builder_t eqb 
)

Print a message in the performance output file related to the monitoring of equation.

Parameters
[in]eqnamepointer to the name of the current equation
[in]eqbpointer to a cs_equation_builder_t structure

Variable Documentation

◆ cs_connect_f2f

cs_adjacency_t* cs_connect_f2f = NULL
static

◆ cs_connect_v2v

cs_adjacency_t* cs_connect_v2v = NULL
static

◆ cs_equation_common_ma

cs_matrix_assembler_t** cs_equation_common_ma = NULL
static

◆ cs_equation_common_ms

cs_matrix_structure_t** cs_equation_common_ms = NULL
static

◆ cs_equation_common_work_buffer

cs_real_t* cs_equation_common_work_buffer = NULL
static

◆ cs_equation_common_work_buffer_size

size_t cs_equation_common_work_buffer_size = 0
static

◆ cs_shared_connect

const cs_cdo_connect_t* cs_shared_connect
static

◆ cs_shared_quant

const cs_cdo_quantities_t* cs_shared_quant
static

◆ cs_shared_time_step

const cs_time_step_t* cs_shared_time_step
static

◆ tca

cs_timer_counter_t tca
static

◆ tcc

cs_timer_counter_t tcc
static