My Project
programmer's documentation
Advanced examples

Local variables to be added

integer ifac, iel, ii, ivar
integer izone
integer ilelt, nlelt
double precision uref2, d2s3
double precision rhomoy, xdh, xustar2
double precision xitur
double precision xkent, xeent
integer, allocatable, dimension(:) :: lstelt
double precision, dimension(:), pointer :: boundary_roughness

Initialization and finalization

Initialization and finalization is similar to that of the base examples

Example 1

Example of specific boundary conditions fully defined by the user, on the basis of wall conditions selection (mass flow computation, specific logging, ...)

We prescribe for group '1234' a wall, with in addition:

  • a Dirichlet condition on velocity (sliding wall with no-slip condition)
  • a Dirichlet condition on the first scalar.
call getfbr('1234', nlelt, lstelt)
!==========
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = iparoi
icodcl(ifac,iu ) = 1
rcodcl(ifac,iu,1) = 1.d0
rcodcl(ifac,iu,2) = rinfin
rcodcl(ifac,iu,3) = 0.d0
icodcl(ifac,iv ) = 1
rcodcl(ifac,iv,1) = 0.d0
rcodcl(ifac,iv,2) = rinfin
rcodcl(ifac,iv,3) = 0.d0
icodcl(ifac,iw ) = 1
rcodcl(ifac,iw,1) = 0.d0
rcodcl(ifac,iw,2) = rinfin
rcodcl(ifac,iw,3) = 0.d0
ivar = isca(1)
icodcl(ifac,ivar ) = 1
rcodcl(ifac,ivar,1) = 10.d0
rcodcl(ifac,ivar,2) = rinfin
rcodcl(ifac,ivar,3) = 0.d0
enddo

Example 2

Example of specific boundary conditions fully defined by the user, with no definition of a specific type.

We prescribe at group '5678' a homogeneous Neumann condition for all variables.

call getfbr('5678', nlelt, lstelt)
!==========
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
! CAUTION: the value of itypfb must be assigned to iindef
itypfb(ifac) = iindef
do ii = 1, nvar
icodcl(ifac,ii ) = 3
rcodcl(ifac,ii,1) = 0.d0
rcodcl(ifac,ii,2) = rinfin
rcodcl(ifac,ii,3) = 0.d0
enddo
enddo

Example 3

Example of specific boundary conditions fully defined by the user, with the definition of a specific type, for example for future selection (mass flow computation, specific logging, ...)

We prescribe for group '6789' a homogeneous Neumann condition for all variables, except for the first scalar, for which we select a homogeneous Dirichlet.

call getfbr('6789', nlelt, lstelt)
!==========
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
! CAUTION: the value of itypfb must be different from
! iparoi, ientre, isymet, isolib, iindef,
! greater than or equal to 1, and
! less than or equal to ntypmx;
! these integers are defined in paramx.h
itypfb(ifac) = 89
do ii = 1, nvar
icodcl(ifac,ii ) = 3
rcodcl(ifac,ii,1) = 0.d0
rcodcl(ifac,ii,2) = rinfin
rcodcl(ifac,ii,3) = 0.d0
enddo
icodcl(ifac,isca(1) ) = 1
rcodcl(ifac,isca(1),1) = 0.d0
rcodcl(ifac,isca(1),2) = rinfin
rcodcl(ifac,isca(1),3) = 0.d0
enddo

Example 4

Example of wall boundary condition with automatic continuous switch between rough and smooth.

call field_get_val_s_by_name("boundary_roughness", boundary_roughness)
call getfbr('6789', nlelt, lstelt)
!==========
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
! CAUTION: wall function keyword "iwallf" must be set to 6
! in cs_user_parameters.
itypfb(ifac) = iparoi
! Boundary roughtness (in meter)
boundary_roughness(ifac) = 0.05
enddo
getfbr
subroutine getfbr(fstr, facnb, faces)
Build the list of boundary faces matching a criteria string.
Definition: cs_selector_f2c.f90:111