FE-Project
Loading...
Searching...
No Matches
mod_cpl_vars.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Coupler / Variables
3!!
4!! @par Description
5!! Module to manage variables with coupler component
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_prc
20 use scale_debug
21
22 use scale_element_base, only: &
24 use scale_mesh_base, only: meshbase
25 use scale_mesh_base2d, only: &
27 use scale_mesh_base3d, only: &
28 meshbase3d, &
29 dimtype_xy => meshbase3d_dimtypeid_xy, &
30 dimtype_xyz => meshbase3d_dimtypeid_xyz
31
35 use scale_localmeshfield_base, only: &
37 use scale_meshfield_base, only: &
39 !-----------------------------------------------------------------------------
40 implicit none
41 private
42
43 !-----------------------------------------------------------------------------
44 !
45 !++ Public type & procedures
46 !
47 !> Derived type to manage variables with coupler component
48 type, public :: couplervars
49 type(meshfield2d), allocatable :: ocn_vars(:)
50
51 type(meshfield2d), allocatable :: ocn_atm_vars(:)
52
53 real(rp) :: cnt_putatm_ocn !< Counter for putting ATM variables to OCN component
54 real(rp) :: cnt_putocn_atm !< Counter for putting OCN variables to ATM component
55
56 class(meshbase3d), pointer :: mesh3d_atm => null()
57 class(meshbase2d), pointer :: mesh2d_atm => null()
58 class(meshbase2d), pointer :: mesh2d_ocn => null()
59 contains
60 procedure :: init => couplervars_init
61 procedure :: final => couplervars_final
62 procedure :: putatm => couplervars_putatm
63 procedure :: putocn => couplervars_putocn
64 procedure :: get_sfc_atm => couplervars_get_sfc_atm
65 procedure :: get_atm_ocn => couplervars_get_atm_ocn
66 !-
67 procedure, private :: putatm_lc => putatm_local
68 procedure, private :: putocn_lc => putocn_local
69 procedure, private :: get_sfc_atm_lc => get_sfc_atm_local
70 procedure, private :: get_atm_ocn_lc => get_atm_ocn_local
71 end type couplervars
72
73 !-----------------------------------------------------------------------------
74 !
75 !++ Public parameters & variables
76 !
77
78 ! Input from ocean component
79 integer, parameter, public :: ocn_sfc_temp_id = 1
80 integer, parameter, public :: ocn_sflx_mw_id = 2
81 integer, parameter, public :: ocn_sflx_mu_id = 3
82 integer, parameter, public :: ocn_sflx_mv_id = 4
83 integer, parameter, public :: ocn_sflx_sh_id = 5
84 integer, parameter, public :: ocn_sflx_lh_id = 6
85 integer, parameter, public :: ocn_sflx_qv_id = 7
86 integer, parameter, public :: ocn_sfc_albedo_id = 8
87 integer, parameter, public :: ocn_var_num = 8
88
89 ! Output to ocean component
90 integer, parameter, public :: ocn_atm_sfc_dens_id = 1
91 integer, parameter, public :: ocn_atm_sfc_pres_id = 2
92 integer, parameter, public :: ocn_atm_temp_id = 3
93 integer, parameter, public :: ocn_atm_pres_id = 4
94 integer, parameter, public :: ocn_atm_w_id = 5
95 integer, parameter, public :: ocn_atm_u_id = 6
96 integer, parameter, public :: ocn_atm_v_id = 7
97 integer, parameter, public :: ocn_atm_qv_id = 8
98 integer, parameter, public :: ocn_atm_sflx_rd_sw_dir = 9
99 integer, parameter, public :: ocn_atm_sflx_rd_lw_dif = 10
100 integer, parameter, public :: ocn_atm_sflx_engi = 11
101 integer, parameter, public :: ocn_atm_var_num = 11
102
103 !-----------------------------------------------------------------------------
104 !
105 !++ Private procedures & variables
106 !
107
108contains
109
110!OCL SERIAL
111 subroutine couplervars_init(this, &
112 mesh3D_atm, mesh2D_atm, mesh2D_ocn)
113 implicit none
114 class(couplervars), intent(inout) :: this
115 class(meshbase3d), intent(in), target :: mesh3d_atm
116 class(meshbase2d), intent(in), target :: mesh2d_atm
117 class(meshbase2d), intent(in), target :: mesh2d_ocn
118
119 integer :: iv
120 !--------------------------------------------------------------------------------
121
122 allocate( this%OCN_vars(ocn_var_num) )
123 do iv=1, ocn_var_num
124 call this%OCN_vars(iv)%Init( "", "", mesh2d_ocn )
125 end do
126
127 allocate( this%OCN_atm_vars(ocn_atm_var_num) )
128 do iv=1, ocn_atm_var_num
129 call this%OCN_atm_vars(iv)%Init( "", "", mesh2d_atm )
130 end do
131
132 !-
133 this%mesh3D_atm => mesh3d_atm
134 this%mesh2D_atm => mesh2d_atm
135 this%mesh2D_ocn => mesh2d_ocn
136
137 !-
138 this%CNT_putATM_OCN = 0.0_rp
139 this%CNT_putOCN_ATM = 0.0_rp
140
141 return
142 end subroutine couplervars_init
143
144!OCL SERIAL
145 subroutine couplervars_final(this)
146 implicit none
147 class(couplervars), intent(inout) :: this
148
149 integer :: iv
150 !--------------------------------------------------------------------------------
151 do iv=1, ocn_var_num
152 call this%OCN_vars(iv)%Final()
153 end do
154 deallocate( this%OCN_vars )
155
156 do iv=1, ocn_atm_var_num
157 call this%OCN_atm_vars(iv)%Final()
158 end do
159 deallocate( this%OCN_atm_vars )
160 return
161 end subroutine couplervars_final
162
163 !> Put ATM variables to CPL buffer for OCN component
164 subroutine couplervars_putatm( this, &
165 ATM_DDENS, ATM_MOMZ, ATM_MOMX, ATM_MOMY, ATM_QV, &
166 ATM_PRES, ATM_Rtot, ATM_DENS_hyd, &
167 SFLX_RAD_SW_dir_dn, SFLX_RAD_LW_dif_dn, SFLX_ENGI, &
168 countup )
170 implicit none
171 class(couplervars), intent(inout) :: this
172 type(meshfield3d), intent(in), target :: atm_ddens
173 type(meshfield3d), intent(in), target :: atm_momz
174 type(meshfield3d), intent(in), target :: atm_momx
175 type(meshfield3d), intent(in), target :: atm_momy
176 type(meshfield3d), intent(in), target :: atm_qv
177 type(meshfield3d), intent(in), target :: atm_pres
178 type(meshfield3d), intent(in), target :: atm_rtot
179 type(meshfield3d), intent(in), target :: atm_dens_hyd
180 type(meshfield2d), intent(in), target :: sflx_rad_sw_dir_dn
181 type(meshfield2d), intent(in), target :: sflx_rad_lw_dif_dn
182 type(meshfield2d), intent(in), target :: sflx_engi
183 logical, intent(in) :: countup
184
185 class(localmesh3d), pointer :: lmesh
186 class(localmesh2d), pointer :: lmesh2d
187 integer :: ldomid
188 real(rp), allocatable :: atm_temp_lc(:,:)
189
190 !----------------------------------------------------------------
191
192 do ldomid=1, this%mesh2D_atm%LOCAL_MESH_NUM
193 lmesh => atm_ddens%mesh%lcmesh_list(ldomid)
194 lmesh2d => lmesh%lcmesh2D
195 call this%putATM_lc( lmesh, lmesh%refElem3D, lmesh2d, lmesh2d%refElem2D, &
196 atm_ddens%local(ldomid)%val, atm_momz%local(ldomid)%val, atm_momx%local(ldomid)%val, atm_momy%local(ldomid)%val, &
197 atm_qv%local(ldomid)%val, atm_pres%local(ldomid)%val, atm_rtot%local(ldomid)%val, atm_dens_hyd%local(ldomid)%val, &
198 sflx_rad_sw_dir_dn%local(ldomid)%val, sflx_rad_lw_dif_dn%local(ldomid)%val, &
199 sflx_engi %local(ldomid)%val, &
200 !-
201 this%OCN_atm_vars(ocn_atm_sfc_dens_id)%local(ldomid)%val, &
202 this%OCN_atm_vars(ocn_atm_sfc_pres_id)%local(ldomid)%val, &
203 this%OCN_atm_vars(ocn_atm_temp_id)%local(ldomid)%val, &
204 this%OCN_atm_vars(ocn_atm_pres_id)%local(ldomid)%val, &
205 this%OCN_atm_vars(ocn_atm_w_id)%local(ldomid)%val, &
206 this%OCN_atm_vars(ocn_atm_u_id)%local(ldomid)%val, &
207 this%OCN_atm_vars(ocn_atm_v_id)%local(ldomid)%val, &
208 this%OCN_atm_vars(ocn_atm_qv_id)%local(ldomid)%val, &
209 this%OCN_atm_vars(ocn_atm_sflx_rd_sw_dir)%local(ldomid)%val, &
210 this%OCN_atm_vars(ocn_atm_sflx_rd_lw_dif)%local(ldomid)%val, &
211 this%OCN_atm_vars(ocn_atm_sflx_engi)%local(ldomid)%val )
212 end do
213
214 ! Update counter
215 if (countup) then
216 this%CNT_putATM_OCN = this%CNT_putATM_OCN + 1.0_rp
217 end if
218 return
219 end subroutine couplervars_putatm
220
221 !> Put OCN variables to CPL buffer for ATM component
222!OCL SERIAL
223 subroutine couplervars_putocn( this, ocn_vars, countup )
224 use mod_ocean_vars, only: oceanvars, &
225 sflx_mw_id => ocn_sflx_mw_id, &
226 sflx_mu_id => ocn_sflx_mu_id, &
227 sflx_mv_id => ocn_sflx_mv_id, &
228 sflx_sh_id => ocn_sflx_sh_id, &
229 sflx_lh_id => ocn_sflx_lh_id, &
230 sflx_qv_id => ocn_sflx_qv_id, &
231 sfc_temp_id => auxvar2d_sfc_temp_id, &
232 salb_vis_dir_id => auxvar2d_sfc_alb_vis_dir_id
233 implicit none
234 class(couplervars), intent(inout) :: this
235 type(oceanvars), intent(in) :: ocn_vars
236 logical, intent(in) :: countup
237
238 class(localmesh2d), pointer :: lmesh
239 integer :: ldomid
240 !----------------------------------------------------------------
241
242 do ldomid=1, this%mesh2D_ocn%LOCAL_MESH_NUM
243 lmesh => this%mesh2D_ocn%lcmesh_list(ldomid)
244
245 call this%putOCN_lc( lmesh, lmesh%refElem2D, &
246 ocn_vars%AUX_VARS2D(sfc_temp_id)%local(ldomid)%val, &
247 ocn_vars%AUX_VARS2D(salb_vis_dir_id)%local(ldomid)%val, &
248 ocn_vars%OCN_SFLX(sflx_mw_id)%local(ldomid)%val, &
249 ocn_vars%OCN_SFLX(sflx_mu_id)%local(ldomid)%val, &
250 ocn_vars%OCN_SFLX(sflx_mv_id)%local(ldomid)%val, &
251 ocn_vars%OCN_SFLX(sflx_sh_id)%local(ldomid)%val, &
252 ocn_vars%OCN_SFLX(sflx_lh_id)%local(ldomid)%val, &
253 ocn_vars%OCN_SFLX(sflx_qv_id)%local(ldomid)%val, &
254 !-
255 this%OCN_vars(ocn_sfc_temp_id)%local(ldomid)%val, &
256 this%OCN_vars(ocn_sfc_albedo_id)%local(ldomid)%val, &
257 this%OCN_vars(ocn_sflx_mw_id)%local(ldomid)%val, &
258 this%OCN_vars(ocn_sflx_mu_id)%local(ldomid)%val, &
259 this%OCN_vars(ocn_sflx_mv_id)%local(ldomid)%val, &
260 this%OCN_vars(ocn_sflx_sh_id)%local(ldomid)%val, &
261 this%OCN_vars(ocn_sflx_lh_id)%local(ldomid)%val, &
262 this%OCN_vars(ocn_sflx_qv_id)%local(ldomid)%val )
263 end do
264
265 ! Update counter
266 if ( countup ) then
267 this%CNT_putOCN_ATM = this%CNT_putOCN_ATM + 1.0_rp
268 end if
269
270 return
271 end subroutine couplervars_putocn
272
273 !> Get SFC variables from CPL buffer for ATM component
274!OCL SERIAL
275 subroutine couplervars_get_sfc_atm( this, &
276 SFC_TEMP, SFC_ALBEDO, &
277 SFLX_MW, SFLX_MU, SFLX_MV, SFLX_SH, SFLX_LH, &
278 SFLX_QV )
279 implicit none
280 class(couplervars), intent(inout) :: this
281 type(meshfield2d), intent(inout) :: sfc_temp
282 type(meshfield2d), intent(inout) :: sfc_albedo
283 type(meshfield2d), intent(inout) :: sflx_mw
284 type(meshfield2d), intent(inout) :: sflx_mu
285 type(meshfield2d), intent(inout) :: sflx_mv
286 type(meshfield2d), intent(inout) :: sflx_sh
287 type(meshfield2d), intent(inout) :: sflx_lh
288 type(meshfield2d), intent(inout) :: sflx_qv
289
290 integer :: ldomid
291 class(localmesh2d), pointer :: lmesh, lmesh_o
292 !----------------------------------------------------------------
293
294 do ldomid=1, this%mesh2D_atm%LOCAL_MESH_NUM
295 lmesh => this%mesh2D_atm%lcmesh_list(ldomid)
296 lmesh_o => this%mesh2D_ocn%lcmesh_list(ldomid)
297
298 call this%get_SFC_ATM_lc( &
299 lmesh, lmesh%refElem2D, lmesh_o, lmesh_o%refElem2D, &
300 this%OCN_vars(ocn_sfc_temp_id)%local(ldomid)%val, &
301 this%OCN_vars(ocn_sfc_albedo_id)%local(ldomid)%val, &
302 this%OCN_vars(ocn_sflx_mw_id)%local(ldomid)%val, &
303 this%OCN_vars(ocn_sflx_mu_id)%local(ldomid)%val, &
304 this%OCN_vars(ocn_sflx_mv_id)%local(ldomid)%val, &
305 this%OCN_vars(ocn_sflx_sh_id)%local(ldomid)%val, &
306 this%OCN_vars(ocn_sflx_lh_id)%local(ldomid)%val, &
307 this%OCN_vars(ocn_sflx_qv_id)%local(ldomid)%val, &
308 !-
309 sfc_temp%local(ldomid)%val, sfc_albedo%local(ldomid)%val, &
310 sflx_mw%local(ldomid)%val, sflx_mu%local(ldomid)%val, &
311 sflx_mv%local(ldomid)%val, sflx_sh%local(ldomid)%val, &
312 sflx_lh%local(ldomid)%val, sflx_qv%local(ldomid)%val )
313 end do
314
315 this%CNT_putOCN_ATM = 0.0_rp
316 return
317 end subroutine couplervars_get_sfc_atm
318
319 !> Get ATM variables from CPL buffer for OCN component
320!OCL SERIAL
321 subroutine couplervars_get_atm_ocn( this, &
322 ATM_SFC_DENS, ATM_SFC_PRES, ATM_TEMP, ATM_PRES, ATM_W, ATM_U, ATM_V, ATM_QV, &
323 RD_SFLX_SW_DIR, RD_SFLX_LW_DIF, DZ_A )
324 implicit none
325 class(couplervars), intent(inout) :: this
326 type(meshfield2d), intent(inout) :: atm_sfc_dens
327 type(meshfield2d), intent(inout) :: atm_sfc_pres
328 type(meshfield2d), intent(inout) :: atm_temp
329 type(meshfield2d), intent(inout) :: atm_pres
330 type(meshfield2d), intent(inout) :: atm_w
331 type(meshfield2d), intent(inout) :: atm_u
332 type(meshfield2d), intent(inout) :: atm_v
333 type(meshfield2d), intent(inout) :: atm_qv
334 type(meshfield2d), intent(inout) :: rd_sflx_sw_dir
335 type(meshfield2d), intent(inout) :: rd_sflx_lw_dif
336 type(meshfield2d), intent(inout) :: dz_a
337
338 integer :: ldomid
339 !----------------------------------------------------------------
340
341 do ldomid=1, this%mesh2D_atm%LOCAL_MESH_NUM
342 call this%get_ATM_OCN_lc( &
343 this%mesh3D_atm%lcmesh_list(ldomid), this%mesh3D_atm%refElem3D, &
344 this%mesh2D_atm%lcmesh_list(ldomid), this%mesh2D_atm%refElem2D, &
345 this%mesh2D_ocn%lcmesh_list(ldomid), this%mesh2D_ocn%refElem2D, &
346 !-
347 this%OCN_atm_vars(ocn_atm_sfc_dens_id)%local(ldomid)%val, &
348 this%OCN_atm_vars(ocn_atm_sfc_pres_id)%local(ldomid)%val, &
349 this%OCN_atm_vars(ocn_atm_temp_id)%local(ldomid)%val, &
350 this%OCN_atm_vars(ocn_atm_pres_id)%local(ldomid)%val, &
351 this%OCN_atm_vars(ocn_atm_w_id)%local(ldomid)%val, &
352 this%OCN_atm_vars(ocn_atm_u_id)%local(ldomid)%val, &
353 this%OCN_atm_vars(ocn_atm_v_id)%local(ldomid)%val, &
354 this%OCN_atm_vars(ocn_atm_qv_id)%local(ldomid)%val, &
355 this%OCN_atm_vars(ocn_atm_sflx_rd_sw_dir)%local(ldomid)%val, &
356 this%OCN_atm_vars(ocn_atm_sflx_rd_lw_dif)%local(ldomid)%val, &
357 !-
358 atm_sfc_dens%local(ldomid)%val, atm_sfc_pres%local(ldomid)%val, &
359 atm_temp%local(ldomid)%val, atm_pres%local(ldomid)%val, &
360 atm_w%local(ldomid)%val, atm_u%local(ldomid)%val, atm_v%local(ldomid)%val, atm_qv%local(ldomid)%val, &
361 rd_sflx_sw_dir%local(ldomid)%val, &
362 rd_sflx_lw_dif%local(ldomid)%val, &
363 dz_a%local(ldomid)%val )
364 end do
365
366 this%CNT_putATM_OCN = 0.0_rp
367 return
368 end subroutine couplervars_get_atm_ocn
369
370!-
371!OCL SERIAL
372 subroutine putatm_local( this, &
373 lmesh_a, elem_a, lmesh2D_a, elem2D_a,&
374 ATM_DDENS, ATM_MOMZ, ATM_MOMX, ATM_MOMY, ATM_QV, &
375 ATM_PRES, ATM_Rtot, ATM_DENS_hyd, &
376 ATM_RD_SFLX_SW_DIR, ATM_RD_SFLX_LW_DIF, ATM_SFLX_ENGI, &
377 O_ATM_SFC_DENS, O_ATM_SFC_PRES, &
378 O_ATM_TEMP, O_ATM_PRES, O_ATM_W, O_ATM_U, O_ATM_V, O_ATM_QV, &
379 O_ATM_RD_SFLX_SW_DIR, O_ATM_RD_SFLX_LW_DIF, O_ATM_SFLX_ENGI )
380 implicit none
381 class(couplervars), intent(inout) :: this
382 class(localmesh3d), intent(in) :: lmesh_a
383 class(elementbase3d), intent(in) :: elem_a
384 class(localmesh2d), intent(in) :: lmesh2d_a
385 class(elementbase2d), intent(in) :: elem2d_a
386 real(rp), intent(in) :: atm_ddens(elem_a%np,lmesh_a%nea)
387 real(rp), intent(in) :: atm_momz(elem_a%np,lmesh_a%nea)
388 real(rp), intent(in) :: atm_momx(elem_a%np,lmesh_a%nea)
389 real(rp), intent(in) :: atm_momy(elem_a%np,lmesh_a%nea)
390 real(rp), intent(in) :: atm_qv(elem_a%np,lmesh_a%nea)
391 real(rp), intent(in) :: atm_pres(elem_a%np,lmesh_a%nea)
392 real(rp), intent(in) :: atm_rtot(elem_a%np,lmesh_a%nea)
393 real(rp), intent(in) :: atm_dens_hyd(elem_a%np,lmesh_a%nea)
394 real(rp), intent(in) :: atm_rd_sflx_sw_dir(elem2d_a%np,lmesh2d_a%nea)
395 real(rp), intent(in) :: atm_rd_sflx_lw_dif(elem2d_a%np,lmesh2d_a%nea)
396 real(rp), intent(in) :: atm_sflx_engi(elem2d_a%np,lmesh2d_a%nea)
397 real(rp), intent(out) :: o_atm_sfc_dens(elem2d_a%np,lmesh2d_a%nea)
398 real(rp), intent(out) :: o_atm_sfc_pres(elem2d_a%np,lmesh2d_a%nea)
399 real(rp), intent(out) :: o_atm_temp(elem2d_a%np,lmesh2d_a%nea)
400 real(rp), intent(out) :: o_atm_pres(elem2d_a%np,lmesh2d_a%nea)
401 real(rp), intent(out) :: o_atm_w(elem2d_a%np,lmesh2d_a%nea)
402 real(rp), intent(out) :: o_atm_u(elem2d_a%np,lmesh2d_a%nea)
403 real(rp), intent(out) :: o_atm_v(elem2d_a%np,lmesh2d_a%nea)
404 real(rp), intent(out) :: o_atm_qv(elem2d_a%np,lmesh2d_a%nea)
405 real(rp), intent(out) :: o_atm_rd_sflx_sw_dir(elem2d_a%np,lmesh2d_a%nea)
406 real(rp), intent(out) :: o_atm_rd_sflx_lw_dif(elem2d_a%np,lmesh2d_a%nea)
407 real(rp), intent(out) :: o_atm_sflx_engi(elem2d_a%np,lmesh2d_a%nea)
408
409 integer :: ke2d
410 real(rp) :: coef1, coef2
411
412 integer :: hslice0(elem2d_a%np), hslice1(elem2d_a%np)
413 real(rp) :: dens_(elem2d_a%np)
414 real(rp) :: temp_(elem2d_a%np)
415 !----------------------------------------------------------------
416
417 coef1 = this%CNT_putATM_OCN
418 coef2 = 1.0_rp / ( 1.0_rp + coef1 )
419
420 hslice0(:) = elem_a%Hslice(:,1)
421 hslice1(:) = elem_a%Hslice(:,2)
422
423 !$omp parallel private(temp_, dens_)
424 !$omp do
425 do ke2d=lmesh2d_a%NeS, lmesh2d_a%NeE
426 dens_(:) = atm_dens_hyd(hslice0(:),ke2d) + atm_ddens(hslice0(:),ke2d)
427 temp_(:) = atm_pres(hslice0(:),ke2d) / ( dens_(:) * atm_rtot(hslice0(:),ke2d) )
428
429 o_atm_sfc_dens(:,ke2d) = o_atm_sfc_dens(:,ke2d) * coef1 + dens_(:)
430 o_atm_sfc_pres(:,ke2d) = o_atm_sfc_pres(:,ke2d) * coef1 + atm_pres(hslice0(:),ke2d)
431
432 o_atm_temp(:,ke2d) = o_atm_temp(:,ke2d) * coef1 + temp_(:)
433 o_atm_pres(:,ke2d) = o_atm_pres(:,ke2d) * coef1 + atm_pres(hslice0(:),ke2d)
434 o_atm_w(:,ke2d) = o_atm_w(:,ke2d) * coef1 + atm_momz(hslice1(:),ke2d) / dens_(:)
435 o_atm_u(:,ke2d) = o_atm_u(:,ke2d) * coef1 + atm_momx(hslice0(:),ke2d) / dens_(:)
436 o_atm_v(:,ke2d) = o_atm_v(:,ke2d) * coef1 + atm_momy(hslice0(:),ke2d) / dens_(:)
437 o_atm_qv(:,ke2d) = o_atm_qv(:,ke2d) * coef1 + atm_qv(hslice0(:),ke2d)
438
439 o_atm_rd_sflx_sw_dir(:,ke2d) = o_atm_rd_sflx_sw_dir(:,ke2d) * coef1 + atm_rd_sflx_sw_dir(:,ke2d)
440 o_atm_rd_sflx_lw_dif(:,ke2d) = o_atm_rd_sflx_lw_dif(:,ke2d) * coef1 + atm_rd_sflx_lw_dif(:,ke2d)
441 o_atm_sflx_engi(:,ke2d) = o_atm_sflx_engi(:,ke2d) * coef1 + atm_sflx_engi(:,ke2d)
442 end do
443 !$omp do
444 do ke2d=lmesh2d_a%NeS, lmesh2d_a%NeE
445 o_atm_sfc_dens(:,ke2d) = o_atm_sfc_dens(:,ke2d) * coef2
446 o_atm_sfc_pres(:,ke2d) = o_atm_sfc_pres(:,ke2d) * coef2
447
448 o_atm_temp(:,ke2d) = o_atm_temp(:,ke2d) * coef2
449 o_atm_pres(:,ke2d) = o_atm_pres(:,ke2d) * coef2
450 o_atm_w(:,ke2d) = o_atm_w(:,ke2d) * coef2
451 o_atm_u(:,ke2d) = o_atm_u(:,ke2d) * coef2
452 o_atm_v(:,ke2d) = o_atm_v(:,ke2d) * coef2
453 o_atm_qv(:,ke2d) = o_atm_qv(:,ke2d) * coef2
454
455 o_atm_rd_sflx_sw_dir(:,ke2d) = o_atm_rd_sflx_sw_dir(:,ke2d) * coef2
456 o_atm_rd_sflx_lw_dif(:,ke2d) = o_atm_rd_sflx_lw_dif(:,ke2d) * coef2
457 o_atm_sflx_engi(:,ke2d) = o_atm_sflx_engi(:,ke2d) * coef2
458 end do
459 !$omp end parallel
460 return
461 end subroutine putatm_local
462
463!OCL SERIAL
464 subroutine putocn_local( this, &
465 lmesh_o, elem_o, &
466 SFC_TEMP, SALB_VIS_DIR, SFLX_MW, SFLX_MU, SFLX_MV, SFLX_SH, SFLX_LH, SFLX_QV, &
467 SFC_TEMP_out, SALB_VIS_DIR_out, SFLX_MW_out, SFLX_MU_out, SFLX_MV_out, SFLX_SH_out, SFLX_LH_out, SFLX_QV_out )
468 implicit none
469 class(couplervars), intent(inout) :: this
470 class(localmesh2d), intent(in) :: lmesh_o
471 class(elementbase2d), intent(in) :: elem_o
472 real(rp), intent(in) :: sfc_temp(elem_o%np,lmesh_o%nea)
473 real(rp), intent(in) :: salb_vis_dir(elem_o%np,lmesh_o%nea)
474 real(rp), intent(in) :: sflx_mw(elem_o%np,lmesh_o%nea)
475 real(rp), intent(in) :: sflx_mu(elem_o%np,lmesh_o%nea)
476 real(rp), intent(in) :: sflx_mv(elem_o%np,lmesh_o%nea)
477 real(rp), intent(in) :: sflx_sh(elem_o%np,lmesh_o%nea)
478 real(rp), intent(in) :: sflx_lh(elem_o%np,lmesh_o%nea)
479 real(rp), intent(in) :: sflx_qv(elem_o%np,lmesh_o%nea)
480 real(rp), intent(out) :: sfc_temp_out(elem_o%np,lmesh_o%nea)
481 real(rp), intent(out) :: salb_vis_dir_out(elem_o%np,lmesh_o%nea)
482 real(rp), intent(out) :: sflx_mw_out(elem_o%np,lmesh_o%nea)
483 real(rp), intent(out) :: sflx_mu_out(elem_o%np,lmesh_o%nea)
484 real(rp), intent(out) :: sflx_mv_out(elem_o%np,lmesh_o%nea)
485 real(rp), intent(out) :: sflx_sh_out(elem_o%np,lmesh_o%nea)
486 real(rp), intent(out) :: sflx_lh_out(elem_o%np,lmesh_o%nea)
487 real(rp), intent(out) :: sflx_qv_out(elem_o%np,lmesh_o%nea)
488
489 integer :: ke
490 real(rp) :: coef1, coef2
491 !----------------------------------------------------------------
492
493 coef1 = this%CNT_putOCN_ATM
494 coef2 = 1.0_rp / ( 1.0_rp + coef1 )
495
496 !$omp parallel
497 !$omp do
498 do ke=lmesh_o%NeS, lmesh_o%NeE
499 sfc_temp_out(:,ke) = sfc_temp_out(:,ke) * coef1 + sfc_temp(:,ke)
500 salb_vis_dir_out(:,ke) = salb_vis_dir_out(:,ke) * coef1 + salb_vis_dir(:,ke)
501 sflx_mw_out(:,ke) = sflx_mw_out(:,ke) * coef1 + sflx_mw(:,ke)
502 sflx_mu_out(:,ke) = sflx_mu_out(:,ke) * coef1 + sflx_mu(:,ke)
503 sflx_mv_out(:,ke) = sflx_mv_out(:,ke) * coef1 + sflx_mv(:,ke)
504 sflx_sh_out(:,ke) = sflx_sh_out(:,ke) * coef1 + sflx_sh(:,ke)
505 sflx_lh_out(:,ke) = sflx_lh_out(:,ke) * coef1 + sflx_lh(:,ke)
506 sflx_qv_out(:,ke) = sflx_qv_out(:,ke) * coef1 + sflx_qv(:,ke)
507 end do
508 !$omp do
509 do ke=lmesh_o%NeS, lmesh_o%NeE
510 sfc_temp_out(:,ke) = sfc_temp_out(:,ke) * coef2
511 salb_vis_dir_out(:,ke) = salb_vis_dir_out(:,ke) * coef2
512 sflx_mw_out(:,ke) = sflx_mw_out(:,ke) * coef2
513 sflx_mu_out(:,ke) = sflx_mu_out(:,ke) * coef2
514 sflx_mv_out(:,ke) = sflx_mv_out(:,ke) * coef2
515 sflx_sh_out(:,ke) = sflx_sh_out(:,ke) * coef2
516 sflx_lh_out(:,ke) = sflx_lh_out(:,ke) * coef2
517 sflx_qv_out(:,ke) = sflx_qv_out(:,ke) * coef2
518 end do
519 !$omp end parallel
520 return
521 end subroutine putocn_local
522
523!OCL SERIAL
524 subroutine get_sfc_atm_local( this, &
525 lmesh_a, elem_a, lmesh_o, elem_o, &
526 O_SFC_TEMP, O_SFC_ALBEDO, O_SFLX_MW, O_SFLX_MU, O_SFLX_MV, O_SFLX_SH, O_SFLX_LH, O_SFLX_QV, &
527 SFC_TEMP, SFC_ALBEDO, SFLX_MW, SFLX_MU, SFLX_MV, SFLX_SH, SFLX_LH, SFLX_QV )
528 implicit none
529 class(couplervars), intent(inout) :: this
530 class(localmesh2d), intent(in) :: lmesh_a
531 class(elementbase2d), intent(in) :: elem_a
532 class(localmesh2d), intent(in) :: lmesh_o
533 class(elementbase2d), intent(in) :: elem_o
534 real(rp), intent(in) :: o_sfc_temp(elem_o%np,lmesh_o%nea)
535 real(rp), intent(in) :: o_sfc_albedo(elem_o%np,lmesh_o%nea)
536 real(rp), intent(in) :: o_sflx_mw(elem_o%np,lmesh_o%nea)
537 real(rp), intent(in) :: o_sflx_mu(elem_o%np,lmesh_o%nea)
538 real(rp), intent(in) :: o_sflx_mv(elem_o%np,lmesh_o%nea)
539 real(rp), intent(in) :: o_sflx_sh(elem_o%np,lmesh_o%nea)
540 real(rp), intent(in) :: o_sflx_lh(elem_o%np,lmesh_o%nea)
541 real(rp), intent(in) :: o_sflx_qv(elem_o%np,lmesh_o%nea)
542 real(rp), intent(out) :: sfc_temp(elem_a%np,lmesh_a%nea)
543 real(rp), intent(out) :: sfc_albedo(elem_a%np,lmesh_a%nea)
544 real(rp), intent(out) :: sflx_mw(elem_a%np,lmesh_a%nea)
545 real(rp), intent(out) :: sflx_mu(elem_a%np,lmesh_a%nea)
546 real(rp), intent(out) :: sflx_mv(elem_a%np,lmesh_a%nea)
547 real(rp), intent(out) :: sflx_sh(elem_a%np,lmesh_a%nea)
548 real(rp), intent(out) :: sflx_lh(elem_a%np,lmesh_a%nea)
549 real(rp), intent(out) :: sflx_qv(elem_a%np,lmesh_a%nea)
550
551 integer :: ke
552 !----------------------------------------------------------------
553
554 !$omp parallel do
555 do ke=lmesh_a%NeS, lmesh_a%NeE
556 sfc_temp(:,ke) = o_sfc_temp(:,ke)
557 sfc_albedo(:,ke) = o_sfc_albedo(:,ke)
558 sflx_mw(:,ke) = o_sflx_mw(:,ke)
559 sflx_mu(:,ke) = o_sflx_mu(:,ke)
560 sflx_mv(:,ke) = o_sflx_mv(:,ke)
561 sflx_sh(:,ke) = o_sflx_sh(:,ke)
562 sflx_lh(:,ke) = o_sflx_lh(:,ke)
563 sflx_qv(:,ke) = o_sflx_qv(:,ke)
564 end do
565 return
566 end subroutine get_sfc_atm_local
567
568!OCL SERIAL
569 subroutine get_atm_ocn_local( this, &
570 lmesh3D_a, elem3D_a, lmesh_a, elem_a, lmesh_o, elem_o, &
571 O_ATM_SFC_DENS, O_ATM_SFC_PRES, O_ATM_TEMP, O_ATM_PRES, O_ATM_W, O_ATM_U, O_ATM_V, O_ATM_QV, &
572! O_ATM_SFLX_ENGI, &
573 O_ATM_RD_SFLX_SW_DIR, O_ATM_RD_SFLX_LW_DIF, &
574 ATM_SFC_DENS, ATM_SFC_PRES, ATM_TEMP, ATM_PRES, ATM_W, ATM_U, ATM_V, ATM_QV, &
575! ATM_SFLX_ENGI, &
576 ATM_RD_SFLX_SW_DIR, ATM_RD_SFLX_LW_DIF, &
577 DZ_A )
578 implicit none
579 class(couplervars), intent(inout) :: this
580 class(localmesh3d), intent(in) :: lmesh3d_a
581 class(elementbase3d), intent(in) :: elem3d_a
582 class(localmesh2d), intent(in) :: lmesh_a
583 class(elementbase2d), intent(in) :: elem_a
584 class(localmesh2d), intent(in) :: lmesh_o
585 class(elementbase2d), intent(in) :: elem_o
586 real(rp), intent(in) :: o_atm_sfc_dens(elem_a%np,lmesh_a%nea)
587 real(rp), intent(in) :: o_atm_sfc_pres(elem_a%np,lmesh_a%nea)
588 real(rp), intent(in) :: o_atm_temp(elem_a%np,lmesh_a%nea)
589 real(rp), intent(in) :: o_atm_pres(elem_a%np,lmesh_a%nea)
590 real(rp), intent(in) :: o_atm_w(elem_a%np,lmesh_a%nea)
591 real(rp), intent(in) :: o_atm_u(elem_a%np,lmesh_a%nea)
592 real(rp), intent(in) :: o_atm_v(elem_a%np,lmesh_a%nea)
593 real(rp), intent(in) :: o_atm_qv(elem_a%np,lmesh_a%nea)
594 ! real(RP), intent(in) :: O_ATM_SFLX_ENGI(elem_a%Np,lmesh_a%NeA)
595 real(rp), intent(in) :: o_atm_rd_sflx_sw_dir(elem_a%np,lmesh_a%nea)
596 real(rp), intent(in) :: o_atm_rd_sflx_lw_dif(elem_a%np,lmesh_a%nea)
597 real(rp), intent(out) :: atm_sfc_dens(elem_o%np,lmesh_o%nea)
598 real(rp), intent(out) :: atm_sfc_pres(elem_o%np,lmesh_o%nea)
599 real(rp), intent(out) :: atm_temp(elem_o%np,lmesh_o%nea)
600 real(rp), intent(out) :: atm_pres(elem_o%np,lmesh_o%nea)
601 real(rp), intent(out) :: atm_w(elem_o%np,lmesh_o%nea)
602 real(rp), intent(out) :: atm_u(elem_o%np,lmesh_o%nea)
603 real(rp), intent(out) :: atm_v(elem_o%np,lmesh_o%nea)
604 real(rp), intent(out) :: atm_qv(elem_o%np,lmesh_o%nea)
605 ! real(RP), intent(out) :: ATM_SFLX_ENGI(elem_o%Np,lmesh_o%NeA)
606 real(rp), intent(out) :: atm_rd_sflx_sw_dir(elem_o%np,lmesh_o%nea)
607 real(rp), intent(out) :: atm_rd_sflx_lw_dif(elem_o%np,lmesh_o%nea)
608 real(rp), intent(out) :: dz_a(elem_o%np,lmesh_o%nea)
609
610 integer :: ke
611 !----------------------------------------------------------------
612
613 !$omp parallel do
614 do ke=lmesh_a%NeS, lmesh_a%NeE
615 atm_sfc_dens(:,ke) = o_atm_sfc_dens(:,ke)
616 atm_sfc_pres(:,ke) = o_atm_sfc_pres(:,ke)
617
618 atm_temp(:,ke) = o_atm_temp(:,ke)
619 atm_pres(:,ke) = o_atm_pres(:,ke)
620 atm_w(:,ke) = o_atm_w(:,ke)
621 atm_u(:,ke) = o_atm_u(:,ke)
622 atm_v(:,ke) = o_atm_v(:,ke)
623 atm_qv(:,ke) = o_atm_qv(:,ke)
624 ! ATM_SFLX_ENGI(:,ke) = O_ATM_SFLX_ENGI(:,ke)
625 atm_rd_sflx_sw_dir(:,ke) = o_atm_rd_sflx_sw_dir(:,ke)
626 atm_rd_sflx_lw_dif(:,ke) = o_atm_rd_sflx_lw_dif(:,ke)
627
628 dz_a(:,ke) = lmesh3d_a%zlev(elem3d_a%Hslice(:,2),ke) - lmesh3d_a%zlev(elem3d_a%Hslice(:,1),ke)
629 end do
630 return
631 end subroutine get_atm_ocn_local
632end module mod_cpl_vars
module Atmosphere / Variables
module Coupler / Variables
integer, parameter, public ocn_sflx_mv_id
integer, parameter, public ocn_sflx_qv_id
integer, parameter, public ocn_var_num
integer, parameter, public ocn_atm_u_id
integer, parameter, public ocn_atm_var_num
integer, parameter, public ocn_atm_sflx_rd_sw_dir
integer, parameter, public ocn_sflx_mu_id
integer, parameter, public ocn_sflx_lh_id
integer, parameter, public ocn_sfc_temp_id
integer, parameter, public ocn_atm_sfc_dens_id
integer, parameter, public ocn_atm_w_id
integer, parameter, public ocn_atm_sflx_engi
integer, parameter, public ocn_atm_sflx_rd_lw_dif
integer, parameter, public ocn_sfc_albedo_id
integer, parameter, public ocn_atm_qv_id
integer, parameter, public ocn_atm_v_id
integer, parameter, public ocn_atm_temp_id
integer, parameter, public ocn_atm_pres_id
integer, parameter, public ocn_sflx_sh_id
integer, parameter, public ocn_sflx_mw_id
integer, parameter, public ocn_atm_sfc_pres_id
module Ocean / Variables
integer, parameter, public auxvar2d_sfc_alb_vis_dir_id
integer, parameter, public auxvar2d_sfc_temp_id
module FElib / Element / Base
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
module FElib / Mesh / Local, Base
module FElib / Mesh / Base 2D
module FElib / Mesh / Base 3D
integer, public meshbase3d_dimtypeid_xy
integer, public meshbase3d_dimtypeid_xyz
module FElib / Mesh / Base
module FElib / Data / base
Derived type to manage a set of variables (prognostic variables, tracer variables,...
Derived type to manage variables with coupler component.
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 an arbitrary finite element.
Derived type representing a local mesh for 2D domain.
Derived type to manage a local 3D computational domain.
Derived type to manage a local computational domain (base type)
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 representing a field with 2D mesh.
Derived type representing a field with 3D mesh.
Derived type representing a field (base type)