My Project
programmer's documentation
Functions/Subroutines
cs_user_boundary_conditions.f90 File Reference

User subroutine which fills boundary conditions arrays (icodcl, rcodcl) for unknown variables. More...

Functions/Subroutines

subroutine cs_f_user_boundary_conditions (nvar, nscal, icodcl, itrifb, itypfb, izfppp, dt, rcodcl)
 

Detailed Description

User subroutine which fills boundary conditions arrays (icodcl, rcodcl) for unknown variables.

See cs_user_boundary_conditions.f90 for examples.

Introduction

Here one defines boundary conditions on a per-face basis.

Boundary faces may be selected using the getfbr subroutine.

getfbr(string, nelts, lstelt)

string may contain:

These criteria may be combined using logical operators (and,or) and parentheses.

Example
1 and(group2 or group3) and y < 1
will select boundary faces of color 1, belonging to groups 'group2' or 'group3' and with face center coordinate y less than 1.

Operators priority, from highest to lowest: '( )' > 'not' > 'and' > 'or' > 'xor'

Similarly, interior faces and cells can be identified using the getfac and getcel subroutines (respectively). Their syntax are identical to getfbr syntax.

For a more thorough description of the criteria syntax, see the user guide.

Boundary condition types

Boundary conditions may be assigned in two ways.

For "standard" boundary conditions:

One defines a code in the itypfb array (of dimensions number of boundary faces). This code will then be used by a non-user subroutine to assign the following conditions. The available codes are:

These integers are defined elsewhere (in paramx.f90 module). Their value is greater than or equal to 1 and less than or equal to ntypmx (value fixed in paramx.h)

In addition, some values must be defined:

For "non-standard" conditions:

Other than (inlet, free outlet, wall, symmetry), one defines

The value of icodcl is taken from the following:

The values of the 3 rcodcl components are:

Note that if the user assigns a value to itypfb equal to ientre, isolib, isymet, iparoi, or iparug and does not modify icodcl (zero value by default), itypfb will define the boundary condition type.

To the contrary, if the user prescribes icodcl(ifac, ivar) (nonzero), the values assigned to rcodcl will be used for the considered face and variable (if rcodcl values are not set, the default values will be used for the face and variable, so:

Especially, one may have for example:

The user may also assign to itypfb a value not equal to ientre, isolib, isymet, iparoi, iparug, iindef but greater than or equal to 1 and less than or equal to ntypmx (see values in param.h) to distinguish groups or colors in other subroutines which are specific to the case and in which itypfb is accessible. In this case though it will be necessary to prescribe boundary conditions by assigning values to icodcl and to the 3 rcodcl fields (as the value of itypfb will not be predefined in the code).

Boundary condition types for compressible flows

For compressible flows, only predefined boundary conditions may be assigned among: iparoi, isymet, iesicf, isspcf, isopcf, iephcf, ieqhcf

For inlets/outlets, we can prescribe a value for turbulence and passive scalars in rcodcl(.,.,1) for the case in which the mass flux is incoming. If this is not done, a zero flux condition is applied.

Consistency rules

A few consistency rules between icodcl codes for variables with non-standard boundary conditions:

Remarks
  • Caution: to prescribe a flux (nonzero) to Rij, the viscosity to take into account is viscl even if visct exists (visct=rho cmu k2/epsilon)
  • One have the ordering array for boundary faces from the previous time step (except for the fist one, where itrifb has not been set yet).
  • The array of boundary face types itypfb has been reset before entering the subroutine.

Cell values of some variables

Cell value field ids

Faces identification

Please refer to the boundary conditions section of the theory guide for more informations.

Function/Subroutine Documentation

◆ cs_f_user_boundary_conditions()

subroutine cs_f_user_boundary_conditions ( integer  nvar,
integer  nscal,
integer, dimension(nfabor,nvar icodcl,
integer, dimension(nfabor)  itrifb,
integer, dimension(nfabor)  itypfb,
integer, dimension(nfabor)  izfppp,
double precision, dimension(ncelet)  dt,
double precision, dimension(nfabor,nvar,3)  rcodcl 
)
Parameters
[in]nvartotal number of variables
[in]nscaltotal number of scalars
[out]icodclboundary condition code:
  • 1 Dirichlet
  • 2 Radiative outlet
  • 3 Neumann
  • 4 sliding and $ \vect{u} \cdot \vect{n} = 0 $
  • 5 smooth wall and $ \vect{u} \cdot \vect{n} = 0 $
  • 6 rough wall and $ \vect{u} \cdot \vect{n} = 0 $
  • 9 free inlet/outlet (input mass flux blocked to 0)
  • 13 Dirichlet for the advection operator and Neumann for the diffusion operator
[in]itrifbindirection for boundary faces ordering
[in,out]itypfbboundary face types
[out]izfpppboundary face zone number
[in]dttime step (per cell)
[in,out]rcodclboundary condition values:
  • rcodcl(1) value of the dirichlet
  • rcodcl(2) value of the exterior exchange coefficient (infinite if no exchange)
  • rcodcl(3) value flux density (negative if gain) in w/m2 or roughness in m if icodcl=6
    1. for the velocity $ (\mu+\mu_T) \gradt \, \vect{u} \cdot \vect{n} $
    2. for the pressure $ \Delta t \grad P \cdot \vect{n} $
    3. for a scalar $ cp \left( K + \dfrac{K_T}{\sigma_T} \right) \grad T \cdot \vect{n} $
getfbr
subroutine getfbr(fstr, facnb, faces)
Build the list of boundary faces matching a criteria string.
Definition: cs_selector_f2c.f90:111