subroutine fixthetainf
use modglobal, only : ib,ie,jb,je,kb,ke,kh,dxf,xh,dt,&
Uinf,ifixuinf,tscale,timee,rk3step,inletav,&
freestreamav,thlsrc,ltempeq
use modfields, only : thl0
use modmpi, only : myid,comm3d,mpierr,mpi_sum,my_real,nprocs
use modsurfdata, only: thl_top
implicit none
real ttop,freestreamtheta,rk3coef
integer i,j
ttop = 0.
! if (ifixuinf==1 .and. rk3step==3 .and. ltempeq) then !tg3315 commented
! rk3coef = dt / (4. - dble(rk3step))
! do j =jb,je
! do i =ib,ie
! ttop = ttop + thl0(i,j,ke)*dxf(i)
! end do
! end do
! ttop = ttop / ( (je-jb+1)*(xh(ie+1)-xh(ib) ) )
! call MPI_ALLREDUCE(ttop, freestreamtheta,1,MY_REAL,MPI_SUM,comm3d,mpierr)
! freestreamtheta = freestreamtheta / nprocs
! thlsrc = -(1./dt) * (freestreamtheta - thl_top)
! if (myid==0) then
! open(unit=11,file='theta_top.txt',position='append')
! write(11,3003) timee,freestreamtheta
! 3003 format (13(6e20.12))
! close(11)
! open(unit=11,file='thlsrc.txt',position='append')
! write(11,3002) timee,thlsrc
! 3002 format (13(6e20.12))
! close(11)
! endif
! end if
end subroutine fixthetainf