1 MODULE module_netcdf2kma_interface
3 use module_wave2grid_kma
8 SUBROUTINE netcdf2kma_interface ( grid
, config_flags
)
12 USE module_driver_constants
16 real,allocatable
:: DPSE(:,:),DUE(:,:,:),DVE(:,:,:),DTE(:,:,:),DQE(:,:,:)
17 real,allocatable
:: PSB (:,:), UB(:,:,:), VB(:,:,:), TB(:,:,:), QB(:,:,:)
18 real,allocatable
:: PSG (:,:), UG(:,:,:), VG(:,:,:), TG(:,:,:), QG(:,:,:)
19 integer :: i
,j
,k
!shcimsi
20 real,allocatable
:: dum(:,:,:) !shcimsi
24 TYPE(domain
) , INTENT(INOUT
) :: grid
25 TYPE (grid_config_rec_type
) :: config_flags
26 integer :: USE_INCREMENT
!shc
27 integer :: incre
,back
,ID(5),KT
,IM
,JM
,KM
!shc
28 integer :: IMAXE
,JMAXE
,IMAX
,JMAX
,KMAX
,IDIM
,JDIM
,MEND1
,ISST
,JSST
,ISNW
,JSNW
,MAXJZ
,IVAR
29 integer :: JMAXHF
, MNWAV
, IMX
31 ! we have to convert in equal lat/lon data
32 ! to Gaussian latitude
34 ! First the Equal lat/lon data
35 ! set Field as per KMA order (North top South and 0 to 360 east)
37 NAMELIST /netcdf2kma_parm
/ IMAXE
,JMAXE
,IMAX
,JMAX
,KMAX
,IDIM
,JDIM
,MEND1
,ISST
,JSST
,ISNW
,JSNW
,MAXJZ
,IVAR
39 READ (111, NML
= netcdf2kma_parm
, ERR
= 8000)
41 print*,' netcdf2kma_parm namelist data read are as follows:'
42 print*,' IMAXE= ',IMAXE
43 print*,' JMAXE= ',JMAXE
44 print*,' MEND1= ',MEND1
45 print*,' ISST = ',ISST
46 print*,' JSST = ',JSST
47 print*,' MAXJZ= ',MAXJZ
48 print*,' IVAR = ',IVAR
51 MNWAV
=MEND1
*(MEND1
+1)/2
54 allocate(DPSE(imaxe
,jmaxe
))
55 allocate(DUE(imaxe
,jmaxe
,kmax
),DVE(imaxe
,jmaxe
,kmax
))
56 allocate(DTE(imaxe
,jmaxe
,kmax
),DQE(imaxe
,jmaxe
,kmax
))
57 allocate(PSB(imax
,jmax
))
58 allocate(UB(imax
,jmax
,kmax
),VB(imax
,jmax
,kmax
))
59 allocate(TB(imax
,jmax
,kmax
),QB(imax
,jmax
,kmax
))
60 allocate(PSG(imax
,jmax
))
61 allocate(UG(imax
,jmax
,kmax
),VG(imax
,jmax
,kmax
))
62 allocate(TG(imax
,jmax
,kmax
),QG(imax
,jmax
,kmax
))
63 allocate(dum(imax
,jmax
,kmax
)) !shcimsi
66 ! back = 102 !shc start
69 read(back
) ID
,KT
,IM
,JM
,KM
78 read(back
) !z !shc end
79 USE_INCREMENT
=1 !shc start
80 if (USE_INCREMENT
.eq
.1) then
89 read(incre
) DQE
!shc end
90 ! DPSE=20.0; DUE=3.0; DVE=3.0; DTE=5.0; DQE=0.001 !shcimsi
91 ! imaxe=grid%ed31-grid%sd31 !shc start
92 ! jmaxe=grid%ed32-grid%sd32
93 ! kmaxe=grid%ed33-grid%sd33
94 ! imaxg=imaxe; jmaxg=jmaxe-1; kmaxg=kmaxe
95 call reorder_for_kma(DPSE
,imaxe
,jmaxe
,1)
96 call reorder_for_kma(DUE
,imaxe
,jmaxe
,kmax
)
97 call reorder_for_kma(DVE
,imaxe
,jmaxe
,kmax
)
98 call reorder_for_kma(DTE
,imaxe
,jmaxe
,kmax
)
99 call reorder_for_kma(DQE
,imaxe
,jmaxe
,kmax
) !shc end
100 DPSE
=DPSE
*0.01 !shchPa
101 call Einc_to_Ganl(DPSE
,DUE
,DVE
,DTE
,DQE
,& !shc start
102 PSB
, UB
, VB
, TB
, QB
,&
103 PSG
, UG
, VG
, TG
, QG
,&
104 IMAX
,JMAX
,IMAXE
,JMAXE
,KMAX
,MAXJZ
)
105 9001 format(10e15
.7
) !shcimsi start
106 !modified by shc nk start
107 !modified by shc nk end
109 call PREGSM1(PSG
,TG
,UG
,VG
,QG
,PSB
,TB
,UB
,VB
,QB
,IMAXE
,JMAXE
,ISST
,JSST
,MAXJZ
,IVAR
, &
110 IMAX
,JMAX
,KMAX
,IDIM
,JDIM
,MEND1
,MEND1
,MEND1
,ISNW
,JSNW
,JMAXHF
,MNWAV
,IMX
) !shc end
114 call reorder_for_kma(grid
%ht(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1),&
115 grid
%ed31
-grid
%sd31
,grid
%ed32
-grid
%sd32
,1)
116 call reorder_for_kma(grid
%psfc(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1),&
117 grid
%ed31
-grid
%sd31
,grid
%ed32
-grid
%sd32
,1)
118 call reorder_for_kma(grid
%u_2(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1,&
119 grid
%sd33
:grid
%ed33
-1),&
120 grid
%ed31
-grid
%sd31
,grid
%ed32
-grid
%sd32
,&
122 call reorder_for_kma(grid
%v_2(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1,&
123 grid
%sd33
:grid
%ed33
-1),&
124 grid
%ed31
-grid
%sd31
,grid
%ed32
-grid
%sd32
,&
126 call reorder_for_kma(grid
%t_2(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1,&
127 grid
%sd33
:grid
%ed33
-1),&
128 grid
%ed31
-grid
%sd31
,grid
%ed32
-grid
%sd32
,&
130 call reorder_for_kma(grid
%moist(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1,&
131 grid
%sd33
:grid
%ed33
-1,P_qv
:P_qv
),&
132 grid
%ed31
-grid
%sd31
,grid
%ed32
-grid
%sd32
,&
135 ! convert xb-psfc pressure in hPa
136 grid
%psfc(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1) = 0.01 * &
137 grid
%psfc(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1)
138 write(*,*) 'shcimsi num of gird',grid
%ed31
,grid
%ed32
,grid
%ed33
139 write(*,*) 'shcimsi grid',grid
%ed31
-grid
%sd31
,grid
%ed32
-grid
%sd32
,&
142 CALL PREGSM(grid
%psfc(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1),&
143 grid
%t_2(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1,grid
%sd33
:grid
%ed33
-1),&
144 grid
%u_2(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1,grid
%sd33
:grid
%ed33
-1),&
145 grid
%v_2(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1,grid
%sd33
:grid
%ed33
-1),&
146 grid
%moist(grid
%sd31
:grid
%ed31
-1,grid
%sd32
:grid
%ed32
-1,grid
%sd33
:grid
%ed33
-1,P_qv
),& !shc
147 PSB
,TB
,UB
,VB
,QB
,IMAXE
,JMAXE
,ISST
,JSST
,MAXJZ
,IVAR
, &
148 IMAX
,JMAX
,KMAX
,IDIM
,JDIM
,MEND1
,MEND1
,MEND1
,ISNW
,JSNW
,JMAXHF
,MNWAV
,IMX
) !shc
152 deallocate(DPSE
,DUE
,DVE
,DTE
,DQE
)
153 deallocate(PSB
, UB
, VB
, TB
, QB
)
154 deallocate(PSG
, UG
, VG
, TG
, QG
, dum
)
156 8000 print*,' read error on namelist unit 111'
159 END SUBROUTINE netcdf2kma_interface
162 SUBROUTINE reorder_for_kma(wrf
,n1
,n2
,n3
)
165 integer, intent(in
) :: n1
,n2
,n3
166 real, intent(inout
) :: wrf(n1
,n2
,n3
)
168 real, dimension(n1
,n2
,n3
) :: kma
169 integer :: i
,j
,k
, n1half
176 kma(n1half
+i
,n2
-j
+1,k
) = wrf(i
,j
,k
)
178 kma(i
-n1half
,n2
-j
+1,k
) = wrf(i
,j
,k
)
184 END SUBROUTINE reorder_for_kma
186 END MODULE module_netcdf2kma_interface