SCALE-RM
mod_ocean_vars.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
10 !-------------------------------------------------------------------------------
12  !-----------------------------------------------------------------------------
13  !
14  !++ used modules
15  !
16  use scale_precision
17  use scale_stdio
18  use scale_prof
19  use scale_debug
21 
22  use scale_const, only: &
23  i_sw => const_i_sw, &
24  i_lw => const_i_lw
25  !-----------------------------------------------------------------------------
26  implicit none
27  private
28  !-----------------------------------------------------------------------------
29  !
30  !++ Public procedure
31  !
32  public :: ocean_vars_setup
33  public :: ocean_vars_restart_read
34  public :: ocean_vars_restart_write
35  public :: ocean_vars_history
36  public :: ocean_vars_total
37  public :: ocean_vars_external_in
38 
39  !-----------------------------------------------------------------------------
40  !
41  !++ Public parameters & variables
42  !
43  logical, public :: ocean_restart_output = .false.
44 
45  character(len=H_LONG), public :: ocean_restart_in_basename = ''
46  character(len=H_LONG), public :: ocean_restart_out_basename = ''
47  character(len=H_MID), public :: ocean_restart_out_title = 'OCEAN restart'
48  character(len=H_MID), public :: ocean_restart_out_dtype = 'DEFAULT'
49 
50  ! prognostic variables
51  real(RP), public, allocatable :: ocean_temp (:,:)
52  real(RP), public, allocatable :: ocean_sfc_temp (:,:)
53  real(RP), public, allocatable :: ocean_sfc_albedo(:,:,:)
54  real(RP), public, allocatable :: ocean_sfc_z0m (:,:)
55  real(RP), public, allocatable :: ocean_sfc_z0h (:,:)
56  real(RP), public, allocatable :: ocean_sfc_z0e (:,:)
57 
58  ! tendency variables
59  real(RP), public, allocatable :: ocean_temp_t (:,:)
60  real(RP), public, allocatable :: ocean_sfc_temp_t (:,:)
61  real(RP), public, allocatable :: ocean_sfc_albedo_t(:,:,:)
62  real(RP), public, allocatable :: ocean_sfc_z0m_t (:,:)
63  real(RP), public, allocatable :: ocean_sfc_z0h_t (:,:)
64  real(RP), public, allocatable :: ocean_sfc_z0e_t (:,:)
65 
66  ! surface variables for restart
67  real(RP), public, allocatable :: ocean_sflx_mw (:,:)
68  real(RP), public, allocatable :: ocean_sflx_mu (:,:)
69  real(RP), public, allocatable :: ocean_sflx_mv (:,:)
70  real(RP), public, allocatable :: ocean_sflx_sh (:,:)
71  real(RP), public, allocatable :: ocean_sflx_lh (:,:)
72  real(RP), public, allocatable :: ocean_sflx_wh (:,:)
73  real(RP), public, allocatable :: ocean_sflx_evap(:,:)
74 
75  ! diagnostic variables
76  real(RP), public, allocatable :: ocean_u10(:,:)
77  real(RP), public, allocatable :: ocean_v10(:,:)
78  real(RP), public, allocatable :: ocean_t2 (:,:)
79  real(RP), public, allocatable :: ocean_q2 (:,:)
80 
81  ! recieved atmospheric variables
82  real(RP), public, allocatable :: atmos_temp (:,:)
83  real(RP), public, allocatable :: atmos_pres (:,:)
84  real(RP), public, allocatable :: atmos_w (:,:)
85  real(RP), public, allocatable :: atmos_u (:,:)
86  real(RP), public, allocatable :: atmos_v (:,:)
87  real(RP), public, allocatable :: atmos_dens (:,:)
88  real(RP), public, allocatable :: atmos_qv (:,:)
89  real(RP), public, allocatable :: atmos_pbl (:,:)
90  real(RP), public, allocatable :: atmos_sfc_pres (:,:)
91  real(RP), public, allocatable :: atmos_sflx_lw (:,:)
92  real(RP), public, allocatable :: atmos_sflx_sw (:,:)
93  real(RP), public, allocatable :: atmos_cossza (:,:)
94  real(RP), public, allocatable :: atmos_sflx_prec(:,:)
95 
96  !-----------------------------------------------------------------------------
97  !
98  !++ Private procedure
99  !
100  !-----------------------------------------------------------------------------
101  !
102  !++ Private parameters & variables
103  !
104  logical, private :: ocean_vars_checkrange = .false.
105 
106  integer, private, parameter :: vmax = 14
107  integer, private, parameter :: i_temp = 1
108  integer, private, parameter :: i_sfc_temp = 2
109  integer, private, parameter :: i_alb_lw = 3
110  integer, private, parameter :: i_alb_sw = 4
111  integer, private, parameter :: i_sfc_z0m = 5
112  integer, private, parameter :: i_sfc_z0h = 6
113  integer, private, parameter :: i_sfc_z0e = 7
114  integer, private, parameter :: i_sflx_mw = 8
115  integer, private, parameter :: i_sflx_mu = 9
116  integer, private, parameter :: i_sflx_mv = 10
117  integer, private, parameter :: i_sflx_sh = 11
118  integer, private, parameter :: i_sflx_lh = 12
119  integer, private, parameter :: i_sflx_wh = 13
120  integer, private, parameter :: i_sflx_evap = 14
121 
122  character(len=H_SHORT), private :: var_name(vmax)
123  character(len=H_MID), private :: var_desc(vmax)
124  character(len=H_SHORT), private :: var_unit(vmax)
125 
126  data var_name / 'OCEAN_TEMP', &
127  'OCEAN_SFC_TEMP', &
128  'OCEAN_ALB_LW', &
129  'OCEAN_ALB_SW', &
130  'OCEAN_SFC_Z0M', &
131  'OCEAN_SFC_Z0H', &
132  'OCEAN_SFC_Z0E', &
133  'OCEAN_SFLX_MW', &
134  'OCEAN_SFLX_MU', &
135  'OCEAN_SFLX_MV', &
136  'OCEAN_SFLX_SH', &
137  'OCEAN_SFLX_LH', &
138  'OCEAN_SFLX_WH', &
139  'OCEAN_SFLX_evap' /
140  data var_desc / 'temperature at uppermost ocean layer', &
141  'ocean surface skin temperature', &
142  'ocean surface albedo (longwave)', &
143  'ocean surface albedo (shortwave)', &
144  'ocean surface roughness length (momentum)', &
145  'ocean surface roughness length (heat)', &
146  'ocean surface roughness length (vapor)', &
147  'ocean surface w-momentum flux', &
148  'ocean surface u-momentum flux', &
149  'ocean surface v-momentum flux', &
150  'ocean surface sensible heat flux', &
151  'ocean surface latent heat flux', &
152  'ocean surface water heat flux', &
153  'ocean surface water vapor flux' /
154  data var_unit / 'K', &
155  'K', &
156  '0-1', &
157  '0-1', &
158  'm', &
159  'm', &
160  'm', &
161  'kg/m2/s', &
162  'kg/m2/s', &
163  'kg/m2/s', &
164  'J/m2/s', &
165  'J/m2/s', &
166  'J/m2/s', &
167  'kg/m2/s' /
168 
169  !-----------------------------------------------------------------------------
170 contains
171  !-----------------------------------------------------------------------------
173  subroutine ocean_vars_setup
174  use scale_process, only: &
176  use scale_const, only: &
177  undef => const_undef
178  implicit none
179 
180  namelist / param_ocean_vars / &
185  ocean_vars_checkrange
186 
187  integer :: ierr
188  integer :: iv
189  !---------------------------------------------------------------------------
190 
191  if( io_l ) write(io_fid_log,*)
192  if( io_l ) write(io_fid_log,*) '++++++ Module[VARS] / Categ[OCEAN] / Origin[SCALE-RM]'
193 
194  allocate( ocean_temp(ia,ja) )
195  allocate( ocean_sfc_temp(ia,ja) )
196  allocate( ocean_sfc_albedo(ia,ja,2) )
197  allocate( ocean_sfc_z0m(ia,ja) )
198  allocate( ocean_sfc_z0h(ia,ja) )
199  allocate( ocean_sfc_z0e(ia,ja) )
200  ocean_temp(:,:) = undef
201  ocean_sfc_temp(:,:) = undef
202  ocean_sfc_albedo(:,:,:) = undef
203  ocean_sfc_z0m(:,:) = undef
204  ocean_sfc_z0h(:,:) = undef
205  ocean_sfc_z0e(:,:) = undef
206 
207  allocate( ocean_temp_t(ia,ja) )
208  allocate( ocean_sfc_temp_t(ia,ja) )
209  allocate( ocean_sfc_albedo_t(ia,ja,2) )
210  allocate( ocean_sfc_z0m_t(ia,ja) )
211  allocate( ocean_sfc_z0h_t(ia,ja) )
212  allocate( ocean_sfc_z0e_t(ia,ja) )
213  ocean_temp_t(:,:) = undef
214  ocean_sfc_temp_t(:,:) = undef
215  ocean_sfc_albedo_t(:,:,:) = undef
216  ocean_sfc_z0m_t(:,:) = undef
217  ocean_sfc_z0h_t(:,:) = undef
218  ocean_sfc_z0e_t(:,:) = undef
219 
220  allocate( ocean_sflx_mw(ia,ja) )
221  allocate( ocean_sflx_mu(ia,ja) )
222  allocate( ocean_sflx_mv(ia,ja) )
223  allocate( ocean_sflx_sh(ia,ja) )
224  allocate( ocean_sflx_lh(ia,ja) )
225  allocate( ocean_sflx_wh(ia,ja) )
226  allocate( ocean_sflx_evap(ia,ja) )
227  ocean_sflx_mw(:,:) = undef
228  ocean_sflx_mu(:,:) = undef
229  ocean_sflx_mv(:,:) = undef
230  ocean_sflx_sh(:,:) = undef
231  ocean_sflx_lh(:,:) = undef
232  ocean_sflx_wh(:,:) = undef
233  ocean_sflx_evap(:,:) = undef
234 
235  allocate( ocean_u10(ia,ja) )
236  allocate( ocean_v10(ia,ja) )
237  allocate( ocean_t2(ia,ja) )
238  allocate( ocean_q2(ia,ja) )
239  ocean_u10(:,:) = undef
240  ocean_v10(:,:) = undef
241  ocean_t2(:,:) = undef
242  ocean_q2(:,:) = undef
243 
244  allocate( atmos_temp(ia,ja) )
245  allocate( atmos_pres(ia,ja) )
246  allocate( atmos_w(ia,ja) )
247  allocate( atmos_u(ia,ja) )
248  allocate( atmos_v(ia,ja) )
249  allocate( atmos_dens(ia,ja) )
250  allocate( atmos_qv(ia,ja) )
251  allocate( atmos_pbl(ia,ja) )
252  allocate( atmos_sfc_pres(ia,ja) )
253  allocate( atmos_sflx_lw(ia,ja) )
254  allocate( atmos_sflx_sw(ia,ja) )
255  allocate( atmos_cossza(ia,ja) )
256  allocate( atmos_sflx_prec(ia,ja) )
257  atmos_temp(:,:) = undef
258  atmos_pres(:,:) = undef
259  atmos_w(:,:) = undef
260  atmos_u(:,:) = undef
261  atmos_v(:,:) = undef
262  atmos_dens(:,:) = undef
263  atmos_qv(:,:) = undef
264  atmos_pbl(:,:) = undef
265  atmos_sfc_pres(:,:) = undef
266  atmos_sflx_lw(:,:) = undef
267  atmos_sflx_sw(:,:) = undef
268  atmos_cossza(:,:) = undef
269  atmos_sflx_prec(:,:) = undef
270 
271  !--- read namelist
272  rewind(io_fid_conf)
273  read(io_fid_conf,nml=param_ocean_vars,iostat=ierr)
274  if( ierr < 0 ) then !--- missing
275  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
276  elseif( ierr > 0 ) then !--- fatal error
277  write(*,*) 'xxx Not appropriate names in namelist PARAM_OCEAN_VARS. Check!'
278  call prc_mpistop
279  endif
280  if( io_lnml ) write(io_fid_log,nml=param_ocean_vars)
281 
282  if( io_l ) write(io_fid_log,*)
283  if( io_l ) write(io_fid_log,*) '*** List of prognostic variables (OCEAN) ***'
284  if( io_l ) write(io_fid_log,'(1x,A,A15,A,A32,3(A))') &
285  '*** |','VARNAME ','|', 'DESCRIPTION ','[', 'UNIT ',']'
286  do iv = 1, vmax
287  if( io_l ) write(io_fid_log,'(1x,A,i3,A,A15,A,A32,3(A))') &
288  '*** NO.',iv,'|',var_name(iv),'|',var_desc(iv),'[',var_unit(iv),']'
289 
290  enddo
291 
292  if( io_l ) write(io_fid_log,*)
293  if ( ocean_restart_in_basename /= '' ) then
294  if( io_l ) write(io_fid_log,*) '*** Restart input? : ', trim(ocean_restart_in_basename)
295  else
296  if( io_l ) write(io_fid_log,*) '*** Restart input? : NO'
297  endif
298  if ( ocean_restart_output &
299  .AND. ocean_restart_out_basename /= '' ) then
300  if( io_l ) write(io_fid_log,*) '*** Restart output? : ', trim(ocean_restart_out_basename)
301  else
302  if( io_l ) write(io_fid_log,*) '*** Restart output? : NO'
303  ocean_restart_output = .false.
304  endif
305 
306  return
307  end subroutine ocean_vars_setup
308 
309  !-----------------------------------------------------------------------------
311  subroutine ocean_vars_restart_read
312  use scale_fileio, only: &
313  fileio_read
314  use mod_ocean_admin, only: &
315  ocean_sw
316  implicit none
317  !---------------------------------------------------------------------------
318 
319  if( io_l ) write(io_fid_log,*)
320  if( io_l ) write(io_fid_log,*) '*** Input restart file (OCEAN) ***'
321 
322  if ( ocean_sw .and. ocean_restart_in_basename /= '' ) then
323  if( io_l ) write(io_fid_log,*) '*** basename: ', trim(ocean_restart_in_basename)
324 
325  call fileio_read( ocean_temp(:,:), & ! [OUT]
326  ocean_restart_in_basename, var_name(i_temp), 'XY', step=1 ) ! [IN]
327  call fileio_read( ocean_sfc_temp(:,:), & ! [OUT]
328  ocean_restart_in_basename, var_name(i_sfc_temp), 'XY', step=1 ) ! [IN]
329  call fileio_read( ocean_sfc_albedo(:,:,i_lw), & ! [OUT]
330  ocean_restart_in_basename, var_name(i_alb_lw), 'XY', step=1 ) ! [IN]
331  call fileio_read( ocean_sfc_albedo(:,:,i_sw), & ! [OUT]
332  ocean_restart_in_basename, var_name(i_alb_sw), 'XY', step=1 ) ! [IN]
333  call fileio_read( ocean_sfc_z0m(:,:), & ! [OUT]
334  ocean_restart_in_basename, var_name(i_sfc_z0m), 'XY', step=1 ) ! [IN]
335  call fileio_read( ocean_sfc_z0h(:,:), & ! [OUT]
336  ocean_restart_in_basename, var_name(i_sfc_z0h), 'XY', step=1 ) ! [IN]
337  call fileio_read( ocean_sfc_z0e(:,:), & ! [OUT]
338  ocean_restart_in_basename, var_name(i_sfc_z0e), 'XY', step=1 ) ! [IN]
339 
340  call fileio_read( ocean_sflx_mw(:,:), & ! [OUT]
341  ocean_restart_in_basename, var_name(i_sflx_mw), 'XY', step=1 ) ! [IN]
342  call fileio_read( ocean_sflx_mu(:,:), & ! [OUT]
343  ocean_restart_in_basename, var_name(i_sflx_mu), 'XY', step=1 ) ! [IN]
344  call fileio_read( ocean_sflx_mv(:,:), & ! [OUT]
345  ocean_restart_in_basename, var_name(i_sflx_mv), 'XY', step=1 ) ! [IN]
346  call fileio_read( ocean_sflx_sh(:,:), & ! [OUT]
347  ocean_restart_in_basename, var_name(i_sflx_sh), 'XY', step=1 ) ! [IN]
348  call fileio_read( ocean_sflx_lh(:,:), & ! [OUT]
349  ocean_restart_in_basename, var_name(i_sflx_lh), 'XY', step=1 ) ! [IN]
350  call fileio_read( ocean_sflx_wh(:,:), & ! [OUT]
351  ocean_restart_in_basename, var_name(i_sflx_wh), 'XY', step=1 ) ! [IN]
352  call fileio_read( ocean_sflx_evap(:,:), & ! [OUT]
353  ocean_restart_in_basename, var_name(i_sflx_evap), 'XY', step=1 ) ! [IN]
354 
355  call ocean_vars_total
356  else
357  if( io_l ) write(io_fid_log,*) '*** restart file for ocean is not specified.'
358  endif
359 
360  return
361  end subroutine ocean_vars_restart_read
362 
363  !-----------------------------------------------------------------------------
365  subroutine ocean_vars_restart_write
366  use scale_time, only: &
368  use scale_fileio, only: &
369  fileio_write
370  use mod_ocean_admin, only: &
371  ocean_sw
372  implicit none
373 
374  character(len=20) :: timelabel
375  character(len=H_LONG) :: basename
376  !---------------------------------------------------------------------------
377 
378  if ( ocean_sw .and. ocean_restart_out_basename /= '' ) then
379 
380  call time_gettimelabel( timelabel )
381  write(basename,'(A,A,A)') trim(ocean_restart_out_basename), '_', trim(timelabel)
382 
383  if( io_l ) write(io_fid_log,*)
384  if( io_l ) write(io_fid_log,*) '*** Output restart file (OCEAN) ***'
385  if( io_l ) write(io_fid_log,*) '*** basename: ', trim(basename)
386 
387  call ocean_vars_total
388 
389  call fileio_write( ocean_temp(:,:), basename, ocean_restart_out_title, & ! [IN]
390  var_name(i_temp), var_desc(i_temp), var_unit(i_temp), & ! [IN]
391  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
392  call fileio_write( ocean_sfc_temp(:,:), basename, ocean_restart_out_title, & ! [IN]
393  var_name(i_sfc_temp), var_desc(i_sfc_temp), var_unit(i_sfc_temp), & ! [IN]
394  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
395  call fileio_write( ocean_sfc_albedo(:,:,i_lw), basename, ocean_restart_out_title, & ! [IN]
396  var_name(i_alb_lw), var_desc(i_alb_lw), var_unit(i_alb_lw), & ! [IN]
397  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
398  call fileio_write( ocean_sfc_albedo(:,:,i_sw), basename, ocean_restart_out_title, & ! [IN]
399  var_name(i_alb_sw), var_desc(i_alb_sw), var_unit(i_alb_sw), & ! [IN]
400  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
401  call fileio_write( ocean_sfc_z0m(:,:), basename, ocean_restart_out_title, & ! [IN]
402  var_name(i_sfc_z0m), var_desc(i_sfc_z0m), var_unit(i_sfc_z0m), & ! [IN]
403  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
404  call fileio_write( ocean_sfc_z0h(:,:), basename, ocean_restart_out_title, & ! [IN]
405  var_name(i_sfc_z0h), var_desc(i_sfc_z0h), var_unit(i_sfc_z0h), & ! [IN]
406  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
407  call fileio_write( ocean_sfc_z0e(:,:), basename, ocean_restart_out_title, & ! [IN]
408  var_name(i_sfc_z0e), var_desc(i_sfc_z0e), var_unit(i_sfc_z0e), & ! [IN]
409  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
410  call fileio_write( ocean_sflx_mw(:,:), basename, ocean_restart_out_title, & ! [IN]
411  var_name(i_sflx_mw), var_desc(i_sflx_mw), var_unit(i_sflx_mw), & ! [IN]
412  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
413  call fileio_write( ocean_sflx_mu(:,:), basename, ocean_restart_out_title, & ! [IN]
414  var_name(i_sflx_mu), var_desc(i_sflx_mu), var_unit(i_sflx_mu), & ! [IN]
415  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
416  call fileio_write( ocean_sflx_mv(:,:), basename, ocean_restart_out_title, & ! [IN]
417  var_name(i_sflx_mv), var_desc(i_sflx_mv), var_unit(i_sflx_mv), & ! [IN]
418  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
419  call fileio_write( ocean_sflx_sh(:,:), basename, ocean_restart_out_title, & ! [IN]
420  var_name(i_sflx_sh), var_desc(i_sflx_sh), var_unit(i_sflx_sh), & ! [IN]
421  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
422  call fileio_write( ocean_sflx_lh(:,:), basename, ocean_restart_out_title, & ! [IN]
423  var_name(i_sflx_lh), var_desc(i_sflx_lh), var_unit(i_sflx_lh), & ! [IN]
424  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
425  call fileio_write( ocean_sflx_wh(:,:), basename, ocean_restart_out_title, & ! [IN]
426  var_name(i_sflx_wh), var_desc(i_sflx_wh), var_unit(i_sflx_wh), & ! [IN]
427  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
428  call fileio_write( ocean_sflx_evap(:,:), basename, ocean_restart_out_title, & ! [IN]
429  var_name(i_sflx_evap), var_desc(i_sflx_evap), var_unit(i_sflx_evap), & ! [IN]
430  'XY', ocean_restart_out_dtype, nohalo=.true. ) ! [IN]
431 
432  endif
433 
434  return
435  end subroutine ocean_vars_restart_write
436 
437  !-----------------------------------------------------------------------------
439  subroutine ocean_vars_history
440  use scale_history, only: &
441  hist_in
442  implicit none
443  !---------------------------------------------------------------------------
444 
445  if ( ocean_vars_checkrange ) then
446  call valcheck( ocean_temp(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_temp), &
447  __file__, __line__ )
448  call valcheck( ocean_sfc_temp(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_sfc_temp), &
449  __file__, __line__ )
450  call valcheck( ocean_sfc_albedo(is:ie,js:je,i_lw), 0.0_rp, 2.0_rp, var_name(i_alb_lw), &
451  __file__, __line__ )
452  call valcheck( ocean_sfc_albedo(is:ie,js:je,i_sw), 0.0_rp, 2.0_rp, var_name(i_alb_sw), &
453  __file__, __line__ )
454  call valcheck( ocean_sfc_z0m(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_sfc_z0m), &
455  __file__, __line__ )
456  call valcheck( ocean_sfc_z0h(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_sfc_z0h), &
457  __file__, __line__ )
458  call valcheck( ocean_sfc_z0e(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_sfc_z0e), &
459  __file__, __line__ )
460  endif
461 
462  call hist_in( ocean_temp(:,:), var_name(i_temp), var_desc(i_temp), var_unit(i_temp) )
463  call hist_in( ocean_sfc_temp(:,:), var_name(i_sfc_temp), var_desc(i_sfc_temp), var_unit(i_sfc_temp) )
464  call hist_in( ocean_sfc_albedo(:,:,i_lw), var_name(i_alb_lw), var_desc(i_alb_lw), var_unit(i_alb_lw) )
465  call hist_in( ocean_sfc_albedo(:,:,i_sw), var_name(i_alb_sw), var_desc(i_alb_sw), var_unit(i_alb_sw) )
466  call hist_in( ocean_sfc_z0m(:,:), var_name(i_sfc_z0m), var_desc(i_sfc_z0m), var_unit(i_sfc_z0m) )
467  call hist_in( ocean_sfc_z0h(:,:), var_name(i_sfc_z0h), var_desc(i_sfc_z0h), var_unit(i_sfc_z0h) )
468  call hist_in( ocean_sfc_z0e(:,:), var_name(i_sfc_z0e), var_desc(i_sfc_z0e), var_unit(i_sfc_z0e) )
469 
470  call hist_in( ocean_sflx_mw(:,:), var_name(i_sflx_mw), var_desc(i_sflx_mw), var_unit(i_sflx_mw) )
471  call hist_in( ocean_sflx_mu(:,:), var_name(i_sflx_mu), var_desc(i_sflx_mu), var_unit(i_sflx_mu) )
472  call hist_in( ocean_sflx_mv(:,:), var_name(i_sflx_mv), var_desc(i_sflx_mv), var_unit(i_sflx_mv) )
473  call hist_in( ocean_sflx_sh(:,:), var_name(i_sflx_sh), var_desc(i_sflx_sh), var_unit(i_sflx_sh) )
474  call hist_in( ocean_sflx_lh(:,:), var_name(i_sflx_lh), var_desc(i_sflx_lh), var_unit(i_sflx_lh) )
475  call hist_in( ocean_sflx_wh(:,:), var_name(i_sflx_wh), var_desc(i_sflx_wh), var_unit(i_sflx_wh) )
476  call hist_in( ocean_sflx_evap(:,:), var_name(i_sflx_evap), var_desc(i_sflx_evap), var_unit(i_sflx_evap) )
477 
478  return
479  end subroutine ocean_vars_history
480 
481  !-----------------------------------------------------------------------------
483  subroutine ocean_vars_total
484  use scale_rm_statistics, only: &
486  stat_total
487  implicit none
488 
489  real(RP) :: total
490  !---------------------------------------------------------------------------
491 
492  if ( statistics_checktotal ) then
493 
494  call stat_total( total, ocean_temp(:,:), var_name(i_temp) )
495  call stat_total( total, ocean_sfc_temp(:,:), var_name(i_sfc_temp) )
496  call stat_total( total, ocean_sfc_albedo(:,:,i_lw), var_name(i_alb_lw) )
497  call stat_total( total, ocean_sfc_albedo(:,:,i_sw), var_name(i_alb_sw) )
498  call stat_total( total, ocean_sfc_z0m(:,:), var_name(i_sfc_z0m) )
499  call stat_total( total, ocean_sfc_z0h(:,:), var_name(i_sfc_z0h) )
500  call stat_total( total, ocean_sfc_z0e(:,:), var_name(i_sfc_z0e) )
501 
502  call stat_total( total, ocean_sflx_mw(:,:), var_name(i_sflx_mw) )
503  call stat_total( total, ocean_sflx_mu(:,:), var_name(i_sflx_mu) )
504  call stat_total( total, ocean_sflx_mv(:,:), var_name(i_sflx_mv) )
505  call stat_total( total, ocean_sflx_sh(:,:), var_name(i_sflx_sh) )
506  call stat_total( total, ocean_sflx_lh(:,:), var_name(i_sflx_lh) )
507  call stat_total( total, ocean_sflx_wh(:,:), var_name(i_sflx_wh) )
508  call stat_total( total, ocean_sflx_evap(:,:), var_name(i_sflx_evap) )
509 
510  endif
511 
512  return
513  end subroutine ocean_vars_total
514 
515  !-----------------------------------------------------------------------------
517  subroutine ocean_vars_external_in( &
518  OCEAN_TEMP_in, &
519  OCEAN_SFC_TEMP_in, &
520  OCEAN_SFC_albedo_in, &
521  OCEAN_SFC_Z0M_in, &
522  OCEAN_SFC_Z0H_in, &
523  OCEAN_SFC_Z0E_in )
524  implicit none
525 
526  real(RP), intent(in) :: OCEAN_TEMP_in (ia,ja)
527  real(RP), intent(in) :: OCEAN_SFC_TEMP_in (ia,ja)
528  real(RP), intent(in) :: OCEAN_SFC_albedo_in(ia,ja,2)
529  real(RP), intent(in) :: OCEAN_SFC_Z0M_in (ia,ja)
530  real(RP), intent(in) :: OCEAN_SFC_Z0H_in (ia,ja)
531  real(RP), intent(in) :: OCEAN_SFC_Z0E_in (ia,ja)
532  !---------------------------------------------------------------------------
533 
534  if( io_l ) write(io_fid_log,*)
535  if( io_l ) write(io_fid_log,*) '*** External Input file (ocean) ***'
536 
537  ocean_temp(:,:) = ocean_temp_in(:,:)
538  ocean_sfc_temp(:,:) = ocean_sfc_temp_in(:,:)
539  ocean_sfc_albedo(:,:,:) = ocean_sfc_albedo_in(:,:,:)
540  ocean_sfc_z0m(:,:) = ocean_sfc_z0m_in(:,:)
541  ocean_sfc_z0h(:,:) = ocean_sfc_z0h_in(:,:)
542  ocean_sfc_z0e(:,:) = ocean_sfc_z0e_in(:,:)
543 
544  ocean_sflx_mw(:,:) = 0.0_rp
545  ocean_sflx_mu(:,:) = 0.0_rp
546  ocean_sflx_mv(:,:) = 0.0_rp
547  ocean_sflx_sh(:,:) = 0.0_rp
548  ocean_sflx_lh(:,:) = 0.0_rp
549  ocean_sflx_wh(:,:) = 0.0_rp
550  ocean_sflx_evap(:,:) = 0.0_rp
551 
552  call ocean_vars_total
553 
554  return
555  end subroutine ocean_vars_external_in
556 
557 end module mod_ocean_vars
character(len=h_mid), public ocean_restart_out_dtype
REAL4 or REAL8.
real(rp), dimension(:,:), allocatable, public ocean_v10
ocean surface velocity v at 10m [m/s]
integer, public is
start point of inner domain: x, local
module DEBUG
Definition: scale_debug.F90:13
logical, public ocean_sw
real(rp), dimension(:,:), allocatable, public atmos_w
logical, public statistics_checktotal
calc&report variable totals to logfile?
real(rp), dimension(:,:), allocatable, public ocean_sfc_temp_t
tendency of OCEAN_SFC_TEMP
integer, public je
end point of inner domain: y, local
real(rp), dimension(:,:), allocatable, public ocean_sfc_z0e_t
tendency of OCEAN_SFC_Z0E
real(rp), dimension(:,:,:), allocatable, public ocean_sfc_albedo
ocean surface albedo [0-1]
real(rp), dimension(:,:), allocatable, public atmos_dens
integer, public const_i_lw
long-wave radiation index
Definition: scale_const.F90:98
subroutine, public prc_mpistop
Abort MPI.
real(rp), dimension(:,:,:), allocatable, public ocean_sfc_albedo_t
tendency of OCEAN_SFC_alebdo
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:59
real(rp), dimension(:,:), allocatable, public ocean_sfc_z0e
ocean surface roughness length for vapor [m]
real(rp), dimension(:,:), allocatable, public ocean_temp
temperature at uppermost ocean layer [K]
subroutine, public ocean_vars_restart_write
Write ocean restart.
real(rp), dimension(:,:), allocatable, public atmos_v
subroutine, public ocean_vars_history
History output set for ocean variables.
module STDIO
Definition: scale_stdio.F90:12
real(rp), dimension(:,:), allocatable, public ocean_sflx_wh
ocean surface water heat flux [J/m2/s]
real(rp), dimension(:,:), allocatable, public atmos_sflx_lw
module FILE I/O (netcdf)
real(rp), dimension(:,:), allocatable, public ocean_temp_t
tendency of OCEAN_TEMP
real(rp), public const_undef
Definition: scale_const.F90:43
module Statistics
module grid index
real(rp), dimension(:,:), allocatable, public atmos_cossza
integer, public ia
of x whole cells (local, with HALO)
real(rp), dimension(:,:), allocatable, public ocean_sflx_mv
ocean surface v-momentum flux [kg/m2/s]
subroutine, public time_gettimelabel(timelabel)
generate time label
Definition: scale_time.F90:90
real(rp), dimension(:,:), allocatable, public atmos_sfc_pres
real(rp), dimension(:,:), allocatable, public atmos_qv
subroutine, public ocean_vars_total
Budget monitor for ocean.
real(rp), dimension(:,:), allocatable, public ocean_sfc_z0h_t
tendency of OCEAN_SFC_Z0H
integer, public js
start point of inner domain: y, local
module TIME
Definition: scale_time.F90:15
module PROCESS
real(rp), dimension(:,:), allocatable, public atmos_sflx_prec
module Ocean admin
subroutine, public ocean_vars_external_in(OCEAN_TEMP_in, OCEAN_SFC_TEMP_in, OCEAN_SFC_albedo_in, OCEAN_SFC_Z0M_in, OCEAN_SFC_Z0H_in, OCEAN_SFC_Z0E_in)
Input from External I/O.
real(rp), dimension(:,:), allocatable, public atmos_temp
subroutine, public ocean_vars_restart_read
Read ocean restart.
real(rp), dimension(:,:), allocatable, public ocean_sflx_mw
ocean surface w-momentum flux [kg/m2/s]
module CONSTANT
Definition: scale_const.F90:14
real(rp), dimension(:,:), allocatable, public ocean_sflx_mu
ocean surface u-momentum flux [kg/m2/s]
real(rp), dimension(:,:), allocatable, public ocean_q2
ocean surface water vapor at 2m [kg/kg]
real(rp), dimension(:,:), allocatable, public atmos_u
module profiler
Definition: scale_prof.F90:10
integer, public ie
end point of inner domain: x, local
real(rp), dimension(:,:), allocatable, public atmos_sflx_sw
real(rp), dimension(:,:), allocatable, public ocean_sfc_z0m
ocean surface roughness length for momentum [m]
real(rp), dimension(:,:), allocatable, public atmos_pbl
logical, public io_lnml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:60
integer, public const_i_sw
short-wave radiation index
Definition: scale_const.F90:99
module PRECISION
subroutine, public ocean_vars_setup
Setup.
real(rp), dimension(:,:), allocatable, public ocean_sflx_sh
ocean surface sensible heat flux [J/m2/s]
character(len=h_long), public ocean_restart_in_basename
basename of the input file
module HISTORY
real(rp), dimension(:,:), allocatable, public ocean_sfc_temp
ocean surface skin temperature [K]
character(len=h_long), public ocean_restart_out_basename
basename of the output file
integer, public io_fid_conf
Config file ID.
Definition: scale_stdio.F90:55
real(rp), dimension(:,:), allocatable, public ocean_sfc_z0m_t
tendency of OCEAN_SFC_Z0M
logical, public ocean_restart_output
output restart file?
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
real(rp), dimension(:,:), allocatable, public atmos_pres
real(rp), dimension(:,:), allocatable, public ocean_sflx_lh
ocean surface latent heat flux [J/m2/s]
real(rp), dimension(:,:), allocatable, public ocean_u10
ocean surface velocity u at 10m [m/s]
real(rp), dimension(:,:), allocatable, public ocean_sflx_evap
ocean surface water vapor flux [kg/m2/s]
real(rp), dimension(:,:), allocatable, public ocean_sfc_z0h
ocean surface roughness length for heat [m]
real(rp), dimension(:,:), allocatable, public ocean_t2
ocean surface temperature at 2m [K]
module OCEAN Variables
character(len=h_mid), public ocean_restart_out_title
title of the output file
integer, public ja
of y whole cells (local, with HALO)