Interoperable Physics Driver for NGGPS
do_physics_one_step.f
Go to the documentation of this file.
1 
4 
5  SUBROUTINE do_physics_one_step(deltim,kdt,PHOUR,
6  & grid_fld, sfc_fld,
7  & flx_fld, nst_fld, g3d_fld,
8  & g2d_fld, aoi_fld, importdata,
9  & lats_nodes_r,global_lats_r,
10  & lonsperlar,xlon,xlat,coszdg,
11  & hprime,swh,swhc,hlw,hlwc,
12 ! & HTRSWB,HTRLWB, ! idea add
13  & fluxr,sfalb, slag,sdec,cdec,
14  & ozplin, jindx1, jindx2, ddy,
15  & h2oplin, jindx1_h, jindx2_h, ddy_h,
16  & phy_f3d, phy_f2d, phy_fctd, nctp,
17  & nblck, zhour_dfi,n3, n4,
18 ! & NBLCK,ZHOUR, zhour_dfi,n3, n4,
19  & lsout,colat1,cfhour1,restart_step,
20  & mdl_parm)
21 !!
22 
23 !!
24 !! Code Revision:
25 !! oct 11 2009 Sarah Lu, grid_gr is replaced by grid_fld
26 !! dec 01 2009 Sarah Lu, add CLDCOV/FCLD check print
27 !! dec 08 2009 Sarah Lu, add g3d_fld to gloopr calling argument
28 !! dec 15 2009 Sarah Lu, add g3d_fld to gloopb calling argument;
29 !! add DQDT check print
30 !! Feb 05 2010 J. Wang, write out restart file
31 !! Apr 10 2010 Sarah Lu, debug print removed
32 !! Jul 07 2010 S. Moorthi Added nst_fld and other changes
33 !! Jul 21 2010 Sarah Lu, output 2d aerosol diag fields
34 !! Aug 03 2010 Jun Wang, set llsav through ndfi,ldfi
35 !! Aug 10 2010 Sarah Lu, zerout g2d_fld if needed
36 !! Aug 25 2010 J. Wang, add half dfi filtered fields output
37 !! Sep 11 2010 Sarah Lu, g2d_fld zerout call modified
38 !! Apr 06 2012 Henry Juang, add idea
39 !! Oct 18 2012 S. Moorthi Added oro_uf and modifications to nst
40 !! Mar 08 2013 J. Wang, add restart capibility for idea
41 !! Mar 26 2014 Xingren Wu, add aoi_fld for A/O/I coupling
42 !! Mar 31 2014 S Moorthi Add ocn_tmp as the input argument and use
43 !! when it contains valid data - for coupled model
44 !! Jul -- 2014 S Moorthi - merge with GFS, fix init-micro call etc
45 !! jun 2014 y-t hou, revised sw sfc spectral component fluxes
46 !! and ocean albedo (no ice contamination) for coupled mdl
47 !! Sep 16 2014 S Moorthi - cleanup and rearrange argumets for gloopr and glopb
48 !! Sep 30 2014 Sarah Lu, remove fscav (the option to compute tracer
49 !! scavenging in GFS is disable)
50 !! Apr 13 2014 S Moorthi - do physics only for comp_task
51 !! Jun 09 2015 G Theurich Generalize importData handling
52 !! Aug 2015 Xu Li, change nst_fcst and nst_spinup to be nstf_name and
53 !! introduce the depth mean SST
54 !! Sep 25 2015 Xingren Wu Connect importData to GSM for A/O/I coupling
55 !! Jan 2016 P. Tripp Coupling import/exportFieldsList for NUOPC/GSM merge
56 !! ocn_tmp moved to importData
57 !! Feb 25 2016 S Moorthi - add kdt_dif and associated chnages
58 !! March 2016 Hang Lei Add DDT mdl_parm for physics driver
59 !! Mar 24 2016 Xingren Wu Connect Ice/Snow thickness (volume)
60 !! Aug 2015 Xu Li, change nst_fcst and nst_spinup to be nstf_name and
61 !! introduce the depth mean SST
62 !! Jun 09 2015 G Theurich Generalize importData handling
63 !! Sep 25 2015 Xingren Wu Connect importData to GSM for A/O/I coupling
64 !! Jan 2016 P. Tripp Coupling import/exportFieldsList for NUOPC/GSM merge
65 !! ocn_tmp moved to importData
66 !! Feb 25 2016 S Moorthi - add kdt_dif and associated chnages
67 !! March 2016 Hang Lei Add DDT mdl_parm for physics driver
68 !! Mar 24 2016 Xingren Wu Connect Ice/Snow thickness (volume)
69 !! Jun 10 2016 S Moorthi - add stratospheric h2o parameterization
70 !!
71  USE machine, ONLY: kind_grid, kind_rad, kind_phys
72  use resol_def
73  use layout1
74  use vert_def
75  use date_def
76  use namelist_physics_def
77  use physcons, only : rlapse
78  use mpi_def
79  use ozne_def
80  use h2o_def
81  use module_nst_water_prop, only: get_dtzm_2d
82  use gfs_physics_sfc_flx_mod
83  use gfs_physics_sfc_flx_set_mod
84  use gfs_physics_gridgr_mod, ONLY: grid_var_data
85  use gfs_physics_nst_var_mod, ONLY: nst_var_data
86  use gfs_physics_aoi_var_mod, ONLY: aoi_var_data
87  use gfs_physics_g3d_mod, ONLY: g3d_var_data
88  use gfs_physics_g2d_mod, ONLY: g2d_var_data, g2d_zerout
89 ! use gfs_phy_tracer_config, ONLY: gfs_phy_tracer_type
90  use d3d_def, ONLY: d3d_zero, cldcov
91 ! idea add by hmhj
92  use module_radsw_parameters, only : nbdsw
93  use module_radlw_parameters, only : nbdlw
94  use module_cplfields, only : nimportfields, queryfieldlist
95  &, importfieldslist
96  &, importfieldsvalid
98  IMPLICIT NONE
99 !!
100  TYPE(sfc_var_data) :: sfc_fld
101  TYPE(flx_var_data) :: flx_fld
102  TYPE(grid_var_data) :: grid_fld
103  TYPE(nst_var_data) :: nst_fld
104  TYPE(g3d_var_data) :: g3d_fld
105  TYPE(g2d_var_data) :: g2d_fld
106  type(aoi_var_data) :: aoi_fld
107 ! type(gfs_phy_tracer_type) :: gfs_phy_tracer
108 !* REAL(KIND=KIND_GRID) GRID_GR(lonr*lats_node_r_max,lotgr)
109  CHARACTER(16) :: CFHOUR1
110  logical :: restart_step
111 !!
112 ! The following dummy array must be an explicit shape dummy array!!!!!
113  REAL(KIND=KIND_EVOD),INTENT(IN)::
114  & importdata(lonr,lats_node_r,nimportfields)
115 ! importData(:,:,n) containts the import fields:
116 ! See module_CPLFIELDS.F90 for that list
117 
118  REAL(KIND=KIND_EVOD),INTENT(IN) :: deltim,PHOUR
119  REAL(KIND=KIND_EVOD),INTENT(INOUT) :: ZHOUR_DFI
120 ! REAL(KIND=KIND_EVOD),INTENT(INOUT) :: ZHOUR,ZHOUR_DFI
121 !!
122  REAL(KIND=KIND_EVOD) :: delt_cpl ! xw - add for A/O/I coupling
123 !!
124  INTEGER n3, n4, nblck, nctp, kdt
125  character(len=128) :: fldname
126 !!
127  INTEGER LATS_NODES_R(nodes)
128  integer, dimension(latr) :: global_lats_r, lonsperlar
129  real (kind=kind_rad) dtzm(lonr,lats_node_r)
130 !!
131 ! real(kind=kind_evod) zsea1,zsea2
132  real(kind=kind_evod) colat1, phyhour, phydt, dtp
133  real (kind=kind_phys), dimension(lonr,lats_node_r) :: xlon, xlat,
134  & coszdg, sfalb
135  real (kind=kind_phys), dimension(ngptc,levs,nblck,lats_node_r) ::
136  & swh, swhc, hlw, hlwc
137  REAL (KIND=KIND_RAD) HPRIME(nmtvr,lonr,lats_node_r),
138  & fluxr(nfxr,lonr,lats_node_r)
139 ! idea add by hmhj - commented by moorthi since unused
140 ! &, HTRSWB(NGPTC,LEVS,NBDSW,NBLCK,LATS_NODE_R)
141 ! &, HTRLWB(NGPTC,LEVS,NBDLW,NBLCK,LATS_NODE_R)
142 
143  REAL (kind=kind_phys) phy_f3d(ngptc,levs,ntot3d,nblck,lats_node_r)
144  &, phy_f2d(lonr,lats_node_r,ntot2d)
145  &, phy_fctd(lonr,lats_node_r,nctp)
146  &, ddy(lats_node_r), ddy_h(lats_node_r)
147 
148 ! real(kind=kind_evod) global_times_r(latr,nodes)
149 
150  INTEGER, dimension(lats_node_r) :: JINDX1, JINDX2
151  &, jindx1_h, jindx2_h
152  REAL OZPLIN(latsozp,levozp,pl_coeff,timeoz) !OZONE PL Coeff
153  &, h2oplin(latsh2o,levh2o,h2o_coeff,timeh2o)
154 
155  REAL(KIND=KIND_EVOD) SLAG,SDEC,CDEC
156  INTEGER IERR,I,J,K,L,LOCL,N,iprint, findex, kdt_dif
157  LOGICAL LSOUT
158  real(kind=kind_phys), parameter:: omz1 = 10.0 ! for nst model
159 !
160 ! real*8 rtc, timer1, timer2
161 
162  real (kind=kind_phys) dt_warm, tem1, tem2
163  real (kind=kind_phys), save :: zhour_dfin=0.
164 ! NUOPC physics driver types
165  type(model_parameters), intent(in) :: mdl_parm
166 !
167 ! zsea1=0.001*real(nstf_name(4))
168 ! zsea2=0.001*real(nstf_name(5))
169 
170 ! SHOUR = SHOUR + deltim
171  shour = kdt * deltim
172  fhour = shour / 3600.
173  lsfwd = kdt == 1
174 !jws
175  kdt_dif = kdt - kdt_start
176 ! if (me == 0) write(0,*)' in do_onestep ndfi=',ndfi,' kdt_dif=',kdt_dif
177 ! &,' ldfi=',ldfi,' me=',me,' kdt=',kdt,' kdt_start=',kdt_start
178 
179  lssav = .true.
180  if(ndfi > 0 .and. kdt_dif > ndfi/2 .and.
181  & kdt_dif <= ndfi .and. ldfi ) then
182  lssav = .false.
183  endif
184  if(.not. ldfi .and. ndfi > 0. and. kdt_dif == ndfi/2+1) then
185  zhour = zhour_dfin
186  endif
187 ! if (me == 0) write(0,*)' in do_onestep ndfi=',ndfi,' kdt_dif=',
188 ! & kdt_dif,' lssav=',lssav,' kdt=',kdt,' zhour=',zhour
189 !jwe
190  lscca = mod(kdt ,nsswr) == 0
191  lsswr = mod(kdt ,nsswr) == 1
192  lslwr = mod(kdt ,nslwr) == 1
193 ! test repro
194 ! phyhour = phour + deltim/3600.
195  phyhour = phour ! Moorthi No4 24, 2014
196  phydt = deltim
197 
198 ! if (me == 0) write(0,*)' in do_onestep phyhour=',phyhour
199 
200  if(.not. semilag .and. lsfwd) phydt = 0.5*deltim
201 !
202 !jw now all the pes are fcst pe
203 !jw ifnems (.NOT.LIOPE.or.icolor.ne.2) then
204 
205  if (comp_task) then
206 
207  if (nscyc > 0 .and. mod(kdt,nscyc) == 1) then
208  if (me == 0) print*,' calling gcycle at kdt=',kdt
209  if ( nst_anl ) then ! when nst analysis is on
210 !$omp parallel do private(i,j)
211  do j = 1, lats_node_r
212  do i = 1, lonr
213  if ( sfc_fld%slmsk(i,j) == 0 ) then
214  sfc_fld%tsea(i,j) = nst_fld%tref(i,j)
215  endif
216  enddo
217  enddo
218 
219  call gcycle(me,lats_node_r,lonsperlar,global_lats_r,
220  & ipt_lats_node_r,idate,phour,fhcyc,
221  & xlon ,xlat, sfc_fld, ialb,isot,ivegsrc)
222 
223 !$omp parallel do private(i,j)
224  do j = 1, lats_node_r
225  do i = 1, lonr
226  if ( sfc_fld%slmsk(i,j) == 0 ) then
227  nst_fld%tref(i,j) = sfc_fld%tsea(i,j)
228  endif
229  enddo
230  enddo
231 
232  call get_dtzm_2d(nst_fld%xt,nst_fld%xz,nst_fld%dt_cool,
233  & nst_fld%z_c,nst_fld%slmsk,zsea1,zsea2,
234  & lonr,lats_node_r,dtzm)
235 
236 !$omp parallel do private(i,j)
237  do j = 1, lats_node_r
238  do i = 1, lonr
239  if ( sfc_fld%slmsk(i,j) == 0 ) then
240  sfc_fld%tsea(i,j) = nst_fld%tref(i,j) + dtzm(i,j)
241  endif
242  enddo
243  enddo
244 
245  else ! when nst analysis is off
246  call gcycle(me,lats_node_r,lonsperlar,global_lats_r,
247  & ipt_lats_node_r,idate,phour,fhcyc,
248  & xlon ,xlat, sfc_fld, ialb,isot,ivegsrc)
249  endif ! if ( nst_anl) then
250  endif ! if (nscyc > 0 .and.
251 !
252  if (num_p3d == 3) then ! Ferrier Microphysics initialization
253  dtp = min(phydt,dtphys)
254  call init_micro(dtp,ngptc,levs,ntot3d,
255  & nblck*lats_node_r, phy_f3d(1,1,1,1,1),
256  & phour, me)
257  endif
258 !
259 !-> Coupling insertion
260 
261  if (cplflx) then
262 
263 ! -> Mask
264 ! ----
265  fldname='land_mask'
266  findex = queryfieldlist(importfieldslist,fldname)
267  if (importfieldsvalid(findex) .and.
268  & importdata(1,1,findex) > -99999.0) then
269 !$omp parallel do private(i,j)
270  do j = 1, lats_node_r
271  do i = 1, lonr
272  aoi_fld%slimskin(i,j) = 1.0
273  if (importdata(i,j,findex) < 0.01) then
274  aoi_fld%FICEIN(i,j) = 0.0
275  aoi_fld%slimskin(i,j) = 3.0
276  endif
277  enddo
278  enddo
279  else
280  if (me == 0)
281  & write(0,*) 'do_physics_one_step skip field ',trim(fldname)
282  endif
283 
284 ! -> SST
285 ! ---
286  fldname='sea_surface_temperature'
287  findex = queryfieldlist(importfieldslist,fldname)
288  if (importfieldsvalid(findex) .and.
289  & importdata(1,1,findex) > -99999.0) then
290 !$omp parallel do private(i,j)
291  do j = 1, lats_node_r
292  do i = 1, lonr
293  if (aoi_fld%slimskin(i,j) < 3.1 .and.
294  & aoi_fld%slimskin(i,j) > 2.9) then
295  if (sfc_fld%slmsk(i,j) < 0.1 .or.
296  & sfc_fld%slmsk(i,j) > 1.9) then
297  sfc_fld%TSEA(i,j) = importdata(i,j,findex)
298  endif
299  endif
300  enddo
301  enddo
302  else
303  if (me == 0)
304  & write(0,*) 'do_physics_one_step skip field ',trim(fldname)
305  endif
306 
307  if (nstf_name(1) > 1) then ! update tsea
308  if (importfieldsvalid(findex) .and.
309  & importdata(1,1,findex) > -99999.0) then
310 !
311 ! get tf from T1 (sfc_fld%tsea, OGCM layer 1 temperature) and
312 ! NSST-Profile
313 !
314  call get_dtzm_2d(nst_fld%xt,nst_fld%xz,nst_fld%dt_cool,
315  & nst_fld%z_c,sfc_fld%slmsk,
316  & 0.0,omz1,lonr,lats_node_r,dtzm)
317 !$omp parallel do private(j,i)
318  do j = 1, lats_node_r
319  do i = 1, lonr
320  if ( sfc_fld%slmsk(i,j) == 0 ) then
321  nst_fld%tref(i,j) = sfc_fld%tsea(i,j) - dtzm(i,j)
322  & + (sfc_fld%oro(i,j)-sfc_fld%oro_uf(i,j))*rlapse
323  endif
324  enddo
325  enddo
326 !
327 ! get tsea from Tf and NSST-Profile
328 !
329  call get_dtzm_2d(nst_fld%xt,nst_fld%xz,nst_fld%dt_cool,
330  & nst_fld%z_c,sfc_fld%slmsk,
331  & zsea1,zsea2,lonr,lats_node_r,dtzm)
332 
333 !$omp parallel do private(j,i)
334  do j = 1, lats_node_r
335  do i = 1, lonr
336  if ( sfc_fld%slmsk(i,j) == 0 ) then
337  sfc_fld%tsea(i,j) = nst_fld%tref(i,j) + dtzm(i,j)
338  & - (sfc_fld%oro(i,j)-sfc_fld%oro_uf(i,j))*rlapse
339  endif
340  enddo
341  enddo
342 
343  else
344 !
345 ! get tf from sfc_fld%tsea and NSST-Profile
346 !
347  call get_dtzm_2d(nst_fld%xt,nst_fld%xz,nst_fld%dt_cool,
348  & nst_fld%z_c,sfc_fld%slmsk,
349  & zsea1,zsea2,lonr,lats_node_r,dtzm)
350 !$omp parallel do private(j,i)
351  do j = 1, lats_node_r
352  do i = 1, lonr
353  if ( sfc_fld%slmsk(i,j) == 0 ) then
354  nst_fld%tref(i,j) = sfc_fld%tsea(i,j) - dtzm(i,j)
355  & + (sfc_fld%oro(i,j)-sfc_fld%oro_uf(i,j))*rlapse
356  endif
357  enddo
358  enddo
359  endif ! if (importData(1,1,findex) > -99999.0) then
360  endif ! if (nstf_name(1) > 1) then
361 
362 ! -> Ts
363 ! --
364  fldname='surface_temperature'
365  findex = queryfieldlist(importfieldslist,fldname)
366  if (importfieldsvalid(findex) .and.
367  & importdata(1,1,findex) > -99999.0) then
368  do j = 1, lats_node_r
369 !$omp parallel do private(i)
370  do i = 1, lonr
371  if (aoi_fld%slimskin(i,j) < 3.1 .and.
372  & aoi_fld%slimskin(i,j) > 2.9) then
373  aoi_fld%TSEAIN(i,j) = importdata(i,j,findex)
374  endif
375  enddo
376  enddo
377  else
378  if (me == 0)
379  & write(0,*) 'do_physics_one_step skip field ',trim(fldname)
380  endif
381 
382 ! -> SeaIce
383 ! ------
384  fldname='ice_fraction'
385  findex = queryfieldlist(importfieldslist,fldname)
386  if (importfieldsvalid(findex) .and.
387  & importdata(1,1,findex) > -99999.0) then
388 !$omp parallel do private(i,j)
389  do j = 1, lats_node_r
390 !$omp parallel do private(i)
391  do i = 1, lonr
392  if (importdata(i,j,findex) > 0.15) then
393  if (aoi_fld%slimskin(i,j) < 3.1 .and.
394  & aoi_fld%slimskin(i,j) > 2.9) then
395  if (sfc_fld%slmsk(i,j) < 0.1 .or.
396  & sfc_fld%slmsk(i,j) > 1.9) then
397  aoi_fld%FICEIN(i,j) = importdata(i,j,findex)
398  sfc_fld%FICE(i,j) = importdata(i,j,findex)
399  aoi_fld%slimskin(i,j) = 4.0
400  sfc_fld%slmsk(i,j) = 2.0
401  sfc_fld%TSEA(i,j) = aoi_fld%TSEAIN(i,j)
402  endif
403  endif
404  else
405  if (aoi_fld%slimskin(i,j) > 2.9 .and.
406  & aoi_fld%slimskin(i,j) < 3.1 .and.
407  & sfc_fld%FICE(i,j) > 0.15) then
408  sfc_fld%FICE(i,j) = 0.0
409  sfc_fld%slmsk(i,j) = 0.0
410  sfc_fld%TSEA(i,j) = aoi_fld%TSEAIN(i,j)
411  endif
412  endif
413  enddo
414  enddo
415  else
416  if (me == 0)
417  & write(0,*) 'do_physics_one_step skip field ',trim(fldname)
418  endif
419 
420  fldname='mean_ice_volume'
421  findex = queryfieldlist(importfieldslist,fldname)
422  if (importfieldsvalid(findex) .and.
423  & importdata(1,1,findex) > -99999.0) then
424 !$omp parallel do private(i,j)
425  do j = 1, lats_node_r
426 !$omp parallel do private(i)
427  do i = 1, lonr
428  if (aoi_fld%slimskin(i,j) > 2.5) then
429  aoi_fld%HICEIN(i,j)=importdata(i,j,findex)
430  if (sfc_fld%FICE(i,j) > 0.15) then
431  sfc_fld%HICE(i,j)=aoi_fld%HICEIN(i,j)
432  else
433  sfc_fld%HICE(i,j)=0.
434  endif
435  endif
436  enddo
437  enddo
438  else
439  if (me == 0)
440  & write(0,*) 'do_physics_one_step skip field ',trim(fldname)
441  endif
442 
443  fldname='mean_snow_volume'
444  findex = queryfieldlist(importfieldslist,fldname)
445  if (importfieldsvalid(findex) .and.
446  & importdata(1,1,findex) > -99999.0) then
447  do j = 1, lats_node_r
448 !$omp parallel do private(i)
449  do i = 1, lonr
450  if (aoi_fld%slimskin(i,j) > 2.5) then
451  aoi_fld%HSNOIN(i,j)=importdata(i,j,findex)
452  if (sfc_fld%FICE(i,j) > 0.15) then
453  sfc_fld%SNWDPH(i,j)=aoi_fld%HSNOIN(i,j)
454  else
455  sfc_fld%SNWDPH(i,j)=0.
456  endif
457  endif
458  enddo
459  enddo
460  else
461  if (me == 0)
462  & write(0,*) 'do_physics_one_step skip field ',trim(fldname)
463  endif
464 
465  fldname='mean_up_lw_flx'
466  findex = queryfieldlist(importfieldslist,fldname)
467  if (importfieldsvalid(findex) .and.
468  & importdata(1,1,findex) > -99999.0) then
469  do j = 1, lats_node_r
470 !$omp parallel do private(i)
471  do i = 1, lonr
472  if (aoi_fld%slimskin(i,j) > 3.9 .and.
473  & aoi_fld%slimskin(i,j) < 4.1) then
474  aoi_fld%ULWSFCIN(i,j)=-importdata(i,j,findex)
475  endif
476  enddo
477  enddo
478  else
479  if (me == 0)
480  & write(0,*) 'do_physics_one_step skip field ',trim(fldname)
481  endif
482  fldname='mean_laten_heat_flx'
483  findex = queryfieldlist(importfieldslist,fldname)
484  if (importfieldsvalid(findex) .and.
485  & importdata(1,1,findex) > -99999.0) then
486 !$omp parallel do private(i,j)
487  do j = 1, lats_node_r
488 !$omp parallel do private(i)
489  do i = 1, lonr
490  if (aoi_fld%slimskin(i,j) > 3.9 .and.
491  & aoi_fld%slimskin(i,j) < 4.1) then
492  aoi_fld%DQSFCIN(i,j) = -importdata(i,j,findex)
493  endif
494  enddo
495  enddo
496  else
497  if (me == 0)
498  & write(0,*) 'do_physics_one_step skip field ',trim(fldname)
499  endif
500  fldname='mean_sensi_heat_flx'
501  findex = queryfieldlist(importfieldslist,fldname)
502  if (importfieldsvalid(findex) .and.
503  & importdata(1,1,findex) > -99999.0) then
504 !$omp parallel do private(i,j)
505  do j = 1, lats_node_r
506 !$omp parallel do private(i)
507  do i = 1, lonr
508  if (aoi_fld%slimskin(i,j) > 3.9 .and.
509  & aoi_fld%slimskin(i,j) < 4.1) then
510  aoi_fld%DTSFCIN(i,j) = -importdata(i,j,findex)
511  endif
512  enddo
513  enddo
514  else
515  if (me == 0)
516  & write(0,*) 'do_physics_one_step skip field ',trim(fldname)
517  endif
518  fldname='mean_zonal_moment_flx'
519  findex = queryfieldlist(importfieldslist,fldname)
520  if (importfieldsvalid(findex) .and.
521  & importdata(1,1,findex) > -99999.0) then
522 !$omp parallel do private(i,j)
523  do j = 1, lats_node_r
524 !$omp parallel do private(i)
525  do i = 1, lonr
526  if (aoi_fld%slimskin(i,j) > 3.9 .and.
527  & aoi_fld%slimskin(i,j) < 4.1) then
528  aoi_fld%DUSFCIN(i,j) = -importdata(i,j,findex)
529  endif
530  enddo
531  enddo
532  else
533  if (me == 0)
534  & write(0,*) 'do_physics_one_step skip field ',trim(fldname)
535  endif
536  fldname='mean_merid_moment_flx'
537  findex = queryfieldlist(importfieldslist,fldname)
538  if (importfieldsvalid(findex) .and.
539  & importdata(1,1,findex) > -99999.0) then
540 !$omp parallel do private(i,j)
541  do j = 1, lats_node_r
542  do i = 1, lonr
543  if (aoi_fld%slimskin(i,j) > 3.9 .and.
544  & aoi_fld%slimskin(i,j) < 4.1) then
545  aoi_fld%DVSFCIN(i,j) = -importdata(i,j,findex)
546  endif
547  enddo
548  enddo
549  else
550  if (me == 0)
551  & write(0,*) 'do_physics_one_step skip field ',trim(fldname)
552  endif
553 
554  endif ! if cplflx
555 
556  if (lsswr .or. lslwr) then ! Radiation Call!
557 ! idea add by hmhj
558  if(lsidea) then
559  if(lsswr) then
560  swh = 0.
561 ! htrswb = 0.
562  endif
563  if(lslwr) then
564  hlw = 0.
565 ! htrlwb = 0.
566  endif
567  endif
568 !* CALL GLOOPR (grid_gr,
569  CALL gloopr (grid_fld, g3d_fld, aoi_fld, lats_nodes_r
570  &, global_lats_r, lonsperlar, phyhour
571  &, deltim, xlon, xlat, coszdg, flx_fld%COSZEN
572  &, sfc_fld%SLMSK, sfc_fld%weasd, sfc_fld%SNCOVR
573  &, sfc_fld%SNOALB, sfc_fld%ZORL, sfc_fld%TSEA
574  &, hprime, sfalb, sfc_fld%ALVSF, sfc_fld%ALNSF
575  &, sfc_fld%ALVWF, sfc_fld%ALNWF, sfc_fld%FACSF
576  &, sfc_fld%FACWF, sfc_fld%CV, sfc_fld%CVT
577  &, sfc_fld%CVB, swh, swhc, hlw, hlwc, flx_fld%SFCNSW
578  &, flx_fld%SFCDLW, sfc_fld%FICE, sfc_fld%TISFC
579  &, flx_fld%SFCDSW, flx_fld%sfcemis
580 
581  &, flx_fld%TSFLW, fluxr, phy_f3d, phy_f2d
582  &, slag, sdec, cdec, nblck, kdt, mdl_parm
583 ! &, HTRSWB,HTRLWB !idea add by hmhj
584  & )
585 ! if (iprint .eq. 1) print*,' me = fin gloopr ',me
586 
587  endif
588 !
589 !!
590 !* call gloopb ( grid_gr,
591  call gloopb (grid_fld, g3d_fld, sfc_fld,
592  & flx_fld, aoi_fld, nst_fld,
593  & lats_nodes_r, global_lats_r, lonsperlar,
594  & phydt, phyhour, sfalb, xlon,
595  & swh, swhc, hlw, hlwc,
596 ! & nbdsw, nbdlw, HTRSWB, HTRLWB, !idea add by hmhj
597  & hprime, slag, sdec, cdec,
598  & ozplin, jindx1, jindx2, ddy,
599  & h2oplin, jindx1_h, jindx2_h, ddy_h,
600  & phy_f3d, phy_f2d, phy_fctd, nctp,
601  & xlat, nblck, kdt, restart_step,
602  & mdl_parm)
603 !
604 !!
605  endif ! if (comp_task) then
606 
607 !jw endif !.NOT.LIOPE.or.icolor.ne.2
608 !--------------------------------------------
609 !
610 ! write(0,*)'in do one phys step, lsout=',lsout,'kdt=',kdt,
611 ! & 'nszer=',nszer,'ldfi=',ldfi,'ndfi=',ndfi,
612 ! & 'fhour=',fhour,'zhour=',zhour,'zhour_dfin=',zhour_dfin,
613 ! & 'zhour_dfi=',zhour_dfi
614 
615  if (lsout .and. kdt /= 0 ) then
616 !WY bug fix.
617 !-----------
618  IF(.NOT. ALLOCATED(sl)) ALLOCATE(sl(levs))
619  IF(.NOT. ALLOCATED(si)) ALLOCATE(si(levs + 1))
620  CALL wrtout_physics(phyhour,fhour,zhour,idate,
621  & sl,si,
622  & sfc_fld, flx_fld, nst_fld, g2d_fld,
623  & fluxr,
624  & global_lats_r,lonsperlar,nblck,
625 ! & lats_nodes_r,global_lats_r,lonsperlar,nblck,
626  & colat1,cfhour1,pl_coeff,
627  & 'SFC.F','NST.F','FLX.F','D3D.F')
628 !
629  endif ! if ls_out
630 !
631 ! A/O/I coupling - fluxes accumulated at every atm time step for coupling
632 ! Xingren Wu
633 !
634  if (cplflx) then ! for NUOPC coupling
635  delt_cpl = deltim
636  call aoicpl_prep(deltim,delt_cpl,phyhour,fhour,idate,
637  & aoi_fld,global_lats_r,lonsperlar)
638  endif ! if cplflx
639 !
640  IF (kdt > 0 .and. mod(kdt,nsres) == 0) THEN
641 ! write(0,*)'wrt_restart_physics,kdt=',kdt,'nsres=',nsres
642  CALL wrtout_restart_physics(sfc_fld, nst_fld, fhour,idate,
643  & lats_nodes_r,global_lats_r,lonsperlar,
644  & phy_f3d, phy_f2d, ngptc, nblck, ens_nam)
645  endif
646 !
647  IF (mod(kdt,nszer) == 0 .and. lsout.and.kdt /= 0) THEN
648  call flx_init(flx_fld,ierr)
649  if(ldfi .and. kdt_dif == ndfi/2) then
650  zhour_dfi = zhour
651  zhour_dfin = fhour
652  endif
653  zhour = fhour
654 !$omp parallel do private(n,i,j)
655  do j=1,lats_node_r
656  do i=1,lonr
657  do n=1,nfxr
658  fluxr(n,i,j) = 0.0
659  enddo
660  enddo
661  enddo
662 !
663  if (ldiag3d) then
664 ! if(me==0) print *, 'LU_CLDCOV: zero out d3d fields'
665  call d3d_zero
666 
667 ! if ( gfs_phy_tracer%doing_GOCART ) then
668 ! call g2d_zerout(gfs_phy_tracer, g2d_fld)
669 ! endif
670 
671  endif
672 !
673  if ( lgocart ) then
674  call g2d_zerout(g2d_fld,ierr)
675  endif
676 
677  ENDIF
678 !
679  if(ldfi .and. kdt_dif == ndfi) then
680  zhour = zhour_dfi
681  endif
682 ! print *,'in phys one,kdt=',kdt,'zhour=',zhour, &
683 ! & 'zhour_dfi=',zhour_dfi,'zhour_dfin=',zhour_dfin
684 
685  if(ndfi > 0 .and. kdt_dif == ndfi .and. ldfi ) then
686  ldfi = .false.
687  endif
688 !
689  RETURN
690  END
691 
692  subroutine do_physics_gridcheck(grid_gr,g_pnt,km,
693  & global_lats_r,lonsperlar,chr)
694  use machine
695  use resol_def
696  use layout1
697 
698  real(kind=kind_grid) grid_gr(lonr*lats_node_r_max,lotgr)
699  integer,intent(in):: global_lats_r(latr),g_pnt,km
700  integer,intent(in):: lonsperlar(latr)
701  character*(*) chr
702 
703  integer lan,lat,lons_lat,k
704 
705  do lan=1,lats_node_r
706  lat = global_lats_r(ipt_lats_node_r-1+lan)
707  lons_lat = lonsperlar(lat)
708  do k=1,km
709  call mymaxmin(grid_gr(1,g_pnt+k-1),lons_lat,lonr,1,chr)
710  enddo
711  enddo
712 
713  return
714  end subroutine do_physics_gridcheck
subroutine do_physics_one_step(deltim, kdt, PHOUR,
subroutine gloopr(grid_fld, g3d_fld, aoi_fld,
subroutine gloopr invokes the physcis driver&#39;s call to the radiation portion of the physics through t...
Definition: gloopr.f:16
subroutine do_physics_gridcheck(grid_gr, g_pnt, km,
DDT for non-changing model parameters - set once in initialize.
subroutine gloopb(grid_fld, g3d_fld, sfc_fld,
Definition: gloopb.f:15
the interface between the dynamic core and the physics packages