43 real(RP),
private :: OCEAN_DYN_SLAB_HeatCapacity
45 logical,
private :: OCEAN_DYN_SLAB_nudging = .false.
46 real(DP),
private :: OCEAN_DYN_SLAB_nudging_tausec
47 logical,
private :: OCEAN_DYN_SLAB_offline_mode = .false.
66 real(rp),
intent(in) :: depth
68 real(dp) :: ocean_dyn_slab_nudging_tau = 0.0_dp
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
79 logical :: ocean_dyn_slab_nudging_check_coordinates = .true.
80 integer :: ocean_dyn_slab_nudging_step_limit = 0
83 real(rp) :: ocean_dyn_slab_depth = -1.0_rp
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, &
106 log_info(
"OCEAN_DYN_SLAB_setup",*)
'Setup'
108 ocean_dyn_slab_nudging_defval = undef
112 read(
io_fid_conf,nml=param_ocean_dyn_slab,iostat=ierr)
114 log_info(
"OCEAN_DYN_SLAB_setup",*)
'Not found namelist. Default used.'
115 elseif( ierr > 0 )
then
116 log_error(
"OCEAN_DYN_SLAB_setup",*)
'Not appropriate names in namelist PARAM_OCEAN_DYN_SLAB. Check!'
119 log_nml(param_ocean_dyn_slab)
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"'
126 ocean_dyn_slab_heatcapacity = dwatr *
cv_water * depth
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
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 )
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
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.'
143 if ( ocean_dyn_slab_nudging_basename ==
'' )
then
144 log_error(
"OCEAN_DYN_SLAB_setup",*)
'OCEAN_DYN_SLAB_nudging_basename is necessary !!'
148 log_info(
"OCEAN_DYN_SLAB_setup",*)
'Use nudging for SST : OFF'
151 if ( ocean_dyn_slab_nudging )
then
153 ocean_dyn_slab_nudging_basename_add_num, &
154 ocean_dyn_slab_nudging_number_of_files, &
157 ocean_dyn_slab_nudging_enable_periodic_year, &
158 ocean_dyn_slab_nudging_enable_periodic_month, &
159 ocean_dyn_slab_nudging_enable_periodic_day, &
160 ocean_dyn_slab_nudging_step_fixed, &
161 ocean_dyn_slab_nudging_offset, &
162 ocean_dyn_slab_nudging_defval, &
163 check_coordinates = ocean_dyn_slab_nudging_check_coordinates, &
164 step_limit = ocean_dyn_slab_nudging_step_limit, &
165 allow_missing = ( .not. ocean_dyn_slab_offline_mode ) )
190 file_external_input_update
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)
199 real(rp),
intent(in) :: ocean_sflx_g (oia,oja)
200 real(rp),
intent(in) :: ocean_sflx_water(oia,oja)
201 logical,
intent(in) :: calc_flag (oia,oja)
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)
208 real(rp) :: ocean_temp_t_ndg(okmax,oia,oja)
209 real(rp) :: ocean_temp_ref (okmax,oia,oja)
217 log_progress(*)
'ocean / dynamics / slab'
219 if ( ocean_dyn_slab_nudging )
then
221 call file_external_input_update(
'OCEAN_TEMP', nowdaysec, ocean_temp_ref(:,:,:), error )
225 log_error(
"OCEAN_DYN_SLAB",*)
'Requested data is not found!'
229 if ( .not. ocean_dyn_slab_offline_mode )
then
232 rtau = 1.0_rp / max(ocean_dyn_slab_nudging_tausec,dt)
238 if ( ocean_temp_ref(k,i,j) == undef )
then
239 ocean_temp_t_ndg(k,i,j) = 0.0_rp
241 ocean_temp_t_ndg(k,i,j) = ( ocean_temp_ref(k,i,j) - ocean_temp(k,i,j) ) * rtau
254 ocean_temp_t_ndg(k,i,j) = 0.0_rp
260 if ( ocean_dyn_slab_offline_mode )
then
265 if ( calc_flag(i,j) )
then
266 ocean_temp(oks,i,j) = ocean_temp_ref(oks,i,j)
268 mass_supl(i,j) = 0.0_rp
269 engi_supl(i,j) = 0.0_rp
278 if ( calc_flag(i,j) )
then
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
286 ocean_temp(k,i,j) = ocean_temp(k,i,j) + ocean_temp_t_ndg(k,i,j) * dt
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)
291 mass_supl(i,j) = 0.0_rp
292 engi_supl(i,j) = 0.0_rp