Merge branch 'master' into jm2/perimeter
[wrffire.git] / wrfv2_fire / phys / module_sf_scmskintemp.F
blob5d6aecdce95285f86d9c814e156941d13ea97fba
5 module module_sf_scmskintemp
6 contains
8 !-------------------------------------------------------------------
10    subroutine scmskintemp(tsk, julian_in, itimestep,                            &
11                      ids, ide, jds, jde, kds, kde,                              &
12                      ims, ime, jms, jme, kms, kme,                              &
13                      its, ite, jts, jte, kts, kte   )
14 !-------------------------------------------------------------------
15       implicit none
16 !-------------------------------------------------------------------
18    integer, intent(in)   ::                       ids, ide, jds, jde, kds, kde, &
19                                                   ims, ime, jms, jme, kms, kme, &
20                                                   its, ite, jts, jte, kts, kte, &
21                                                   itimestep        
22 !   
23    real, intent(in)      ::                                          julian_in
25    real, dimension( ims:ime, jms:jme )                                        , &
26             intent(inout)::                                                tsk
28 !  local vars
30    integer, parameter    ::                                       n_max = 1200
31    integer               ::                                 i, j, n, nm, nt, m
32    real                  ::                         julian_s, julian_e, fc_int  
33    real, dimension( 0:n_max ) ::                             fc_tsk, fc_julian
34    logical               ::                                        end_of_file
36 !-----open scmtemp_bdy and read the julian_s, julian_e, fc_int
38    open(unit=11, file='scmtemp_bdy', form='formatted', status='old')
39    read(11,*) julian_s, julian_e, fc_int
41      end_of_file = .false.
42      n=1
43      do while (.not. end_of_file)
44        read(11,*,end=100) fc_tsk(n)
45        fc_julian(n)=julian_s+real(n-1)*fc_int/86400.
46        n=n+1
47        go to 110
48  100   end_of_file = .true.  
49  110   continue
50      enddo
51      nt=n-1
52    close(11)
54 !-----linear interpolation of the skin temperature for each time step
56    do n=1,nt 
57      if (julian_in.ge.fc_julian(n) .and. julian_in.lt.fc_julian(n+1)) then
58        fc_tsk(0)= fc_tsk(n)                                                     &
59                 +(fc_tsk(n+1)-fc_tsk(n))*(julian_in-fc_julian(n))/fc_int/86400.
60      endif
61    enddo
63 !-----compute skin temperature
65    do j=jts,jte
66      do i=its,ite
67        tsk(i,j)=fc_tsk(0)
68      enddo
69    enddo 
71    end subroutine scmskintemp
72 !-------------------------------------------------------------------
73 end module module_sf_scmskintemp