Fluctuating pressure boundary condition for inlet and outlet

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Fluctuating pressure boundary condition for inlet and outlet

Post by Yvan Fournier »

Hello,

I gave you both answers in previous posts I'm this thread :

- You must place your new subroutine In the same file but outside the user subroutine. And call it from the user subroutine. Another option is to simply place the code block (not as a subroutine) inside the user subroutine (cs_user_boundary_conditions).

- For the time step using ntcabs will word on a single computation but not on a restart. For that, to (ntcabs - ntprev) is better.

Regards,

Yvan
Tsubasa
Posts: 175
Joined: Fri Nov 20, 2020 4:09 am

Re: Fluctuating pressure boundary condition for inlet and outlet

Post by Tsubasa »

Hello,

I did it and post the code just in case when someone want to do or check it.
It seems that the code works correctly without errors, but sorry it is not readable code because I am new to fortran.

Code: Select all

real i_pressure
real, save :: i_narray(500)         ! total calculation step
integer :: total_nstep = 500        ! total calculation step

if(ntcabs ==1)then
  open (17, file='/home/tsubasa/Desktop/dynamis_pressure/simulation/SRC/inlet_pressure_time_history.csv', status='old')
  read (17, '()')       ! skip header
  do i = 1, total_nstep
    read (17, *) i_pressure
    i_narray(i) = i_pressure 
  end do
  close (17)
else
endif


!====================================
call getfbr('inlet', nlelt, lstelt)
do ilelt = 1, nlelt
   ifac = lstelt(ilelt)
   itypfb(ifac) = ientre

!Dirichlet B.C for pressure:
   icodcl(ifac,ipr) = 1
   rcodcl(ifac,ipr,1) = i_narray(ntcabs) 

!Neumann B.C for velocity:
   icodcl(ifac,iu)= 3
   icodcl(ifac,iv)= 3
   icodcl(ifac,iw)= 3
enddo
Best regards,
Tsubasa
Post Reply