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_OFFSET real(RP) 0.0_RP
    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: &
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_offset = 0.0_rp
78  real(RP) :: OCEAN_DYN_SLAB_nudging_defval ! = UNDEF
79  logical :: OCEAN_DYN_SLAB_nudging_check_coordinates = .true.
80  integer :: OCEAN_DYN_SLAB_nudging_step_limit = 0
81 
82  ! obsolete
83  real(RP) :: OCEAN_DYN_SLAB_DEPTH = -1.0_rp
84 
85  namelist / param_ocean_dyn_slab / &
86  ocean_dyn_slab_nudging, &
87  ocean_dyn_slab_nudging_tau, &
88  ocean_dyn_slab_nudging_tau_unit, &
89  ocean_dyn_slab_nudging_basename, &
90  ocean_dyn_slab_nudging_basename_add_num, &
91  ocean_dyn_slab_nudging_number_of_files, &
92  ocean_dyn_slab_nudging_enable_periodic_year, &
93  ocean_dyn_slab_nudging_enable_periodic_month, &
94  ocean_dyn_slab_nudging_enable_periodic_day, &
95  ocean_dyn_slab_nudging_step_fixed, &
96  ocean_dyn_slab_nudging_offset, &
97  ocean_dyn_slab_nudging_defval, &
98  ocean_dyn_slab_nudging_check_coordinates, &
99  ocean_dyn_slab_nudging_step_limit, &
100  ocean_dyn_slab_depth
101 
102  integer :: ierr
103  !---------------------------------------------------------------------------
104 
105  log_newline
106  log_info("OCEAN_DYN_SLAB_setup",*) 'Setup'
107 
108  ocean_dyn_slab_nudging_defval = undef
109 
110  !--- read namelist
111  rewind(io_fid_conf)
112  read(io_fid_conf,nml=param_ocean_dyn_slab,iostat=ierr)
113  if( ierr < 0 ) then !--- missing
114  log_info("OCEAN_DYN_SLAB_setup",*) 'Not found namelist. Default used.'
115  elseif( ierr > 0 ) then !--- fatal error
116  log_error("OCEAN_DYN_SLAB_setup",*) 'Not appropriate names in namelist PARAM_OCEAN_DYN_SLAB. Check!'
117  call prc_abort
118  endif
119  log_nml(param_ocean_dyn_slab)
120 
121  if ( ocean_dyn_slab_depth >= 0.0 ) then
122  log_error("OCEAN_DYN_SLAB_setup",*) '"OCEAN_DYN_SLAB_DEPTH" is obsolete. USE "ODZ" of "PARAM_OCEAN_GRID_CARTESC"'
123  call prc_abort
124  end if
125 
126  ocean_dyn_slab_heatcapacity = dwatr * cv_water * depth
127 
128  log_newline
129  log_info("OCEAN_DYN_SLAB_setup",*) 'Slab ocean depth [m] : ', depth
130  log_info("OCEAN_DYN_SLAB_setup",*) 'Ocean heat capacity [J/K/m2] : ', ocean_dyn_slab_heatcapacity
131 
132  if ( ocean_dyn_slab_nudging ) then
133  call calendar_unit2sec( ocean_dyn_slab_nudging_tausec, ocean_dyn_slab_nudging_tau, ocean_dyn_slab_nudging_tau_unit )
134 
135  log_info("OCEAN_DYN_SLAB_setup",*) 'Use nudging for SST : ON'
136  log_info("OCEAN_DYN_SLAB_setup",*) 'Relaxation time Tau [sec] : ', ocean_dyn_slab_nudging_tausec
137 
138  if ( ocean_dyn_slab_nudging_tausec == 0.0_rp ) then
139  ocean_dyn_slab_offline_mode = .true.
140  log_info("OCEAN_DYN_SLAB_setup",*) 'Tau=0 means that SST is completely replaced by the external data.'
141  endif
142 
143  if ( ocean_dyn_slab_nudging_basename == '' ) then
144  log_error("OCEAN_DYN_SLAB_setup",*) 'OCEAN_DYN_SLAB_nudging_basename is necessary !!'
145  call prc_abort
146  endif
147  else
148  log_info("OCEAN_DYN_SLAB_setup",*) 'Use nudging for SST : OFF'
149  endif
150 
151  if ( ocean_dyn_slab_nudging ) then
152  call file_external_input_regist( ocean_dyn_slab_nudging_basename, & ! [IN]
153  ocean_dyn_slab_nudging_basename_add_num, & ! [IN]
154  ocean_dyn_slab_nudging_number_of_files, & ! [IN]
155  'OCEAN_TEMP', & ! [IN]
156  'OXY', & ! [IN]
157  ocean_dyn_slab_nudging_enable_periodic_year, & ! [IN]
158  ocean_dyn_slab_nudging_enable_periodic_month, & ! [IN]
159  ocean_dyn_slab_nudging_enable_periodic_day, & ! [IN]
160  ocean_dyn_slab_nudging_step_fixed, & ! [IN]
161  ocean_dyn_slab_nudging_offset, & ! [IN]
162  ocean_dyn_slab_nudging_defval, & ! [IN]
163  check_coordinates = ocean_dyn_slab_nudging_check_coordinates, & ! [IN]
164  step_limit = ocean_dyn_slab_nudging_step_limit, & ! [IN]
165  allow_missing = ( .not. ocean_dyn_slab_offline_mode ) ) ! [IN]
166  endif
167 
168  return

References scale_calendar::calendar_unit2sec(), scale_const::const_dwatr, scale_const::const_undef, scale_atmos_hydrometeor::cv_water, scale_file_external_input::file_external_input_regist(), 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 185 of file scale_ocean_dyn_slab.F90.

185  use scale_prc, only: &
186  prc_abort
187  use scale_const, only: &
188  undef => const_undef
189  use scale_file_external_input, only: &
190  file_external_input_update
191  use scale_atmos_hydrometeor, only: &
192  cv_water
193  implicit none
194 
195  integer, intent(in) :: OKMAX, OKS, OKE
196  integer, intent(in) :: OIA, OIS, OIE
197  integer, intent(in) :: OJA, OJS, OJE
198  real(RP), intent(in) :: OCEAN_TEMP_t (OKMAX,OIA,OJA) ! tendency of ocean temperature
199  real(RP), intent(in) :: OCEAN_SFLX_G (OIA,OJA) ! heat flux from surface to subsurface (open ocean/sea ice)
200  real(RP), intent(in) :: OCEAN_SFLX_water(OIA,OJA) ! mass flux from surface to subsurface (open ocean/sea ice)
201  logical, intent(in) :: calc_flag (OIA,OJA) ! to decide calculate or not
202  real(DP), intent(in) :: dt
203  real(DP), intent(in) :: NOWDAYSEC
204  real(RP), intent(inout) :: OCEAN_TEMP (OKMAX,OIA,OJA)
205  real(RP), intent(out) :: MASS_SUPL (OIA,OJA)
206  real(RP), intent(out) :: ENGI_SUPL (OIA,OJA)
207 
208  real(RP) :: OCEAN_TEMP_t_ndg(OKMAX,OIA,OJA)
209  real(RP) :: OCEAN_TEMP_ref (OKMAX,OIA,OJA)
210  real(RP) :: rtau
211  real(RP) :: dCP
212 
213  logical :: error
214  integer :: k, i, j
215  !---------------------------------------------------------------------------
216 
217  log_progress(*) 'ocean / dynamics / slab'
218 
219  if ( ocean_dyn_slab_nudging ) then
220 
221  call file_external_input_update( 'OCEAN_TEMP', nowdaysec, ocean_temp_ref(:,:,:), error )
222 
223 
224  if ( error ) then
225  log_error("OCEAN_DYN_SLAB",*) 'Requested data is not found!'
226  call prc_abort
227  endif
228 
229  if ( .not. ocean_dyn_slab_offline_mode ) then
230 
231  ! if OCEAN_DYN_SLAB_nudging_tau < dt, Nudging acts as quasi-prescribed boundary
232  rtau = 1.0_rp / max(ocean_dyn_slab_nudging_tausec,dt)
233 
234  !$omp parallel do
235  do j = ojs, oje
236  do i = ois, oie
237  do k = oks, oke
238  if ( ocean_temp_ref(k,i,j) == undef ) then
239  ocean_temp_t_ndg(k,i,j) = 0.0_rp
240  else
241  ocean_temp_t_ndg(k,i,j) = ( ocean_temp_ref(k,i,j) - ocean_temp(k,i,j) ) * rtau
242  end if
243  enddo
244  enddo
245  enddo
246 
247  end if
248 
249  else
250  !$omp parallel do
251  do j = ojs, oje
252  do i = ois, oie
253  do k = oks, oke
254  ocean_temp_t_ndg(k,i,j) = 0.0_rp
255  end do
256  end do
257  end do
258  endif
259 
260  if ( ocean_dyn_slab_offline_mode ) then
261 
262  !$omp parallel do
263  do j = ojs, oje
264  do i = ois, oie
265  if ( calc_flag(i,j) ) then
266  ocean_temp(oks,i,j) = ocean_temp_ref(oks,i,j)
267  endif
268  mass_supl(i,j) = 0.0_rp
269  engi_supl(i,j) = 0.0_rp
270  enddo
271  enddo
272 
273  else
274 
275  !$omp parallel do private(dCP)
276  do j = ojs, oje
277  do i = ois, oie
278  if ( calc_flag(i,j) ) then
279  ! heat flux from atm/ice at uppermost ocean layer
280  dcp = cv_water * ocean_sflx_water(i,j) * dt
281  ocean_temp(oks,i,j) = ocean_temp(oks,i,j) &
282  + ( ocean_sflx_g(i,j) * dt - dcp * ocean_temp(oks,i,j) ) &
283  / ( ocean_dyn_slab_heatcapacity + dcp ) &
284  + ocean_temp_t_ndg(oks,i,j) * dt
285  do k = oks+1, oke
286  ocean_temp(k,i,j) = ocean_temp(k,i,j) + ocean_temp_t_ndg(k,i,j) * dt
287  enddo
288  mass_supl(i,j) = - ocean_sflx_water(i,j)
289  engi_supl(i,j) = cv_water * mass_supl(i,j) * ocean_temp(oks,i,j)
290  else
291  mass_supl(i,j) = 0.0_rp
292  engi_supl(i,j) = 0.0_rp
293  endif
294  enddo
295  enddo
296 
297  endif
298 
299  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:342
scale_file_external_input::file_external_input_regist
subroutine, public file_external_input_regist(basename, basename_add_num, number_of_files, varname, axistype, enable_periodic_year, enable_periodic_month, enable_periodic_day, step_fixed, offset, defval, check_coordinates, aggregate, allow_missing, step_limit, exist)
Regist data.
Definition: scale_file_external_input.F90:324
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_file_external_input
module file / external_input
Definition: scale_file_external_input.F90:12
scale_atmos_hydrometeor::cv_water
real(rp), public cv_water
CV for water [J/kg/K].
Definition: scale_atmos_hydrometeor.F90:132
scale_calendar::calendar_unit2sec
subroutine, public calendar_unit2sec(second, value, unit)
Convert several units to second.
Definition: scale_calendar.F90:424