My Project
programmer's documentation
Functions
cs_cdofb_monolithic.c File Reference

Build an algebraic CDO face-based system for the Navier-Stokes equations and solved it with a monolithic approach. More...

#include "cs_defs.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <assert.h>
#include <string.h>
#include <bft_mem.h>
#include "cs_blas.h"
#include "cs_cdo_bc.h"
#include "cs_cdofb_priv.h"
#include "cs_cdofb_scaleq.h"
#include "cs_cdofb_vecteq.h"
#include "cs_cdofb_navsto.h"
#include "cs_dbg.h"
#include "cs_equation_bc.h"
#include "cs_equation_common.h"
#include "cs_equation_priv.h"
#include "cs_evaluate.h"
#include "cs_fp_exception.h"
#include "cs_log.h"
#include "cs_math.h"
#include "cs_navsto_coupling.h"
#include "cs_param.h"
#include "cs_post.h"
#include "cs_sles.h"
#include "cs_source_term.h"
#include "cs_static_condensation.h"
#include "cs_timer.h"
#include "cs_cdofb_monolithic.h"
Include dependency graph for cs_cdofb_monolithic.c:

Functions

static void _build_shared_structures (void)
 Define the cs_range_set_t, cs_interface_set_t, cs_matrix_assembler_t and cs_matrix_structure_t structures. More...
 
static void _apply_bc_partly (const cs_cdofb_monolithic_t *sc, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, const cs_boundary_type_t *bf_type, cs_cell_sys_t *csys, cs_cell_builder_t *cb)
 Apply the boundary conditions to the local system when this should be done before the static condensation. More...
 
static void _apply_remaining_bc (const cs_cdofb_monolithic_t *sc, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_cell_sys_t *csys, cs_cell_builder_t *cb, cs_cdofb_navsto_builder_t *nsb, cs_real_t *mass_rhs)
 Apply the boundary conditions to the local system when this should be done after the static condensation. More...
 
static void _assemble (const cs_cell_sys_t *csys, const cs_cell_mesh_t *cm, const cs_real_t *div_op, const bool has_sourceterm, cs_matrix_assembler_values_t *mav, cs_real_t rhs[], cs_real_t eqc_st[])
 Perform the assembly stage for a vector-valued system obtained with CDO-Fb schemes Shares similarities with cs_equation_assemble_block_matrix() More...
 
static void _solve_system (cs_sles_t *sles, const cs_matrix_t *matrix, const cs_equation_param_t *eqp, cs_real_t *vel_f, cs_real_t *pre_c, cs_real_t *b_f, cs_real_t *b_c)
 Solve a linear system arising from a scalar-valued CDO-Fb scheme. More...
 
static void _compute_and_update_fields (const cs_matrix_t *matrix, cs_cdofb_monolithic_t *sc, cs_equation_t *mom_eq, cs_real_t *mom_rhs, cs_real_t *mass_rhs)
 Solve the linear system and update the velocity fields and the pressure field. More...
 
void cs_cdofb_monolithic_init_common (const cs_mesh_t *mesh, const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step)
 Set shared pointers from the main domain members. More...
 
void * cs_cdofb_monolithic_init_scheme_context (const cs_navsto_param_t *nsp, cs_boundary_type_t *bf_type, void *nsc_input)
 Initialize a cs_cdofb_monolithic_t structure. More...
 
void * cs_cdofb_monolithic_free_scheme_context (void *scheme_context)
 Destroy a cs_cdofb_monolithic_t structure. More...
 
void cs_cdofb_monolithic_set_sles (const cs_navsto_param_t *nsp, void *context)
 Start setting-up the Navier-Stokes equations when a monolithic algorithm is used to couple the system. No mesh information is available at this stage. More...
 
void cs_cdofb_monolithic_compute_steady (const cs_mesh_t *mesh, const cs_navsto_param_t *nsp, void *scheme_context)
 Solve the steady Navier-Stokes system with a CDO face-based scheme using a monolithic approach. More...
 
void cs_cdofb_monolithic_compute_implicit (const cs_mesh_t *mesh, const cs_navsto_param_t *nsp, void *scheme_context)
 Solve the unsteady Navier-Stokes system with a CDO face-based scheme using a monolithic approach and an Euler time scheme. More...
 
void cs_cdofb_monolithic_compute_theta (const cs_mesh_t *mesh, const cs_navsto_param_t *nsp, void *scheme_context)
 Solve the unsteady Navier-Stokes system with a CDO face-based scheme using a monolithic approach and a theta time scheme. More...
 

Detailed Description

Build an algebraic CDO face-based system for the Navier-Stokes equations and solved it with a monolithic approach.

Function Documentation

◆ _apply_bc_partly()

static void _apply_bc_partly ( const cs_cdofb_monolithic_t *  sc,
const cs_equation_param_t eqp,
const cs_cell_mesh_t cm,
const cs_boundary_type_t bf_type,
cs_cell_sys_t csys,
cs_cell_builder_t cb 
)
static

Apply the boundary conditions to the local system when this should be done before the static condensation.

Parameters
[in]scpointer to a cs_cdofb_monolithic_t structure
[in]eqppointer to a cs_equation_param_t structure
[in]cmpointer to a cellwise view of the mesh
[in]bf_typetype of boundary for the boundary face
[in,out]csyspointer to a cellwise view of the system
[in,out]cbpointer to a cellwise builder

◆ _apply_remaining_bc()

static void _apply_remaining_bc ( const cs_cdofb_monolithic_t *  sc,
const cs_equation_param_t eqp,
const cs_cell_mesh_t cm,
cs_cell_sys_t csys,
cs_cell_builder_t cb,
cs_cdofb_navsto_builder_t nsb,
cs_real_t mass_rhs 
)
static

Apply the boundary conditions to the local system when this should be done after the static condensation.

Parameters
[in]scpointer to a cs_cdofb_monolithic_t structure
[in]eqppointer to a cs_equation_param_t structure
[in]cmpointer to a cellwise view of the mesh
[in,out]csyspointer to a cellwise view of the system
[in,out]cbpointer to a cellwise builder
[in,out]nsbbuilder structure for the NavSto system
[in,out]mass_rhspointer to the rhs for the mass eq. in this cell

◆ _assemble()

static void _assemble ( const cs_cell_sys_t csys,
const cs_cell_mesh_t cm,
const cs_real_t div_op,
const bool  has_sourceterm,
cs_matrix_assembler_values_t mav,
cs_real_t  rhs[],
cs_real_t  eqc_st[] 
)
static

Perform the assembly stage for a vector-valued system obtained with CDO-Fb schemes Shares similarities with cs_equation_assemble_block_matrix()

Parameters
[in]csyspointer to a cs_cell_sys_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in]div_oparray with the divergence op. values
[in]has_sourcetermhas the equation a source term?
[in,out]mavpointer to cs_matrix_assembler_values_t
[in,out]rhsright-end side of the system
[in,out]eqc_stsource term from the context view

◆ _build_shared_structures()

static void _build_shared_structures ( void  )
static

Define the cs_range_set_t, cs_interface_set_t, cs_matrix_assembler_t and cs_matrix_structure_t structures.

◆ _compute_and_update_fields()

static void _compute_and_update_fields ( const cs_matrix_t matrix,
cs_cdofb_monolithic_t *  sc,
cs_equation_t mom_eq,
cs_real_t mom_rhs,
cs_real_t mass_rhs 
)
static

Solve the linear system and update the velocity fields and the pressure field.

Parameters
[in]scscheme context
[in]mom_eqequation structure related to the momentum
[in]matrixpointer to a cs_matrix_t structure
[in,out]mom_rhsright-hand side for the momentum equation
[in,out]mass_rhsright_hand side for the mass equation

◆ _solve_system()

static void _solve_system ( cs_sles_t sles,
const cs_matrix_t matrix,
const cs_equation_param_t eqp,
cs_real_t vel_f,
cs_real_t pre_c,
cs_real_t b_f,
cs_real_t b_c 
)
static

Solve a linear system arising from a scalar-valued CDO-Fb scheme.

Parameters
[in,out]slespointer to a cs_sles_t structure
[in]matrixpointer to a cs_matrix_t structure
[in]eqppointer to a cs_equation_param_t structure
[in,out]vel_finitial velocity on faces
[in,out]pre_cinitial pressure in cells
[in,out]b_fright-hand side (scatter/gather if needed) on faces
[in,out]b_cright_hand side on cells (mass equation)

◆ cs_cdofb_monolithic_compute_implicit()

void cs_cdofb_monolithic_compute_implicit ( const cs_mesh_t mesh,
const cs_navsto_param_t nsp,
void *  scheme_context 
)

Solve the unsteady Navier-Stokes system with a CDO face-based scheme using a monolithic approach and an Euler time scheme.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]nsppointer to a cs_navsto_param_t structure
[in]scheme_contextpointer to a structure cast on-the-fly

◆ cs_cdofb_monolithic_compute_steady()

void cs_cdofb_monolithic_compute_steady ( const cs_mesh_t mesh,
const cs_navsto_param_t nsp,
void *  scheme_context 
)

Solve the steady Navier-Stokes system with a CDO face-based scheme using a monolithic approach.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]nsppointer to a cs_navsto_param_t structure
[in,out]scheme_contextpointer to a structure cast on-the-fly

◆ cs_cdofb_monolithic_compute_theta()

void cs_cdofb_monolithic_compute_theta ( const cs_mesh_t mesh,
const cs_navsto_param_t nsp,
void *  scheme_context 
)

Solve the unsteady Navier-Stokes system with a CDO face-based scheme using a monolithic approach and a theta time scheme.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]nsppointer to a cs_navsto_param_t structure
[in]scheme_contextpointer to a structure cast on-the-fly

◆ cs_cdofb_monolithic_free_scheme_context()

void* cs_cdofb_monolithic_free_scheme_context ( void *  scheme_context)

Destroy a cs_cdofb_monolithic_t structure.

Parameters
[in]scheme_contextpointer to a scheme context structure to free
Returns
a NULL pointer

◆ cs_cdofb_monolithic_init_common()

void cs_cdofb_monolithic_init_common ( const cs_mesh_t mesh,
const cs_cdo_quantities_t quant,
const cs_cdo_connect_t connect,
const cs_time_step_t time_step 
)

Set shared pointers from the main domain members.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]quantadditional mesh quantities struct.
[in]connectpointer to a cs_cdo_connect_t struct.
[in]time_steppointer to a cs_time_step_t structure

◆ cs_cdofb_monolithic_init_scheme_context()

void* cs_cdofb_monolithic_init_scheme_context ( const cs_navsto_param_t nsp,
cs_boundary_type_t bf_type,
void *  nsc_input 
)

Initialize a cs_cdofb_monolithic_t structure.

Parameters
[in]nsppointer to a cs_navsto_param_t structure
[in]bf_typetype of boundary for each boundary face
[in]nsc_inputpointer to a cs_navsto_ac_t structure
Returns
a pointer to a new allocated cs_cdofb_monolithic_t structure

◆ cs_cdofb_monolithic_set_sles()

void cs_cdofb_monolithic_set_sles ( const cs_navsto_param_t nsp,
void *  context 
)

Start setting-up the Navier-Stokes equations when a monolithic algorithm is used to couple the system. No mesh information is available at this stage.

Start setting-up the Navier-Stokes equations when a monolithic algorithm is used to coupled the system. No mesh information is available at this stage.

Parameters
[in]nsppointer to a cs_navsto_param_t structure
[in,out]contextpointer to a context structure cast on-the-fly