FE-Project
Loading...
Searching...
No Matches
mod_ocean_component.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Oceanic component
3!!
4!! @par Description
5!! Oceanic component module
6!!
7!! @author Yuta Kawai, Team SCALE
8!!
9!<
10!-------------------------------------------------------------------------------
11#include "scaleFElib.h"
13 !-----------------------------------------------------------------------------
14 !
15 !++ used modules
16 !
17 use scale_precision
18 use scale_io
19 use scale_prof
20 use scale_prc
21
22 use scale_element_base, only: &
24 use scale_mesh_base, only: meshbase
29 use scale_localmeshfield_base, only: &
33
34 use mod_ocean_mesh, only: oceanmesh
37
39
40 use mod_ocean_vars, only: &
41 oceanvars, &
43 sfc_temp_id => auxvar2d_sfc_temp_id, &
44 atm_sfc_dens_id => atmvar2d_sfc_dens_id, &
45 atm_sfc_pres_id => atmvar2d_sfc_pres_id, &
46 atm_temp_id => atmvar2d_atm_temp_id, &
47 atm_dens_id => atmvar2d_atm_dens_id, &
48 atm_pres_id => atmvar2d_atm_pres_id, &
49 atm_w_id => atmvar2d_atm_w_id, &
50 atm_u_id => atmvar2d_atm_u_id, &
51 atm_v_id => atmvar2d_atm_v_id, &
52 atm_qv_id => atmvar2d_atm_qv_id, &
53 sflx_rd_sw_dir_id => atmvar2d_sflx_rd_sw_dir_id, &
54 sflx_rd_lw_dif_id => atmvar2d_sflx_rd_lw_dif_id, &
56
57
58 use mod_ocean_dyn, only: oceandyn
59
60 !-----------------------------------------------------------------------------
61 implicit none
62 private
63 !-----------------------------------------------------------------------------
64 !
65 !++ Public type & procedure
66 !
67
68 !> Derived type to manage oceanic component
69 type, extends(modelcomponent), public :: oceancomponent
70 type(oceanvars) :: vars !< Object to mange variables with oceanic component
71
72 character(len=H_SHORT) :: mesh_type !< Type name of mesh oceanic component
73 class(oceanmesh), pointer :: mesh !< Pointer of mesh oceanic component
74 type(oceanmeshrm) :: mesh_rm !< Object to manage mesh for the case of regional mode
75 type(oceanmeshgm) :: mesh_gm !< Object to manage mesh for the case of global mode
76
77 type(oceandyn) :: dyn_proc !< Object to manage dynamical process
78
79 type(couplercomponent), pointer :: coupler_ptr !< Pointer of coupler component
80 contains
81 procedure, public :: setup => ocean_setup
82 procedure, public :: setup_vars => ocean_setup_vars
83 procedure, public :: set_coupler => ocean_set_coupler
84 procedure, public :: calc_tendency => ocean_calc_tendency
85 procedure, public :: update => ocean_update
86 procedure, public :: set_surface => ocean_set_surface
87 procedure, public :: get_surface => ocean_get_surface
88 procedure, public :: finalize => ocean_finalize
89 end type oceancomponent
90
91 !-----------------------------------------------------------------------------
92 !
93 !++ Public parameters & variables
94 !
95 !-----------------------------------------------------------------------------
96 !
97 !++ Private procedure
98 !
99 !-----------------------------------------------------------------------------
100 !
101 !++ Private parameters & variables
102 !
103 !-----------------------------------------------------------------------------
104contains
105
106 !> Setup an object to mange oceanic component
107!OCL SERIAL
108 subroutine ocean_setup( this )
109 use scale_const, only: &
110 undef8 => const_undef8
111
114 use scale_time_manager, only: &
116
117 implicit none
118
119 class(oceancomponent), intent(inout), target :: this
120
121 logical :: ACTIVATE_FLAG = .false. !< Flag whether oceanic component is activated
122
123 real(DP) :: TIME_DT = undef8 !< Timestep value of oceanic component
124 character(len=H_SHORT) :: TIME_DT_UNIT = 'SEC' !< Timestep unit of oceanic component
125 real(DP) :: TIME_DT_RESTART = undef8 !< Timestep value when outputting restart file for oceanic component
126 character(len=H_SHORT) :: TIME_DT_RESTART_UNIT = 'SEC' !< Timestep unit when outputting restart file for oceanic component
127
128 logical :: OCEAN_DYN_DO = .true. !< Flag whether dynamics process is considered
129 character(len=H_SHORT) :: OCEAN_MESH_TYPE = 'REGIONAL' !< Name of mesh type for oceanic component ('REGIONAL' or 'GLOBAL')
130
131
132 namelist / param_ocean / &
133 activate_flag, &
134 time_dt, &
135 time_dt_unit, &
136 time_dt_restart, &
137 time_dt_restart_unit, &
138 ocean_mesh_type, &
139 ocean_dyn_do
140
141 integer :: ierr
142 !--------------------------------------------------
143
144 log_info('OceanComponent_setup',*) 'Oceanic model components '
145
146 !--- read namelist
147 rewind(io_fid_conf)
148 read(io_fid_conf,nml=param_ocean,iostat=ierr)
149 if( ierr < 0 ) then !--- missing
150 log_info("Ocean_setup",*) 'Not found namelist. Default used.'
151 elseif( ierr > 0 ) then !--- fatal error
152 log_error("Ocean_setup",*) 'Not appropriate names in namelist PARAM_OCEAN. Check!'
153 call prc_abort
154 endif
155 log_nml(param_ocean)
156
157 !************************************************
158 call this%ModelComponent_Init('OCEAN', activate_flag )
159
160 if ( .not. activate_flag ) return
161
162 call prof_rapstart( 'Ocean_setup', 1)
163
164 !- Setup time manager
165
166 call this%time_manager%Init( this%GetComponentName(), &
167 time_dt, time_dt_unit, &
168 time_dt_restart, time_dt_restart_unit )
169
170 call time_manager_regist_component( this%time_manager )
171
172 !- Setup mesh & file I/O for oceanic component
173
174 this%mesh_type = ocean_mesh_type
175 select case( this%mesh_type )
176 case('REGIONAL')
177 call this%mesh_rm%Init()
178 call file_history_meshfield_setup( mesh3d_=this%mesh_rm%mesh, & ! (in)
179 dim_name_postfix_='_O', & ! (in)
180 registered_comp_id=this%vars%hist_comp_id ) ! (out)
181 this%mesh => this%mesh_rm
182 case('GLOBAL')
183 call this%mesh_gm%Init()
184 call file_history_meshfield_setup( meshcubedsphere3d_=this%mesh_gm%mesh, & ! (in)
185 dim_name_postfix_='_O', & ! (in)
186 registered_comp_id=this%vars%hist_comp_id ) ! (out)
187 this%mesh => this%mesh_gm
188 case default
189 log_error("Ocean_setup",*) 'Unsupported type of mesh is specified. Check!', this%mesh_type
190 call prc_abort
191 end select
192
193 !- setup common tools for oceanic model
194
195 !- Setup each processes in ocean model ------------------------------------
196
197 !- Setup the module for ocean / dynamics
198 call this%dyn_proc%ModelComponentProc_Init( 'OceanDyn', ocean_dyn_do )
199 call this%dyn_proc%setup( this%mesh, this%time_manager )
200
201 !- Setup
202
203 log_newline
204 log_info('OceanComponent_setup',*) 'Finish setup of each oceanic component.'
205
206 call prof_rapend( 'Ocean_setup', 1)
207
208 return
209 end subroutine ocean_setup
210
211 !> Setup variables with the oceanic component
212!OCL SERIAL
213 subroutine ocean_setup_vars( this )
214 implicit none
215 class(oceancomponent), intent(inout) :: this
216 !----------------------------------------------------------
217
218 call prof_rapstart( 'Ocean_setup_vars', 1)
219 call this%vars%Init( this%mesh )
220 call prof_rapend( 'Ocean_setup_vars', 1)
221 return
222 end subroutine ocean_setup_vars
223
224!> Set coupler component to the oceanic component
225!OCL SERIAL
226 subroutine ocean_set_coupler( this, coupler )
227 implicit none
228 class(oceancomponent), intent(inout) :: this
229 class(couplercomponent), target, intent(inout) :: coupler
230 !----------------------------------------------------------
231 this%coupler_ptr => coupler
232 return
233 end subroutine ocean_set_coupler
234
235!> Calculate tendencies with the oceanic component
236!OCL SERIAL
237 subroutine ocean_calc_tendency( this, force )
238 use mod_ocean_vars, only: &
239 alb_vis_dir_id => auxvar2d_sfc_alb_vis_dir_id, &
240 sflx_mw_id => ocn_sflx_mw_id, &
241 sflx_mu_id => ocn_sflx_mu_id, &
242 sflx_mv_id => ocn_sflx_mv_id, &
243 sflx_sh_id => ocn_sflx_sh_id, &
244 sflx_lh_id => ocn_sflx_lh_id, &
245 sflx_qv_id => ocn_sflx_qv_id, &
246 sflx_rd_sw_dir_id => atmvar2d_sflx_rd_sw_dir_id, &
247 sflx_rd_lw_dif_id => atmvar2d_sflx_rd_lw_dif_id, &
248 rhoh_id => phytend_rhoh_id
249 implicit none
250 class(oceancomponent), intent(inout) :: this
251 logical, intent(in) :: force
252
253 class(meshbase3d), pointer :: mesh3D
254 class(localmesh2d), pointer :: lmesh2D
255 class(localmesh3d), pointer :: lmesh3D
256 integer :: idom
257
258 real(RP), allocatable :: SFLX_GH(:,:)
259 !------------------------------------------------------------------
260
261 !- Get surface data from coupler
262 call this%get_surface()
263
264 call prof_rapstart( 'OCN_tendency', 1)
265
266 mesh3d => this%mesh%ptr_mesh
267
268 do idom=1, mesh3d%LOCAL_MESH_NUM
269 lmesh3d => mesh3d%lcmesh_list(idom)
270 lmesh2d => lmesh3d%lcmesh2D
271
272 allocate( sflx_gh(lmesh2d%refElem2D%Np,lmesh2d%Ne) )
273
274 !- Calculate surface fluxes
275
276 call calculate_surface_flux( this, &
277 this%vars%OCN_SFLX(sflx_mw_id)%local(idom)%val, &
278 this%vars%OCN_SFLX(sflx_mu_id)%local(idom)%val, &
279 this%vars%OCN_SFLX(sflx_mv_id)%local(idom)%val, &
280 this%vars%OCN_SFLX(sflx_sh_id)%local(idom)%val, &
281 this%vars%OCN_SFLX(sflx_lh_id)%local(idom)%val, &
282 this%vars%OCN_SFLX(sflx_qv_id)%local(idom)%val, &
283 !-
284 this%vars%AUX_VARS2D(sfc_temp_id)%local(idom)%val, &
285 this%vars%ATM_VARS2D(atm_sfc_dens_id)%local(idom)%val, &
286 this%vars%ATM_VARS2D(atm_sfc_pres_id)%local(idom)%val, &
287 this%vars%ATM_VARS2D(atm_temp_id)%local(idom)%val, &
288 this%vars%ATM_VARS2D(atm_dens_id)%local(idom)%val, &
289 this%vars%ATM_VARS2D(atm_pres_id)%local(idom)%val, &
290 this%vars%ATM_VARS2D(atm_w_id)%local(idom)%val, &
291 this%vars%ATM_VARS2D(atm_u_id)%local(idom)%val, &
292 this%vars%ATM_VARS2D(atm_v_id)%local(idom)%val, &
293 this%vars%ATM_VARS2D(atm_qv_id)%local(idom)%val, &
294 this%vars%ATM_VARS2D(dz_a_id)%local(idom)%val, &
295 lmesh2d, lmesh2d%refElem2D )
296
297 !- Calculate ocean surface heat flux
298
299 call calculate_sfc_heat_flux( sflx_gh, & ! (out)
300 this%vars%AUX_VARS2D(sfc_temp_id)%local(idom)%val, & ! (in)
301 this%vars%ATM_VARS2D(sflx_rd_sw_dir_id)%local(idom)%val, & ! (in)
302 this%vars%ATM_VARS2D(sflx_rd_lw_dif_id)%local(idom)%val, & ! (in)
303 this%vars%AUX_VARS2D(alb_vis_dir_id)%local(idom)%val, & ! (in)
304 this%vars%OCN_SFLX(sflx_sh_id)%local(idom)%val, & ! (in)
305 this%vars%OCN_SFLX(sflx_lh_id)%local(idom)%val, & ! (in)
306 lmesh2d, lmesh2d%refElem2D ) ! (in)
307
308 !- Calculate tendencies with physics
309
310 call calculate_phys_tendency( this%vars%PHY_TEND(rhoh_id)%local(idom)%val, & ! (out)
311 sflx_gh, lmesh3d%zlev, & ! (in)
312 lmesh3d, lmesh3d%refElem3D, lmesh2d, lmesh2d%refElem2D ) ! (in)
313
314 ! write(*,*) "------"
315 ! write(*,*) "SFC_TEMP = ", this%vars%AUX_VARS2D(SFC_TEMP_ID)%local(idom)%val(1,1)
316 ! write(*,*) "SFC_DENS = ", this%vars%ATM_VARS2D(ATM_SFC_DENS_ID)%local(idom)%val(1,1)
317 ! write(*,*) "SFC_PRES = ", this%vars%ATM_VARS2D(ATM_SFC_PRES_ID)%local(idom)%val(1,1)
318 ! write(*,*) "ATM_TEMP = ", this%vars%ATM_VARS2D(ATM_TEMP_ID)%local(idom)%val(1,1)
319 ! write(*,*) "ATM_PRES = ", this%vars%ATM_VARS2D(ATM_PRES_ID)%local(idom)%val(1,1)
320 ! write(*,*) "ATM_QV= ", this%vars%ATM_VARS2D(ATM_QV_ID)%local(idom)%val(1,1)
321 ! write(*,*) "RD_SW_DIR = ", this%vars%ATM_VARS2D(SFLX_RD_SW_DIR_ID)%local(idom)%val(1,1)
322 ! write(*,*) "RD_LW_DIF = ", this%vars%ATM_VARS2D(SFLX_RD_LW_DIF_ID)%local(idom)%val(1,1)
323 ! write(*,*) "ZLEV_A = ", this%vars%ATM_VARS2D(ZLEV_A_ID)%local(idom)%val(1,1)
324 ! write(*,*) "SLFX_MW=", this%vars%OCN_SFLX(SFLX_MW_ID)%local(idom)%val(1,1)
325 ! write(*,*) "SLFX_MU=", this%vars%OCN_SFLX(SFLX_MU_ID)%local(idom)%val(1,1)
326 ! write(*,*) "SLFX_MV=", this%vars%OCN_SFLX(SFLX_MV_ID)%local(idom)%val(1,1)
327 ! write(*,*) "SH=", this%vars%OCN_SFLX(SFLX_SH_ID)%local(idom)%val(1,1)
328 ! write(*,*) "LH=", this%vars%OCN_SFLX(SFLX_LH_ID)%local(idom)%val(1,1)
329 ! write(*,*) 'SFLX_GH = ', SFLX_GH(1,1)
330
331 deallocate( sflx_gh )
332 end do
333
334 call prof_rapend( 'OCN_tendency', 1)
335
336 !-
337 call this%set_surface( countup=.true. )
338
339 return
340 end subroutine ocean_calc_tendency
341
342!> Update variables with the oceanic component
343!OCL SERIAL
344 subroutine ocean_update( this )
345 implicit none
346 class(oceancomponent), intent(inout) :: this
347
348 integer :: tm_process_id
349 logical :: is_update
350 integer :: inner_itr
351
352 integer :: idom
353 class(localmesh2d), pointer :: lmesh2D
354 class(localmesh3d), pointer :: lmesh
355 !--------------------------------------------------
356 call prof_rapstart( 'OCN_update', 1)
357
358 if ( this%dyn_proc%IsActivated() ) then
359 call prof_rapstart('OCN_Dynamics', 1)
360 tm_process_id = this%dyn_proc%tm_process_id
361 is_update = this%time_manager%Do_process( tm_process_id )
362
363 log_progress(*) 'ocean / dynamics'
364 do inner_itr=1, this%time_manager%Get_process_inner_itr_num( tm_process_id )
365 call this%dyn_proc%update( &
366 this%mesh, this%vars%PROGVARS_manager, this%vars%QTRCVARS_manager, &
367 this%vars%AUXVARS_manager, this%vars%PHYTENDS_manager, is_update )
368 end do
369 call prof_rapend('OCN_Dynamics', 1)
370 end if
371
372 !- Set surface temperature
373 do idom=1, this%mesh%ptr_mesh%LOCAL_MESH_NUM
374 lmesh => this%mesh%ptr_mesh%lcmesh_list(idom)
375 lmesh2d => lmesh%lcmesh2D
376 call set_sfctemp_lc( this%vars%AUX_VARS2D(sfc_temp_id)%local(idom)%val, & ! (out)
377 this%vars%PROG_VARS(prgvar_therm_id)%local(idom)%val, & ! (in)
378 lmesh, lmesh%refElem3D, lmesh2d, lmesh2d%refElem2D ) ! (in)
379 ! write(*,*) "OCN_update: SFC_TEMP = ", this%vars%AUX_VARS2D(SFC_TEMP_ID)%local(idom)%val(1,1)
380 end do
381
382 call prof_rapend('OCN_update', 1)
383 return
384 end subroutine ocean_update
385!OCL SERIAL
386 subroutine set_sfctemp_lc( SFC_TEMP, &
387 THERM, lmesh, elem, lmesh2D, elem2D )
388 implicit none
389 class(localmesh3d), intent(in) :: lmesh
390 class(elementbase3d), intent(in) :: elem
391 class(localmesh2d), intent(in) :: lmesh2D
392 class(elementbase2d), intent(in) :: elem2D
393 real(RP), intent(out) :: SFC_TEMP(elem2D%Np,lmesh2D%NeA)
394 real(RP), intent(in) :: THERM(elem%Np,lmesh%NeA)
395
396 integer :: ke, ke2D
397 integer :: hSlice(elem2D%Np)
398 !------------------------------------------------------------------
399
400 hslice(:) = elem%Hslice(:,elem%Nnode_v)
401 !$omp parallel do private(ke)
402 do ke2d=lmesh2d%NeS, lmesh2d%NeE
403 ke = ke2d + (lmesh%NeZ-1)*lmesh%Ne2D
404 sfc_temp(:,ke2d) = therm(hslice(:),ke)
405 end do
406 return
407 end subroutine set_sfctemp_lc
408
409 !> Set ocean quantities to coupler component
410!OCL SERIAL
411 subroutine ocean_set_surface( this, countup )
412 implicit none
413 class(oceancomponent), intent(inout) :: this
414 logical, intent(in) :: countup
415 !--------------------------------------------------
416
417 call prof_rapstart( 'OCN_sfc_exch', 1)
418
419 call this%coupler_ptr%vars%PutOCN( this%vars, countup )
420
421 call prof_rapend( 'OCN_sfc_exch', 1)
422 return
423 end subroutine ocean_set_surface
424
425 !> Get atmospheric quantities from coupler component
426!OCL SERIAL
427 subroutine ocean_get_surface( this )
428 implicit none
429 class(oceancomponent), intent(inout) :: this
430 !--------------------------------------------------
431
432 call prof_rapstart( 'OCN_sfc_exch', 1)
433
434 call this%coupler_ptr%vars%Get_ATM_OCN( &
435 this%vars%ATM_VARS2D(atm_sfc_dens_id), &
436 this%vars%ATM_VARS2D(atm_sfc_pres_id), &
437 this%vars%ATM_VARS2D(atm_temp_id), &
438 this%vars%ATM_VARS2D(atm_pres_id), &
439 this%vars%ATM_VARS2D(atm_w_id), &
440 this%vars%ATM_VARS2D(atm_u_id), &
441 this%vars%ATM_VARS2D(atm_v_id), &
442 this%vars%ATM_VARS2D(atm_qv_id), &
443 this%vars%ATM_VARS2D(sflx_rd_sw_dir_id), &
444 this%vars%ATM_VARS2D(sflx_rd_lw_dif_id), &
445 this%vars%ATM_VARS2D(dz_a_id) )
446
447 call prof_rapend( 'OCN_sfc_exch', 1)
448 return
449 end subroutine ocean_get_surface
450
451!> Finalize an object to manage the ocean component
452!OCL SERIAL
453 subroutine ocean_finalize( this )
454 implicit none
455 class(oceancomponent), intent(inout) :: this
456 !--------------------------------------------------
457
458 log_info('OceanComponent_finalize',*)
459
460 if ( .not. this%IsActivated() ) return
461
462 ! call this%dyn_proc%finalize()
463 call this%vars%Final()
464
465 select case( this%mesh_type )
466 case('REGIONAL')
467 call this%mesh_rm%Final()
468 case('GLOBAL')
469 call this%mesh_gm%Final()
470 end select
471 this%mesh => null()
472
473 call this%time_manager%Final()
474
475 return
476 end subroutine ocean_finalize
477
478!- Private subroutines -------------------------------------------------------------
479
480 !> Calculate momentum and heat flux at the surface (tentative)
481!OCL SERIAL
482 subroutine calculate_surface_flux( this, &
483 SFLX_MW, SFLX_MU, SFLX_MV, SFLX_SH, SFLX_LH, SFLX_QV, &
484 SFC_TEMP, SFC_DENS, SFC_PRES, &
485 ATM_TEMP, ATM_DENS, ATM_PRES, ATM_W, ATM_U, ATM_V, ATM_QV, zlev_a, &
486 lmesh, elem )
487 use scale_const, only: &
488 rplanet => const_radius
491 implicit none
492 class(oceancomponent), intent(in) :: this
493 class(localmesh2d), intent(in) :: lmesh
494 class(elementbase2d), intent(in) :: elem
495 real(RP), intent(out) :: SFLX_MW(elem%Np,lmesh%NeA)
496 real(RP), intent(out) :: SFLX_MU(elem%Np,lmesh%NeA)
497 real(RP), intent(out) :: SFLX_MV(elem%Np,lmesh%NeA)
498 real(RP), intent(out) :: SFLX_SH(elem%Np,lmesh%NeA)
499 real(RP), intent(out) :: SFLX_LH(elem%Np,lmesh%NeA)
500 real(RP), intent(out) :: SFLX_QV(elem%Np,lmesh%NeA)
501 real(RP), intent(in) :: SFC_TEMP(elem%Np,lmesh%NeA)
502 real(RP), intent(in) :: SFC_DENS(elem%Np,lmesh%NeA)
503 real(RP), intent(in) :: SFC_PRES(elem%Np,lmesh%NeA)
504 real(RP), intent(in) :: ATM_TEMP(elem%Np,lmesh%NeA)
505 real(RP), intent(in) :: ATM_DENS(elem%Np,lmesh%NeA)
506 real(RP), intent(in) :: ATM_PRES(elem%Np,lmesh%NeA)
507 real(RP), intent(in) :: ATM_W(elem%Np,lmesh%NeA)
508 real(RP), intent(in) :: ATM_U(elem%Np,lmesh%NeA)
509 real(RP), intent(in) :: ATM_V(elem%Np,lmesh%NeA)
510 real(RP), intent(in) :: ATM_QV(elem%Np,lmesh%NeA)
511 real(RP), intent(in) :: zlev_a(elem%Np,lmesh%NeA)
512
513 ! dummy
514 real(RP) :: U10(elem%Np,lmesh%NeA)
515 real(RP) :: V10(elem%Np,lmesh%NeA)
516
517 integer :: ke
518 integer :: ke2D, ij
519
520 real(RP) :: DZ1 (elem%Np,lmesh%NeA)
521 real(RP) :: Z1 (elem%Np,lmesh%Ne)
522 real(RP) :: ATM_W_lc(elem%Np,lmesh%NeA)
523 real(RP) :: ATM_U_lc(elem%Np,lmesh%NeA)
524 real(RP) :: ATM_V_lc(elem%Np,lmesh%NeA)
525 !--------------------------------------------------
526
527 !$omp parallel do collapse(2)
528 do ke2d=lmesh%NeS, lmesh%NeE
529 do ij=1, elem%Np
530
531 atm_w_lc(ij,ke2d) = atm_w(ij,ke2d)
532 atm_u_lc(ij,ke2d) = atm_u(ij,ke2d)
533 atm_v_lc(ij,ke2d) = atm_v(ij,ke2d)
534
535 z1(ij,ke2d) = zlev_a(ij,ke2d)
536 dz1(ij,ke2d) = z1(ij,ke2d) - zlev_a(ij,ke2d)
537 z1(ij,ke2d) = z1(ij,ke2d) + rplanet
538 end do
539 end do
540
541 call convert_uv2localorthvec( &
542 this%mesh%ptr_mesh, lmesh%pos_en(:,:,1), lmesh%pos_en(:,:,2), z1(:,:), elem%Np*lmesh%Ne, &
543 atm_u_lc(:,lmesh%NeS:lmesh%NeE), atm_v_lc(:,lmesh%NeS:lmesh%NeE) ) ! (inout)
544
546 elem%Np, 1, elem%Np, lmesh%NeA, 1, lmesh%Ne, & ! (in)
547 atm_w_lc(:,:), atm_u_lc(:,:), atm_v_lc(:,:), atm_temp(:,:), atm_pres(:,:), & ! (in) Note: ATM_PRES is not used
548 atm_qv(:,:), & ! (in)
549 sfc_dens(:,:), sfc_temp(:,:), sfc_pres(:,:), & ! (in)
550 dz1(:,:), & ! (in)
551 sflx_mw(:,:), sflx_mu(:,:), sflx_mv(:,:), & ! (out)
552 sflx_sh(:,:), sflx_lh(:,:), sflx_qv(:,:), & ! (out)
553 u10(:,:), v10(:,:) ) ! (out)
554
555 call convert_localorth2uvvec( &
556 this%mesh%ptr_mesh, lmesh%pos_en(:,:,1), lmesh%pos_en(:,:,2), z1(:,:), elem%Np*lmesh%Ne, &
557 sflx_mu(:,lmesh%NeS:lmesh%NeE), sflx_mv(:,lmesh%NeS:lmesh%NeE) ) ! (inout)
558
559 return
560 end subroutine calculate_surface_flux
561
562 !> Calculate ground heat flux (tentative)
563 !!
564!OCL SERIAL
565 subroutine calculate_sfc_heat_flux( sflx_GH, &
566 SFC_TEMP, &
567 SFLX_RD_SW_dn_dir, SFLX_RD_LW_dn_dif, &
568 SFC_ALB_dir_vis, &
569 SFLX_SH, SFLX_LH, &
570 lmesh, elem )
571 use scale_const, only: &
572 stb => const_stb
573 implicit none
574 class(localmesh2d), intent(in) :: lmesh
575 class(elementbase2d), intent(in) :: elem
576 real(RP), intent(out) :: sflx_GH(elem%Np,lmesh%Ne)
577 real(RP), intent(in) :: SFC_TEMP(elem%Np,lmesh%NeA)
578 real(RP), intent(in) :: SFLX_RD_SW_dn_dir(elem%Np,lmesh%NeA)
579 real(RP), intent(in) :: SFLX_RD_LW_dn_dif(elem%Np,lmesh%NeA)
580 real(RP), intent(in) :: SFC_ALB_dir_vis(elem%Np,lmesh%NeA)
581 real(RP), intent(in) :: SFLX_SH(elem%Np,lmesh%NeA)
582 real(RP), intent(in) :: SFLX_LH(elem%Np,lmesh%NeA)
583
584 integer :: ke
585 real(RP) :: emis(elem%Np)
586 real(RP) :: SWU(elem%Np), SWD(elem%Np), LWU(elem%Np), LWD(elem%Np)
587 !--------------------------------------------------
588
589 !$omp parallel do private(SWU,SWD,LWU,LWD,emis)
590 do ke=lmesh%NeS, lmesh%NeE
591 emis(:) = stb * sfc_temp(:,ke)**4
592
593 lwd(:) = sflx_rd_lw_dn_dif(:,ke)
594 lwu(:) = emis(:)
595 swd(:) = sflx_rd_sw_dn_dir(:,ke)
596 swu(:) = sfc_alb_dir_vis(:,ke) * swd(:)
597
598 sflx_gh(:,ke) = swd(:) - swu(:) + lwd(:) - lwu(:) - sflx_sh(:,ke) - sflx_lh(:,ke)
599 end do
600 return
601 end subroutine calculate_sfc_heat_flux
602
603!OCL SERIAL
604 subroutine calculate_phys_tendency( RHOH, &
605 sflx_GH, zlev, lmesh, elem, lmesh2D, elem2D )
606 implicit none
607 class(localmesh3d), intent(in) :: lmesh
608 class(elementbase3d), intent(in) :: elem
609 class(localmesh2d), intent(in) :: lmesh2D
610 class(elementbase2d), intent(in) :: elem2D
611 real(RP), intent(out) :: RHOH(elem%Np,lmesh%NeA)
612 real(RP), intent(in) :: sflx_GH(elem2D%Np,lmesh2D%Ne)
613 real(RP), intent(in) :: zlev(elem%Np,lmesh%Ne2D,lmesh%NeZ)
614
615 integer :: ke, ke_z, ke2D
616 integer :: ph, pz, p
617 real(RP) :: r_ocn_depth(elem2D%Np,lmesh2D%Ne)
618 integer :: hSlice_t(elem2D%Np), hSlice_b(elem2D%Np)
619 !---------------------------------------
620
621 hslice_t(:) = elem%Hslice(:,elem%Nnode_v)
622 hslice_b(:) = elem%Hslice(:,1)
623
624 !$omp parallel private(ke)
625 !$omp do
626 do ke2d=1, lmesh%Ne2D
627 r_ocn_depth(:,ke2d) = 1.0_rp / ( zlev(hslice_t(:),ke2d,lmesh%NeZ) - zlev(hslice_b(:),ke2d,1) )
628 end do
629 !$omp do collapse(2)
630 do ke_z=1, lmesh%NeZ
631 do ke2d=1, lmesh%Ne2D
632 ke = ke2d + (ke_z-1)*lmesh%Ne2D
633 do pz=1, elem%Nnode_v
634 do ph=1, elem%Nnode_h1D**2
635 p = ph + (pz-1)*elem%Nnode_h1D**2
636 rhoh(p,ke) = sflx_gh(ph,ke2d) * r_ocn_depth(ph,ke2d)
637 end do
638 end do
639 end do
640 end do
641 !$omp end parallel
642 return
643 end subroutine calculate_phys_tendency
644
645!OCL SERIAL
646 subroutine convert_uv2localorthvec( mesh, x1, x2, r, N, & ! (in)
647 u, v ) ! (inout)
648 use scale_cubedsphere_coord_cnv, only: &
651
652 implicit none
653 integer, intent(in) :: N
654 class(meshbase3d), intent(in) :: mesh
655 real(RP), intent(in) :: x1(N)
656 real(RP), intent(in) :: x2(N)
657 real(RP), intent(in) :: r(N)
658 real(RP), intent(inout) :: U(N)
659 real(RP), intent(inout) :: V(N)
660
661 select type(mesh)
662 type is (meshcubedspheredom3d)
664 x1, x2, r, n, & ! (in)
665 u, v ) ! (inout)
666 end select
667 return
668 end subroutine convert_uv2localorthvec
669
670!OCL SERIAL
671 subroutine convert_localorth2uvvec( mesh, x1, x2, r, N, & ! (in)
672 u, v ) ! (inout)
673 use scale_cubedsphere_coord_cnv, only: &
676
677 implicit none
678 integer, intent(in) :: N
679 class(meshbase3d), intent(in) :: mesh
680 real(RP), intent(in) :: x1(N)
681 real(RP), intent(in) :: x2(N)
682 real(RP), intent(in) :: r(N)
683 real(RP), intent(inout) :: U(N)
684 real(RP), intent(inout) :: V(N)
685
686 select type(mesh)
687 type is (meshcubedspheredom3d)
689 x1, x2, r, n, & ! (in)
690 u, v ) ! (inout)
691 end select
692 return
693 end subroutine convert_localorth2uvvec
694
695end module mod_ocean_component
module Coupler component
module Oceanic component
subroutine ocean_setup(this)
Setup an object to mange oceanic component.
module Ocean Dynamics
module Ocean / Mesh
module Ocean / Mesh
module Ocean / Mesh
module Ocean / Variables
integer, parameter, public ocn_sflx_lh_id
latent heat flux at the ocean surface [W/m2]
integer, parameter, public atmvar2d_atm_qv_id
integer, parameter, public atmvar2d_atm_w_id
integer, parameter, public ocn_sflx_qv_id
water vapor flux at the ocean surface [kg/m2/s]
integer, parameter, public auxvar2d_sfc_alb_vis_dir_id
integer, parameter, public atmvar2d_atm_pres_id
integer, parameter, public atmvar2d_atm_u_id
integer, parameter, public auxvar2d_sfc_temp_id
integer, parameter, public ocn_sflx_mw_id
w-momentum flux at the ocean surface [kg/m/s2]
integer, parameter, public atmvar2d_sflx_rd_lw_dif_id
integer, parameter, public ocn_sflx_mv_id
v-momentum flux at the ocean surface [kg/m/s2]
integer, parameter, public ocn_sflx_sh_id
sensible heat flux at the ocean surface [W/m2]
integer, parameter, public atmvar2d_sfc_dens_id
integer, parameter, public atmvar2d_atm_dens_id
integer, parameter, public prgvar_therm_id
integer, parameter, public atmvar2d_atm_temp_id
integer, parameter, public atmvar2d_atm_v_id
integer, parameter, public phytend_rhoh_id
integer, parameter, public atmvar2d_sfc_pres_id
integer, parameter, public ocn_sflx_mu_id
u-momentum flux at the ocean surface [kg/m/s2]
integer, parameter, public atmvar2d_sflx_rd_sw_dir_id
integer, parameter, public atmvar2d_lowest_layer_dz_id
module atmosphere / physics / surface / simple
subroutine, public atmos_phy_sf_simple_flux(ia, is, ie, ja, js, je, atm_w, atm_u, atm_v, atm_temp, atm_pres, atm_qv, sfc_dens, sfc_temp, sfc_pres, atm_z1, sflx_mw, sflx_mu, sflx_mv, sflx_sh, sflx_lh, sflx_qv, u10, v10)
Calculate surface fluxes with constant bulk coefficients.
Module common / Coordinate conversion with cubed-sphere projection.
module FElib / Element / Base
subroutine, public file_history_meshfield_setup(mesh1d_, mesh2d_, mesh3d_, meshcubedsphere2d_, meshcubedsphere3d_, dim_name_postfix_, registered_comp_id)
Setup a module for file history.
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
module FElib / Mesh / Base 2D
module FElib / Mesh / Base 3D
module FElib / Mesh / Base
module FElib / Mesh / Cubed-sphere 3D domain
FElib / model framework / model component.
FElib / model framework / mesh manager.
Module common / time.
subroutine, public time_manager_regist_component(tmanager_comp)
Derived type to manage coupler component.
Derived type to manage oceanic component.
Derived type to manage a component of oceanic dynamics.
Derived type to manage a computational mesh (base class)
Derived type to manage a computational mesh of global ocean model.
Derived type to manage a computational mesh of regional ocean model.
Derived type to manage variables with ocean component.
Derived type representing a 2D reference element.
Derived type representing a 3D reference element.
Derived type representing a local mesh for 2D domain.
Derived type to manage a local 3D computational domain.
Derived type representing a field with local mesh (base type)
Derived type to manage a computational mesh (base type for 2D domain)
Derived type to manage a computational mesh (base type for 3D domain)
Base type to manage a computational mesh.
Derived type to manage a cubed-sphere 3D computational domain.