FE-Project
Loading...
Searching...
No Matches
mod_atmos_phy_sfc_vars.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Atmosphere / Physics / surface process
3!!
4!! @par Description
5!! Container for variables with surface model
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
22 use scale_mesh_base, only: meshbase
24 use scale_mesh_base3d, only: &
25 meshbase3d, &
26 dimtype_xyz => meshbase3d_dimtypeid_xyz
31 use scale_meshfield_base, only: &
33
36
37 use scale_model_var_manager, only: &
38 modelvarmanager, variableinfo
39 use scale_model_mesh_manager, only: modelmeshbase
40
41 use mod_atmos_mesh, only: atmosmesh
42
43 !-----------------------------------------------------------------------------
44 implicit none
45 private
46
47 !-----------------------------------------------------------------------------
48 !
49 !++ Public type & procedures
50 !
51
52 !> Derived type to manage variables with a surface component
53 !!
54 type, public :: atmosphysfcvars
55 type(meshfield2d), allocatable :: sfc_vars(:) !< Array of variables with a surface component
56 type(modelvarmanager) :: sfcvars_manager !< Object to manage variables
57
58 type(meshfield2d), allocatable :: sfc_flx(:) !< Array of flux variables with a surface component
59 type(modelvarmanager) :: sfcflx_manager !< Object to manage flux variables
60
61 integer :: sfcflx_num_tot !< Number of surface fluxes
62 contains
63 procedure :: init => atmosphysfcvars_init
64 procedure :: final => atmosphysfcvars_final
65 procedure :: setup => atmosphysfcvars_setup
66 procedure :: history => atmosphysfcvars_history
67 end type atmosphysfcvars
68
69 ! Variable information for surface variables
70
71 integer, public, parameter :: atmos_phy_sf_svar_temp_id = 1
72 integer, public, parameter :: atmos_phy_sf_svar_alb_id = 2
73 integer, public, parameter :: atmos_phy_sf_svar_num = 2
74 type(variableinfo), public :: atmos_phy_sf_svar_vinfo(atmos_phy_sf_svar_num)
76 variableinfo( atmos_phy_sf_svar_temp_id, 'SFC_TEMP', 'surface skin temperature', &
77 'K', 2, 'XY', 'surface_temp' ), &
78 variableinfo( atmos_phy_sf_svar_alb_id , 'SFC_ALB', 'surface albedo', &
79 '1', 2, 'XY', '' ) /
80
81 ! Variable information for surface fluxes
82
83 integer, public, parameter :: atmos_phy_sf_sflx_mu_id = 1
84 integer, public, parameter :: atmos_phy_sf_sflx_mv_id = 2
85 integer, public, parameter :: atmos_phy_sf_sflx_mw_id = 3
86 integer, public, parameter :: atmos_phy_sf_sflx_sh_id = 4
87 integer, public, parameter :: atmos_phy_sf_sflx_lh_id = 5
88 integer, public, parameter :: atmos_phy_sf_sflx_qv_id = 6
89 integer, public, parameter :: atmos_phy_sf_sflx_num1 = 6
90
91 type(variableinfo), public :: atmos_phy_sf_sflx_vinfo(atmos_phy_sf_sflx_num1)
93 variableinfo( atmos_phy_sf_sflx_mu_id, 'SFLX_MU', 'x-momentum flux', &
94 'm/s*kg/m2/s', 2, 'XY', '' ), &
95 variableinfo( atmos_phy_sf_sflx_mv_id, 'SFLX_MV', 'y-momentum flux', &
96 'm/s*kg/m2/s', 2, 'XY', '' ), &
97 variableinfo( atmos_phy_sf_sflx_mw_id, 'SFLX_MW', 'z-momentum flux', &
98 'm/s*kg/m2/s', 2, 'XY', '' ), &
99 variableinfo( atmos_phy_sf_sflx_sh_id, 'SFLX_SH', 'sensible heat flux', &
100 'J/m2/s', 2, 'XY', '' ), &
101 variableinfo( atmos_phy_sf_sflx_lh_id, 'SFLX_LH', 'latent heat flux', &
102 'J/m2/s', 2, 'XY', '' ), &
103 variableinfo( atmos_phy_sf_sflx_qv_id, 'SFLX_QV', 'water vapor flux', &
104 'kg/m2/s', 2, 'XY', '' ) /
105
107
108 !-----------------------------------------------------------------------------
109 !
110 !++ Private procedures
111 !
112 !-------------------
113 !
114 !++ Private parameters & variables
115 !
116 real(rp), private :: atmos_phy_sfc_default_sfc_temp = 300.0_rp
117
118contains
119!> Setup an object to manage variables with a surface component
120!!
121!! @param model_mesh Object to manage computational mesh of atmospheric model
122 subroutine atmosphysfcvars_init( this, model_mesh, &
123 DEFAULT_SFC_TEMP )
124 implicit none
125 class(atmosphysfcvars), target, intent(inout) :: this
126 class(modelmeshbase), target, intent(in) :: model_mesh
127 real(rp), intent(in) :: default_sfc_temp
128
129 integer :: v
130 integer :: n
131 logical :: reg_file_hist
132
133 class(atmosmesh), pointer :: atm_mesh
134 class(meshbase2d), pointer :: mesh2d
135 class(meshbase3d), pointer :: mesh3d
136 !--------------------------------------------------
137
138 log_info('AtmosPhySfcVars_Init',*)
139
140 atmos_phy_sfc_default_sfc_temp = default_sfc_temp
141 return
142 end subroutine atmosphysfcvars_init
143
144 !> Setup variable objects with a surface component
145 subroutine atmosphysfcvars_setup( this, model_mesh )
146 implicit none
147 class(atmosphysfcvars), target, intent(inout) :: this
148 class(modelmeshbase), target, intent(in) :: model_mesh
149
150 integer :: v
151 integer :: n
152 logical :: reg_file_hist
153
154 class(atmosmesh), pointer :: atm_mesh
155 class(meshbase2d), pointer :: mesh2d
156 class(meshbase3d), pointer :: mesh3d
157 !--------------------------------------------------
158
159 this%SFCFLX_NUM_TOT = atmos_phy_sf_sflx_num1
160
161
162 !- Initialize auxiliary and diagnostic variables
163
164 nullify( atm_mesh )
165 select type(model_mesh)
166 class is (atmosmesh)
167 atm_mesh => model_mesh
168 end select
169 mesh3d => atm_mesh%ptr_mesh
170
171 call mesh3d%GetMesh2D( mesh2d )
172
173 !----
174 call this%SFCVARS_manager%Init()
175 allocate( this%SFC_VARS(atmos_phy_sf_svar_num) )
176
177 reg_file_hist = .true.
178 do v = 1, atmos_phy_sf_svar_num
179 call this%SFCVARS_manager%Regist( &
180 atmos_phy_sf_svar_vinfo(v), mesh2d, &
181 this%SFC_VARS(v), reg_file_hist, fill_zero=.true. )
182 end do
183
184 do n=1, mesh2d%LOCAL_MESH_NUM
185 this%SFC_VARS(atmos_phy_sf_svar_temp_id)%local(n)%val(:,:) = atmos_phy_sfc_default_sfc_temp
186 end do
187
188 !----
189 call this%SFCFLX_manager%Init()
190 allocate( this%SFC_FLX(this%SFCFLX_NUM_TOT) )
191
192 reg_file_hist = .true.
193 do v = 1, this%SFCFLX_NUM_TOT
194 call this%SFCFLX_manager%Regist( &
195 atmos_phy_sf_sflx_vinfo(v), mesh2d, &
196 this%SFC_FLX(v), reg_file_hist, fill_zero=.true. )
197 end do
198
199 return
200 end subroutine atmosphysfcvars_setup
201
202 !> Finalize an object to manage variables with a surface component
203 !!
204 subroutine atmosphysfcvars_final( this )
205 implicit none
206 class(atmosphysfcvars), intent(inout) :: this
207
208 !--------------------------------------------------
209
210 log_info('AtmosPhySfcVars_Final',*)
211
212 call this%SFCVARS_manager%Final()
213 deallocate( this%SFC_VARS )
214
215 call this%SFCFLX_manager%Final()
216 deallocate( this%SFC_FLX )
217
218 return
219 end subroutine atmosphysfcvars_final
220
221 !> Write history data for surface variables
222!OCL SERIAL
223 subroutine atmosphysfcvars_history( this )
225 implicit none
226 class(atmosphysfcvars), intent(inout) :: this
227
228 integer :: v
229 integer :: iq
230 integer :: hst_id
231 !-------------------------------------------------------------------------
232
233 do v = 1, atmos_phy_sf_svar_num
234 hst_id = this%SFC_VARS(v)%hist_id
235 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%SFC_VARS(v) )
236 end do
237
238 do v = 1, this%SFCFLX_NUM_TOT
239 hst_id = this%SFC_FLX(v)%hist_id
240 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%SFC_FLX(v) )
241 end do
242
243 return
244 end subroutine atmosphysfcvars_history
245
246 !> Get local mesh fields for surface variables
247!OCL SERIAL
248 subroutine atmosphysfcvars_getlocalmeshfields( domID, mesh, svars_list, sflx_list, &
249 SFC_TEMP, SFLX_MU, SFLX_MV, SFLX_MW, SFLX_SH, SFLX_LH, SFLX_QV, &
250 lcmesh3D &
251 )
252
253 use scale_mesh_base, only: meshbase
255 implicit none
256
257 integer, intent(in) :: domid
258 class(meshbase), intent(in) :: mesh
259 class(modelvarmanager), intent(inout) :: svars_list
260 class(modelvarmanager), intent(inout) :: sflx_list
261 class(localmeshfieldbase), pointer, intent(out) :: sfc_temp
262 class(localmeshfieldbase), pointer, intent(out) :: sflx_mu
263 class(localmeshfieldbase), pointer, intent(out) :: sflx_mv
264 class(localmeshfieldbase), pointer, intent(out) :: sflx_mw
265 class(localmeshfieldbase), pointer, intent(out) :: sflx_sh
266 class(localmeshfieldbase), pointer, intent(out) :: sflx_lh
267 class(localmeshfieldbase), pointer, intent(out) :: sflx_qv
268 class(localmesh3d), pointer, intent(out), optional :: lcmesh3d
269
270 class(meshfieldbase), pointer :: field
271 class(localmeshbase), pointer :: lcmesh
272 !-------------------------------------------------------
273
274 !--
275 call svars_list%Get(atmos_phy_sf_svar_temp_id, field)
276 call field%GetLocalMeshField(domid, sfc_temp)
277
278 call sflx_list%Get(atmos_phy_sf_sflx_mu_id, field)
279 call field%GetLocalMeshField(domid, sflx_mu)
280
281 call sflx_list%Get(atmos_phy_sf_sflx_mv_id, field)
282 call field%GetLocalMeshField(domid, sflx_mv)
283
284 call sflx_list%Get(atmos_phy_sf_sflx_mw_id, field)
285 call field%GetLocalMeshField(domid, sflx_mw)
286
287 call sflx_list%Get(atmos_phy_sf_sflx_sh_id, field)
288 call field%GetLocalMeshField(domid, sflx_sh)
289
290 call sflx_list%Get(atmos_phy_sf_sflx_lh_id, field)
291 call field%GetLocalMeshField(domid, sflx_lh)
292
293 call sflx_list%Get(atmos_phy_sf_sflx_qv_id, field)
294 call field%GetLocalMeshField(domid, sflx_qv)
295 !---
296
297 if (present(lcmesh3d)) then
298 call mesh%GetLocalMesh( domid, lcmesh )
299 nullify( lcmesh3d )
300
301 select type(lcmesh)
302 type is (localmesh3d)
303 if (present(lcmesh3d)) lcmesh3d => lcmesh
304 end select
305 end if
306
307 return
309
310end module mod_atmos_phy_sfc_vars
module Atmosphere / Mesh
module Atmosphere / Physics / surface process
type(variableinfo), dimension(atmos_phy_sf_sflx_num1), public atmos_phy_sf_sflx_vinfo
subroutine, public atmosphysfcvars_getlocalmeshfields(domid, mesh, svars_list, sflx_list, sfc_temp, sflx_mu, sflx_mv, sflx_mw, sflx_sh, sflx_lh, sflx_qv, lcmesh3d)
Get local mesh fields for surface variables.
integer, parameter, public atmos_phy_sf_sflx_mv_id
type(variableinfo), dimension(atmos_phy_sf_svar_num), public atmos_phy_sf_svar_vinfo
integer, parameter, public atmos_phy_sf_sflx_qv_id
integer, parameter, public atmos_phy_sf_svar_alb_id
integer, parameter, public atmos_phy_sf_sflx_mu_id
integer, parameter, public atmos_phy_sf_sflx_num1
integer, parameter, public atmos_phy_sf_sflx_sh_id
integer, parameter, public atmos_phy_sf_svar_num
integer, parameter, public atmos_phy_sf_sflx_lh_id
integer, parameter, public atmos_phy_sf_svar_temp_id
integer, parameter, public atmos_phy_sf_sflx_mw_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_xyz
module FElib / Mesh / Base
module FElib / Data / base
FElib / model framework / mesh manager.
FElib / model framework / variable manager.
Derived type to manage a computational mesh (base class)
Derived type to manage variables with a surface component.
Derived type representing a 3D reference element.
Derived type to manage restart file with each component.
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)