SCALE-RM
Functions/Subroutines
scale_ocean_dyn_slab Module Reference

module ocean / dynamics / slab More...

Functions/Subroutines

subroutine, public ocean_dyn_slab_setup (DEPTH)
 Setup. More...
 
subroutine, public ocean_dyn_slab (OKMAX, OKS, OKE, OIA, OIS, OIE, OJA, OJS, OJE, OCEAN_TEMP_t, OCEAN_SFLX_G, OCEAN_SFLX_water, calc_flag, dt, NOWDAYSEC, OCEAN_TEMP, MASS_SUPL, ENGI_SUPL)
 Slab ocean model. More...
 

Detailed Description

module ocean / dynamics / slab

Description
ocean slab model
Author
Team SCALE
NAMELIST
  • PARAM_OCEAN_DYN_SLAB
    nametypedefault valuecomment
    OCEAN_DYN_SLAB_NUDGING logical .false. SST Nudging is used?
    OCEAN_DYN_SLAB_NUDGING_TAU real(DP) 0.0_DP Relaxation time
    OCEAN_DYN_SLAB_NUDGING_TAU_UNIT character(len=H_SHORT) "SEC"
    OCEAN_DYN_SLAB_NUDGING_BASENAME character(len=H_LONG) ''
    OCEAN_DYN_SLAB_NUDGING_BASENAME_ADD_NUM logical .false.
    OCEAN_DYN_SLAB_NUDGING_NUMBER_OF_FILES integer 1
    OCEAN_DYN_SLAB_NUDGING_ENABLE_PERIODIC_YEAR logical .false.
    OCEAN_DYN_SLAB_NUDGING_ENABLE_PERIODIC_MONTH logical .false.
    OCEAN_DYN_SLAB_NUDGING_ENABLE_PERIODIC_DAY logical .false.
    OCEAN_DYN_SLAB_NUDGING_STEP_FIXED integer 0
    OCEAN_DYN_SLAB_NUDGING_DEFVAL real(RP) = UNDEF
    OCEAN_DYN_SLAB_NUDGING_CHECK_COORDINATES logical .true.
    OCEAN_DYN_SLAB_NUDGING_STEP_LIMIT integer 0
    OCEAN_DYN_SLAB_DEPTH real(RP) -1.0_RP

History Output
No history output

Function/Subroutine Documentation

◆ ocean_dyn_slab_setup()

subroutine, public scale_ocean_dyn_slab::ocean_dyn_slab_setup ( real(rp), intent(in)  DEPTH)

Setup.

Definition at line 54 of file scale_ocean_dyn_slab.F90.

54  use scale_prc, only: &
55  prc_abort
56  use scale_const, only: &
57  undef => const_undef, &
58  dwatr => const_dwatr
59  use scale_atmos_hydrometeor, only: &
60  cv_water
61  use scale_calendar, only: &
63  use scale_file_external_input, only: &
64  file_external_input_regist
65  implicit none
66  real(RP), intent(in) :: DEPTH
67 
68  real(DP) :: OCEAN_DYN_SLAB_nudging_tau = 0.0_dp ! Relaxation time
69  character(len=H_SHORT) :: OCEAN_DYN_SLAB_nudging_tau_unit = "SEC"
70  character(len=H_LONG) :: OCEAN_DYN_SLAB_nudging_basename = ''
71  logical :: OCEAN_DYN_SLAB_nudging_basename_add_num = .false.
72  integer :: OCEAN_DYN_SLAB_nudging_number_of_files = 1
73  logical :: OCEAN_DYN_SLAB_nudging_enable_periodic_year = .false.
74  logical :: OCEAN_DYN_SLAB_nudging_enable_periodic_month = .false.
75  logical :: OCEAN_DYN_SLAB_nudging_enable_periodic_day = .false.
76  integer :: OCEAN_DYN_SLAB_nudging_step_fixed = 0
77  real(RP) :: OCEAN_DYN_SLAB_nudging_defval ! = UNDEF
78  logical :: OCEAN_DYN_SLAB_nudging_check_coordinates = .true.
79  integer :: OCEAN_DYN_SLAB_nudging_step_limit = 0
80 
81  ! obsolete
82  real(RP) :: OCEAN_DYN_SLAB_DEPTH = -1.0_rp
83 
84  namelist / param_ocean_dyn_slab / &
85  ocean_dyn_slab_nudging, &
86  ocean_dyn_slab_nudging_tau, &
87  ocean_dyn_slab_nudging_tau_unit, &
88  ocean_dyn_slab_nudging_basename, &
89  ocean_dyn_slab_nudging_basename_add_num, &
90  ocean_dyn_slab_nudging_number_of_files, &
91  ocean_dyn_slab_nudging_enable_periodic_year, &
92  ocean_dyn_slab_nudging_enable_periodic_month, &
93  ocean_dyn_slab_nudging_enable_periodic_day, &
94  ocean_dyn_slab_nudging_step_fixed, &
95  ocean_dyn_slab_nudging_defval, &
96  ocean_dyn_slab_nudging_check_coordinates, &
97  ocean_dyn_slab_nudging_step_limit, &
98  ocean_dyn_slab_depth
99 
100  integer :: ierr
101  !---------------------------------------------------------------------------
102 
103  log_newline
104  log_info("OCEAN_DYN_SLAB_setup",*) 'Setup'
105 
106  ocean_dyn_slab_nudging_defval = undef
107 
108  !--- read namelist
109  rewind(io_fid_conf)
110  read(io_fid_conf,nml=param_ocean_dyn_slab,iostat=ierr)
111  if( ierr < 0 ) then !--- missing
112  log_info("OCEAN_DYN_SLAB_setup",*) 'Not found namelist. Default used.'
113  elseif( ierr > 0 ) then !--- fatal error
114  log_error("OCEAN_DYN_SLAB_setup",*) 'Not appropriate names in namelist PARAM_OCEAN_DYN_SLAB. Check!'
115  call prc_abort
116  endif
117  log_nml(param_ocean_dyn_slab)
118 
119  if ( ocean_dyn_slab_depth >= 0.0 ) then
120  log_error("OCEAN_DYN_SLAB_setup",*) '"OCEAN_DYN_SLAB_DEPTH" is obsolete. USE "ODZ" of "PARAM_OCEAN_GRID_CARTESC"'
121  call prc_abort
122  end if
123 
124  ocean_dyn_slab_heatcapacity = dwatr * cv_water * depth
125 
126  log_newline
127  log_info("OCEAN_DYN_SLAB_setup",*) 'Slab ocean depth [m] : ', depth
128  log_info("OCEAN_DYN_SLAB_setup",*) 'Ocean heat capacity [J/K/m2] : ', ocean_dyn_slab_heatcapacity
129 
130  if ( ocean_dyn_slab_nudging ) then
131  call calendar_unit2sec( ocean_dyn_slab_nudging_tausec, ocean_dyn_slab_nudging_tau, ocean_dyn_slab_nudging_tau_unit )
132 
133  log_info("OCEAN_DYN_SLAB_setup",*) 'Use nudging for SST : ON'
134  log_info("OCEAN_DYN_SLAB_setup",*) 'Relaxation time Tau [sec] : ', ocean_dyn_slab_nudging_tausec
135 
136  if ( ocean_dyn_slab_nudging_tausec == 0.0_rp ) then
137  ocean_dyn_slab_offline_mode = .true.
138  log_info("OCEAN_DYN_SLAB_setup",*) 'Tau=0 means that SST is completely replaced by the external data.'
139  endif
140 
141  if ( ocean_dyn_slab_nudging_basename == '' ) then
142  log_error("OCEAN_DYN_SLAB_setup",*) 'OCEAN_DYN_SLAB_nudging_basename is necessary !!'
143  call prc_abort
144  endif
145  else
146  log_info("OCEAN_DYN_SLAB_setup",*) 'Use nudging for SST : OFF'
147  endif
148 
149  if ( ocean_dyn_slab_nudging ) then
150  call file_external_input_regist( ocean_dyn_slab_nudging_basename, & ! [IN]
151  ocean_dyn_slab_nudging_basename_add_num, & ! [IN]
152  ocean_dyn_slab_nudging_number_of_files, & ! [IN]
153  'OCEAN_TEMP', & ! [IN]
154  'OXY', & ! [IN]
155  ocean_dyn_slab_nudging_enable_periodic_year, & ! [IN]
156  ocean_dyn_slab_nudging_enable_periodic_month, & ! [IN]
157  ocean_dyn_slab_nudging_enable_periodic_day, & ! [IN]
158  ocean_dyn_slab_nudging_step_fixed, & ! [IN]
159  ocean_dyn_slab_nudging_defval, & ! [IN]
160  check_coordinates = ocean_dyn_slab_nudging_check_coordinates, & ! [IN]
161  step_limit = ocean_dyn_slab_nudging_step_limit, & ! [IN]
162  allow_missing = ( .not. ocean_dyn_slab_offline_mode ) ) ! [IN]
163  endif
164 
165  return

References scale_calendar::calendar_unit2sec(), scale_const::const_dwatr, scale_const::const_undef, scale_atmos_hydrometeor::cv_water, scale_io::io_fid_conf, and scale_prc::prc_abort().

Referenced by mod_ocean_driver::ocean_driver_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ocean_dyn_slab()

subroutine, public scale_ocean_dyn_slab::ocean_dyn_slab ( integer, intent(in)  OKMAX,
integer, intent(in)  OKS,
integer, intent(in)  OKE,
integer, intent(in)  OIA,
integer, intent(in)  OIS,
integer, intent(in)  OIE,
integer, intent(in)  OJA,
integer, intent(in)  OJS,
integer, intent(in)  OJE,
real(rp), dimension (okmax,oia,oja), intent(in)  OCEAN_TEMP_t,
real(rp), dimension (oia,oja), intent(in)  OCEAN_SFLX_G,
real(rp), dimension(oia,oja), intent(in)  OCEAN_SFLX_water,
logical, dimension (oia,oja), intent(in)  calc_flag,
real(dp), intent(in)  dt,
real(dp), intent(in)  NOWDAYSEC,
real(rp), dimension (okmax,oia,oja), intent(inout)  OCEAN_TEMP,
real(rp), dimension (oia,oja), intent(out)  MASS_SUPL,
real(rp), dimension (oia,oja), intent(out)  ENGI_SUPL 
)

Slab ocean model.

Definition at line 182 of file scale_ocean_dyn_slab.F90.

182  use scale_prc, only: &
183  prc_abort
184  use scale_const, only: &
185  undef => const_undef
186  use scale_file_external_input, only: &
187  file_external_input_update
188  use scale_atmos_hydrometeor, only: &
189  cv_water
190  implicit none
191 
192  integer, intent(in) :: OKMAX, OKS, OKE
193  integer, intent(in) :: OIA, OIS, OIE
194  integer, intent(in) :: OJA, OJS, OJE
195  real(RP), intent(in) :: OCEAN_TEMP_t (OKMAX,OIA,OJA) ! tendency of ocean temperature
196  real(RP), intent(in) :: OCEAN_SFLX_G (OIA,OJA) ! heat flux from surface to subsurface (open ocean/sea ice)
197  real(RP), intent(in) :: OCEAN_SFLX_water(OIA,OJA) ! mass flux from surface to subsurface (open ocean/sea ice)
198  logical, intent(in) :: calc_flag (OIA,OJA) ! to decide calculate or not
199  real(DP), intent(in) :: dt
200  real(DP), intent(in) :: NOWDAYSEC
201  real(RP), intent(inout) :: OCEAN_TEMP (OKMAX,OIA,OJA)
202  real(RP), intent(out) :: MASS_SUPL (OIA,OJA)
203  real(RP), intent(out) :: ENGI_SUPL (OIA,OJA)
204 
205  real(RP) :: OCEAN_TEMP_t_ndg(OKMAX,OIA,OJA)
206  real(RP) :: OCEAN_TEMP_ref (OKMAX,OIA,OJA)
207  real(RP) :: rtau
208  real(RP) :: dCP
209 
210  logical :: error
211  integer :: k, i, j
212  !---------------------------------------------------------------------------
213  !$acc data copyin (OCEAN_TEMP_t,OCEAN_SFLX_G,OCEAN_SFLX_water,calc_flag) &
214  !$acc copyout(MASS_SUPL,ENGI_SUPL) &
215  !$acc copy(OCEAN_TEMP) &
216  !$acc create (OCEAN_TEMP_t_ndg,OCEAN_TEMP_ref)
217 
218 
219  log_progress(*) 'ocean / dynamics / slab'
220 
221  if ( ocean_dyn_slab_nudging ) then
222 
223  call file_external_input_update( 'OCEAN_TEMP', nowdaysec, ocean_temp_ref(:,:,:), error )
224 
225 
226  if ( error ) then
227  log_error("OCEAN_DYN_SLAB",*) 'Requested data is not found!'
228  call prc_abort
229  endif
230 
231  if ( .not. ocean_dyn_slab_offline_mode ) then
232 
233  ! if OCEAN_DYN_SLAB_nudging_tau < dt, Nudging acts as quasi-prescribed boundary
234  rtau = 1.0_rp / max(ocean_dyn_slab_nudging_tausec,dt)
235 
236  !$omp parallel do
237  !$acc kernels
238  do j = ojs, oje
239  do i = ois, oie
240  do k = oks, oke
241  if ( ocean_temp_ref(k,i,j) == undef ) then
242  ocean_temp_t_ndg(k,i,j) = 0.0_rp
243  else
244  ocean_temp_t_ndg(k,i,j) = ( ocean_temp_ref(k,i,j) - ocean_temp(k,i,j) ) * rtau
245  end if
246  enddo
247  enddo
248  enddo
249  !$acc end kernels
250 
251  end if
252 
253  else
254  !$omp parallel do
255  !$acc kernels
256  do j = ojs, oje
257  do i = ois, oie
258  do k = oks, oke
259  ocean_temp_t_ndg(k,i,j) = 0.0_rp
260  end do
261  end do
262  end do
263  !$acc end kernels
264  endif
265 
266  if ( ocean_dyn_slab_offline_mode ) then
267 
268  !$omp parallel do
269  !$acc kernels
270  do j = ojs, oje
271  do i = ois, oie
272  if ( calc_flag(i,j) ) then
273  ocean_temp(oks,i,j) = ocean_temp_ref(oks,i,j)
274  endif
275  mass_supl(i,j) = 0.0_rp
276  engi_supl(i,j) = 0.0_rp
277  enddo
278  enddo
279  !$acc end kernels
280 
281  else
282 
283  !$omp parallel do private(dCP)
284  !$acc kernels
285  do j = ojs, oje
286  do i = ois, oie
287  if ( calc_flag(i,j) ) then
288  ! heat flux from atm/ice at uppermost ocean layer
289  dcp = cv_water * ocean_sflx_water(i,j) * dt
290  ocean_temp(oks,i,j) = ocean_temp(oks,i,j) &
291  + ( ocean_sflx_g(i,j) * dt - dcp * ocean_temp(oks,i,j) ) &
292  / ( ocean_dyn_slab_heatcapacity + dcp ) &
293  + ocean_temp_t_ndg(oks,i,j) * dt
294  do k = oks+1, oke
295  ocean_temp(k,i,j) = ocean_temp(k,i,j) + ocean_temp_t_ndg(k,i,j) * dt
296  enddo
297  mass_supl(i,j) = - ocean_sflx_water(i,j)
298  engi_supl(i,j) = cv_water * mass_supl(i,j) * ocean_temp(oks,i,j)
299  else
300  mass_supl(i,j) = 0.0_rp
301  engi_supl(i,j) = 0.0_rp
302  endif
303  enddo
304  enddo
305  !$acc end kernels
306 
307  endif
308  !$acc end data
309 
310  return

References scale_const::const_undef, scale_atmos_hydrometeor::cv_water, and scale_prc::prc_abort().

Referenced by mod_ocean_driver::ocean_driver_update().

Here is the call graph for this function:
Here is the caller graph for this function:
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:350
scale_atmos_hydrometeor
module atmosphere / hydrometeor
Definition: scale_atmos_hydrometeor.F90:12
scale_calendar
module CALENDAR
Definition: scale_calendar.F90:13
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_const
module CONSTANT
Definition: scale_const.F90:11
scale_const::const_dwatr
real(rp), parameter, public const_dwatr
density of water [kg/m3]
Definition: scale_const.F90:89
scale_file_external_input
module file / external_input
Definition: scale_file_external_input.F90:12
scale_const::const_undef
real(rp), public const_undef
Definition: scale_const.F90:43
scale_atmos_hydrometeor::cv_water
real(rp), public cv_water
CV for water [J/kg/K].
Definition: scale_atmos_hydrometeor.F90:151
scale_calendar::calendar_unit2sec
subroutine, public calendar_unit2sec(second, value, unit)
Convert several units to second.
Definition: scale_calendar.F90:486