Although | don't think this code is correct, I tried it below anyway,
Code: Select all
subroutine cs_f_user_boundary_conditions &
( nvar , nscal , &
icodcl , itrifb , itypfb , izfppp , &
dt , &
rcodcl )
!===============================================================================
!===============================================================================
! Module files
!===============================================================================
use paramx
use numvar
use optcal
use cstphy
use cstnum
use entsor
use parall
use period
use ihmpre
use ppppar
use ppthch
use coincl
use cpincl
use ppincl
use ppcpfu
use atincl
use atsoil
use ctincl
use cs_fuel_incl
use mesh
use field
use turbomachinery
use iso_c_binding
use cs_c_bindings
!===============================================================================
implicit none
! Arguments
integer nvar , nscal
integer icodcl(nfabor,nvar)
integer itrifb(nfabor), itypfb(nfabor)
integer izfppp(nfabor)
double precision dt(ncelet)
double precision rcodcl(nfabor,nvar,3)
! Local variables
!< [loc_var_dec]
integer ifac, iel, ii
integer ilelt, nlelt
double precision uref2
double precision rhomoy, xdh
double precision xitur
integer, allocatable, dimension(:) :: lstelt
double precision, dimension(:), pointer :: bfpro_rom
!< [loc_var_dec]
! INSERT_VARIABLE_DEFINITIONS_HERE
!===============================================================================
!===============================================================================
! Initialization
!===============================================================================
allocate(lstelt(nfabor)) ! temporary array for boundary faces selection
! INSERT_ADDITIONAL_INITIALIZATION_CODE_HERE
!===============================================================================
! Assign boundary conditions to boundary faces here
! For each subset:
! - use selection criteria to filter boundary faces of a given subset
! - loop on faces from a subset
! - set the boundary condition for each face
!===============================================================================
! INSERT_MAIN_CODE_HERE
call getfbr('Inlet', nlelt, lstelt)
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = 77! Custom number (better to be a big number should not be equal to another boundary)
!Dirichlet B.C for inlet pressure:
icodcl(ifac,ipr) = 1
rcodcl(ifac,ipr,1) = 100050 !pressure value
enddo
call getfbr('Outlet', nlelt, lstelt)
do ilelt = 2, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = 77! Custom number (better to be a big number should not be equal to another boundary)
!Dirichlet B.C for outlet pressure:
icodcl(ifac,ipr) = 1
rcodcl(ifac,ipr,1) = 100010 !pressure value
enddo
!--------
! Formats
!--------
!----
! End
!----
deallocate(lstelt) ! temporary array for boundary faces selection
return
end subroutine cs_f_user_boundary_conditions
!> \section examples Examples
!> Several examples are provided
!> \ref cs_user_boundary_conditions_examples "here".
Could you tell me how to modify this?
In paticular, what should I write for such as "Local variables" and "Arguments"? I just copied example case to above code at the moment.
(In my case, I want to impose only Pressure value for both inlet and outlet, and I don't want to impose velocity values. (Now I use laminar flow instead of turbulence model.))
Also, to activate user subroutine, do I just have to put "cs_user_boundary_conditions.f90"(in which above code is written) in "SRC"? After that, I just run simulaiton with GUI, right? Even though I run simualtion by GUI, user subroutine is a top priority if subroutine file exists in "SRC", isn't it?
If yes, I wonder why above user subroutine was not activate in my case.
Sorry for bothering you.
I hope someone help me.
Best regards,
Hamada