7.2
general documentation
cs_user_boundary_conditions.c File Reference

User functions for input of calculation parameters. More...

#include "cs_defs.h"
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "cs_headers.h"
+ Include dependency graph for cs_user_boundary_conditions.c:

Functions

void cs_user_boundary_conditions_setup (cs_domain_t *domain)
 Set boundary conditions to be applied. More...
 
void cs_user_boundary_conditions (int nvar, int bc_type[], int icodcl[], cs_real_t rcodcl[])
 User definition of boundary conditions. More...
 

Detailed Description

User functions for input of calculation parameters.

See Input of calculation parameters (C functions in cs_user_parameters.c) for examples.

Function Documentation

◆ cs_user_boundary_conditions()

void cs_user_boundary_conditions ( int  nvar,
int  bc_type[],
int  icodcl[],
cs_real_t  rcodcl[] 
)

User definition of boundary conditions.

Parameters
[in]nvartotal number of variable BC's
[in]bc_typeboundary face types
[in]icodclboundary face code
  • 1 -> Dirichlet
  • 2 -> convective outlet
  • 3 -> flux density
  • 4 -> sliding wall and u.n=0 (velocity)
  • 5 -> friction and u.n=0 (velocity)
  • 6 -> roughness and u.n=0 (velocity)
  • 9 -> free inlet/outlet (velocity) inflowing possibly blocked
[in]rcodclboundary condition values rcodcl(3) = flux density value (negative for gain) in W/m2

The icodcl and rcodcl arrays are pre-initialized based on default and GUI-defined definitions, and may be modified here.

For a given variable id "ivar" and a given face "face_id", these arrays may be used as follows:

  • Boundary condition type code given at: icodcl[ivar*n_b_faces + face_id]
  • Dirichlet value defined at: rcodcl[ivar*n_b_faces + face_id]
  • Interior exchange coefficient (infinite if no exchange) at: rcodcl[(ivar + nvar)*n_b_faces + face_id] = interior exchange
  • Flux density defined at: rcodcl[(ivar + 2*nvar)*n_b_faces + face_id];

For a given field f, the "ivar" variable id may be obtained as follows: int ivar = cs_field_get_key_int(f, cs_field_key_id("variable_id")) - 1;

◆ cs_user_boundary_conditions_setup()

void cs_user_boundary_conditions_setup ( cs_domain_t domain)

Set boundary conditions to be applied.

This function is called just before cs_user_finalize_setup, and boundary conditions can be defined in either of those functions, depending on whichever is considered more readable or practical for a given use.

Parameters
[in,out]domainpointer to a cs_domain_t structure