5 module module_sf_scmflux
8 !-------------------------------------------------------------------
10 subroutine scmflux(u3d, v3d, t3d, qv3d, p3d, dz8w, &
11 cp, rovcp, xlv, psfc, cpm, xland, &
12 psim, psih, hfx, qfx, lh, tsk, flhc, flqc, &
14 julian_in, karman, p1000mb, &
16 ids, ide, jds, jde, kds, kde, &
17 ims, ime, jms, jme, kms, kme, &
18 its, ite, jts, jte, kts, kte )
19 !-------------------------------------------------------------------
21 !-------------------------------------------------------------------
23 integer, intent(in) :: ids, ide, jds, jde, kds, kde, &
24 ims, ime, jms, jme, kms, kme, &
25 its, ite, jts, jte, kts, kte, itimestep
27 real, intent(in) :: cp, rovcp, xlv, julian_in, karman, p1000mb
29 real, dimension( ims:ime, kms:kme, jms:jme ) , &
36 real, dimension( ims:ime, jms:jme ) , &
42 real, dimension( ims:ime, jms:jme ) , &
43 intent(inout):: cpm, &
56 integer, parameter :: n_max = 1200
57 integer :: i, j, n, nm, nt, m
58 real, parameter :: den = 1.
59 real :: julian_s, julian_e, fc_int, &
61 real, dimension( 1:n_max ) :: fc_qfx, fc_hfx, fc_julian !JP 0 ->1
62 real :: qfx_interp,hfx_interp ! JP
63 real, dimension( its:ite, jts:jte) :: u2d, &
72 logical :: end_of_file
74 !-----open scmflx_bdy and read the julian_s, julian_e, fc_int
76 open(unit=11, file='scmflx_bdy', form='formatted', status='old')
78 read(11,*) julian_s, julian_e, fc_int
82 do while (.not. end_of_file)
83 read(11,*,end=100) fc_hfx(n), fc_qfx(n)
84 fc_julian(n)=julian_s+(n-1)*fc_int/86400.
87 100 end_of_file = .true.
93 !-----linear interpolation of the fluxes for each time step
96 if (julian_in.ge.fc_julian(n) .and. julian_in.lt.fc_julian(n+1)) then
97 qfx_interp= fc_qfx(n) &
98 +(fc_qfx(n+1)-fc_qfx(n))*(julian_in-fc_julian(n))/(fc_int/86400.)
99 hfx_interp= fc_hfx(n) &
100 +(fc_hfx(n+1)-fc_hfx(n))*(julian_in-fc_julian(n))/(fc_int/86400.)
104 !-----compute surface moisture and heat fluxes, in the unit of [W m-2]
107 !-----compute skin temperature
114 qv2d(i,j)=qv3d(i,1,j)
116 dz8w1d(i,j)=dz8w(i,1,j)
117 za(i,j)=0.5*dz8w1d(i,j)
124 !-----compute surface moisture flux
126 qfx(i,j)=qfx_interp/1000.
127 qfx(i,j)=amax1(qfx(i,j),0.)
132 !-----compute surface heat flux
134 cpm(i,j)=cp*(1.+0.8*qv2d(i,j))
135 ! print*,'i j cpm xland qv2d',i,j,cpm(i,j),xland(i,j), qv2d(i,j)
137 if(xland(i,j)-1.5 .gt. 0.)then
138 hfx(i,j)=hfx_interp*cpm(i,j)
139 elseif(xland(i,j)-1.5 .lt. 0.)then
140 hfx(i,j)=hfx_interp*cpm(i,j)
141 hfx(i,j)=amax1(hfx(i,j),-250.)
147 if (itimestep .eq. 1) then
157 gz1oz0(i,j)=alog(za(i,j)/znt(i,j))
158 fh=gz1oz0(i,j)-psih(i,j)
159 fm=gz1oz0(i,j)-psim(i,j)
161 wspd(i,j)=sqrt(u2d(i,j)**2+v2d(i,j)**2)
162 dtdiff=-hfx(i,j)/den/cpm(i,j)/ch/wspd(i,j)
163 tsk(i,j)=t2d(i,j)-dtdiff
167 end subroutine scmflux
168 !-------------------------------------------------------------------
169 end module module_sf_scmflux