!================================================================
! $B0l<!85J|<MJ?9UBg5$7W;;(B; $B%a%$%s%W%m%0%i%`(B
!
! 97/01/25 $B>.9b@5;L(B
!================================================================
PROGRAM main
USE para_module
IMPLICIT NONE

	INTEGER :: i
	REAL,DIMENSION(zdim) :: uf	! $B>e8~$-J|<MB+L)EY(B
	REAL,DIMENSION(zdim) :: df	! $B2<8~$-J|<MB+L)EY(B
	REAL,DIMENSION(zdim) :: bf	! $B9uBNJ|<MB+L)EY(B
	REAL,DIMENSION(zdim) :: temp	! $B29EY(B
	REAL,DIMENSION(zdim) :: p	! $B05NO(B
	REAL,DIMENSION(zdim) :: tau	! $B8w3XE*?<$5(B

	DO i=1,zdim
	   p(i) = slp/(zdim-1)*(zdim-i)
	END DO

	tau = kai/ga*p

	bf   = 0.5*uf0*(1.5*tau + 1)
	uf   = 0.5*uf0*(1.5*tau + 2)
	df   = 0.5*uf0*1.5*tau
	temp = (bf/sig)**(0.25) 

	CALL dclfig(p,tau,bf,uf,df,temp)

	WRITE(*,*) 'END PROGRAM'

	CONTAINS
!----------------------------------------------------------------------
SUBROUTINE dclfig(p,tau,bf,uf,df,temp)

	REAL,DIMENSION(zdim),INTENT(in) :: uf	! $B>e8~$-J|<MB+L)EY(B
	REAL,DIMENSION(zdim),INTENT(in) :: df	! $B2<8~$-J|<MB+L)EY(B
	REAL,DIMENSION(zdim),INTENT(in) :: bf	! $B9uBNJ|<MB+L)EY(B
	REAL,DIMENSION(zdim),INTENT(in) :: temp	! $B29EY(B
	REAL,DIMENSION(zdim),INTENT(in) :: p	! $B05NO(B
	REAL,DIMENSION(zdim),INTENT(in) :: tau	! $B8w3XE*?<$5(B

	INTEGER :: iws 				! $BEEG>%Q%i%a!<%?(B
	REAL :: taub 				! $B8w3XE*?<$5(B

	taub = tau(1)

	CALL swiset( 'IWIDTH', 700 )
	CALL swiset( 'IHEIGHT', 400 )
        CALL sglset( 'LCORNER', .FALSE. )
	WRITE(*,*) 'WORKSTATION ID (I) ?;'
	CALL sgpwsn
	READ(*,*) iws
	CALL gropn( -iws )
	CALL sldiv( 'T',1, 2 )

	CALL grfrm

	CALL grswnd( 0., 620., taub, 0. )
	CALL grsvpt( 0.2, 0.8, 0.2, 0.8 )
	CALL grstrn( 1 )
	CALL grstrf
	CALL usdaxs
	CALL uxsttl( 'B', 'flux (W/m^2)', 0. )
	CALL uysttl( 'L', 'optical depth', 0. )
	CALL uulin( zdim, uf, tau )
	CALL uuslnt(3)
	CALL uulin( zdim, df, tau )
	CALL uuslnt(1)
	CALL uuslni(2)
	CALL uulin( zdim, bf, tau )

	CALL grfrm
	CALL grswnd( 200., 350., slp, 100. )
	CALL grsvpt( 0.2, 0.8, 0.2, 0.8 )
	CALL grstrn( 2 )
	CALL grstrf
	CALL usdaxs
	CALL uxsttl( 'B', 'temperature (K)', 0. )
	CALL uysttl( 'L', 'pressure (Pa)', 0. )
	CALL uuslni(1)
	CALL uulin( zdim-1, temp, p )

	CALL grcls

END SUBROUTINE dclfig
!----------------------------------------------------------------------
END PROGRAM main





















