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
30 use scale_meshfield_base, only: &
32
35
36 use scale_model_var_manager, only: &
37 modelvarmanager, variableinfo
38 use scale_model_mesh_manager, only: modelmeshbase
39
40 use mod_atmos_mesh, only: atmosmesh
41
42 !-----------------------------------------------------------------------------
43 implicit none
44 private
45
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 :: history => atmosphysfcvars_history
66 end type atmosphysfcvars
67
68 integer, public, parameter :: atmos_phy_sf_svar_temp_id = 1
69 integer, public, parameter :: atmos_phy_sf_svar_num = 1
70 type(variableinfo), public :: atmos_phy_sf_svar_vinfo(atmos_phy_sf_svar_num)
72 variableinfo( atmos_phy_sf_svar_num, 'SFC_TEMP', 'surface skin temperature', &
73 'K', 2, 'XY', '' ) /
74
75 integer, public, parameter :: atmos_phy_sf_sflx_mu_id = 1
76 integer, public, parameter :: atmos_phy_sf_sflx_mv_id = 2
77 integer, public, parameter :: atmos_phy_sf_sflx_mw_id = 3
78 integer, public, parameter :: atmos_phy_sf_sflx_sh_id = 4
79 integer, public, parameter :: atmos_phy_sf_sflx_lh_id = 5
80 integer, public, parameter :: atmos_phy_sf_sflx_qv_id = 6
81 integer, public, parameter :: atmos_phy_sf_sflx_num1 = 6
82
83 type(variableinfo), public :: atmos_phy_sf_sflx_vinfo(atmos_phy_sf_sflx_num1)
85 variableinfo( atmos_phy_sf_sflx_mu_id, 'SFLX_MU', 'x-momentum flux', &
86 'm/s*kg/m2/s', 2, 'XY', '' ), &
87 variableinfo( atmos_phy_sf_sflx_mv_id, 'SFLX_MV', 'y-momentum flux', &
88 'm/s*kg/m2/s', 2, 'XY', '' ), &
89 variableinfo( atmos_phy_sf_sflx_mw_id, 'SFLX_MW', 'z-momentum flux', &
90 'm/s*kg/m2/s', 2, 'XY', '' ), &
91 variableinfo( atmos_phy_sf_sflx_sh_id, 'SFLX_SH', 'sensible heat flux', &
92 'J/m2/s', 2, 'XY', '' ), &
93 variableinfo( atmos_phy_sf_sflx_lh_id, 'SFLX_LH', 'latent heat flux', &
94 'J/m2/s', 2, 'XY', '' ), &
95 variableinfo( atmos_phy_sf_sflx_qv_id, 'SFLX_QV', 'water vapor flux', &
96 'kg/m2/s', 2, 'XY', '' ) /
97
99
100 !-----------------------------------------------------------------------------
101 !
102 !++ Private procedures
103 !
104 !-------------------
105 !
106 !++ Private parameters & variables
107 !
108 real(rp), private :: atmos_phy_sfc_default_sfc_temp = 300.0_rp
109
110contains
111!> Setup an object to manage variables with a surface component
112!!
113!! @param model_mesh Object to manage computational mesh of atmospheric model
114 subroutine atmosphysfcvars_init( this, model_mesh )
115 implicit none
116 class(atmosphysfcvars), target, intent(inout) :: this
117 class(modelmeshbase), target, intent(in) :: model_mesh
118
119 integer :: v
120 integer :: n
121 logical :: reg_file_hist
122
123 class(atmosmesh), pointer :: atm_mesh
124 class(meshbase2d), pointer :: mesh2d
125 class(meshbase3d), pointer :: mesh3d
126
127 namelist / param_atmos_phy_sfc_vars / &
128 atmos_phy_sfc_default_sfc_temp
129
130 integer :: ierr
131 !--------------------------------------------------
132
133 log_info('AtmosPhySfcVars_Init',*)
134
135 this%SFCFLX_NUM_TOT = atmos_phy_sf_sflx_num1
136
137 !--- read namelist
138 rewind(io_fid_conf)
139 read(io_fid_conf,nml=param_atmos_phy_sfc_vars,iostat=ierr)
140 if( ierr < 0 ) then !--- missing
141 log_info("ATMOS_PHY_SFC_vars_setup",*) 'Not found namelist. Default used.'
142 elseif( ierr > 0 ) then !--- fatal error
143 log_error("ATMOS_PHY_SFC_vars_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_PHY_SFC_VARS. Check!'
144 call prc_abort
145 endif
146 log_nml(param_atmos_phy_sfc_vars)
147
148 !- Initialize auxiliary and diagnostic variables
149
150 nullify( atm_mesh )
151 select type(model_mesh)
152 class is (atmosmesh)
153 atm_mesh => model_mesh
154 end select
155 mesh3d => atm_mesh%ptr_mesh
156
157 call mesh3d%GetMesh2D( mesh2d )
158
159 !----
160 call this%SFCVARS_manager%Init()
161 allocate( this%SFC_VARS(atmos_phy_sf_svar_num) )
162
163 reg_file_hist = .true.
164 do v = 1, atmos_phy_sf_svar_num
165 call this%SFCVARS_manager%Regist( &
166 atmos_phy_sf_svar_vinfo(v), mesh2d, &
167 this%SFC_VARS(v), reg_file_hist, fill_zero=.true. )
168 end do
169
170 do n=1, mesh2d%LOCAL_MESH_NUM
171 this%SFC_VARS(atmos_phy_sf_svar_temp_id)%local(n)%val(:,:) = atmos_phy_sfc_default_sfc_temp
172 end do
173
174 !----
175 call this%SFCFLX_manager%Init()
176 allocate( this%SFC_FLX(this%SFCFLX_NUM_TOT) )
177
178 reg_file_hist = .true.
179 do v = 1, this%SFCFLX_NUM_TOT
180 call this%SFCFLX_manager%Regist( &
181 atmos_phy_sf_sflx_vinfo(v), mesh2d, &
182 this%SFC_FLX(v), reg_file_hist, fill_zero=.true. )
183 end do
184
185 return
186 end subroutine atmosphysfcvars_init
187
188!> Finalize an object to manage variables with a surface component
189!!
190 subroutine atmosphysfcvars_final( this )
191 implicit none
192 class(atmosphysfcvars), intent(inout) :: this
193
194 !--------------------------------------------------
195
196 log_info('AtmosPhySfcVars_Final',*)
197
198 call this%SFCVARS_manager%Final()
199 deallocate( this%SFC_VARS )
200
201 call this%SFCFLX_manager%Final()
202 deallocate( this%SFC_FLX )
203
204 return
205 end subroutine atmosphysfcvars_final
206
207!OCL SERIAL
208 subroutine atmosphysfcvars_history( this )
210 implicit none
211 class(atmosphysfcvars), intent(inout) :: this
212
213 integer :: v
214 integer :: iq
215 integer :: hst_id
216 !-------------------------------------------------------------------------
217
218 do v = 1, atmos_phy_sf_svar_num
219 hst_id = this%SFC_VARS(v)%hist_id
220 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%SFC_VARS(v) )
221 end do
222
223 do v = 1, this%SFCFLX_NUM_TOT
224 hst_id = this%SFC_FLX(v)%hist_id
225 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%SFC_FLX(v) )
226 end do
227
228 return
229 end subroutine atmosphysfcvars_history
230
231 subroutine atmosphysfcvars_getlocalmeshfields( domID, mesh, svars_list, sflx_list, &
232 SFC_TEMP, SFLX_MU, SFLX_MV, SFLX_MW, SFLX_SH, SFLX_LH, SFLX_QV, &
233 lcmesh3D &
234 )
235
236 use scale_mesh_base, only: meshbase
238 implicit none
239
240 integer, intent(in) :: domid
241 class(meshbase), intent(in) :: mesh
242 class(modelvarmanager), intent(inout) :: svars_list
243 class(modelvarmanager), intent(inout) :: sflx_list
244 class(localmeshfieldbase), pointer, intent(out) :: sfc_temp
245 class(localmeshfieldbase), pointer, intent(out) :: sflx_mu
246 class(localmeshfieldbase), pointer, intent(out) :: sflx_mv
247 class(localmeshfieldbase), pointer, intent(out) :: sflx_mw
248 class(localmeshfieldbase), pointer, intent(out) :: sflx_sh
249 class(localmeshfieldbase), pointer, intent(out) :: sflx_lh
250 class(localmeshfieldbase), pointer, intent(out) :: sflx_qv
251 class(localmesh3d), pointer, intent(out), optional :: lcmesh3d
252
253 class(meshfieldbase), pointer :: field
254 class(localmeshbase), pointer :: lcmesh
255 !-------------------------------------------------------
256
257 !--
258 call svars_list%Get(atmos_phy_sf_svar_temp_id, field)
259 call field%GetLocalMeshField(domid, sfc_temp)
260
261 call sflx_list%Get(atmos_phy_sf_sflx_mu_id, field)
262 call field%GetLocalMeshField(domid, sflx_mu)
263
264 call sflx_list%Get(atmos_phy_sf_sflx_mv_id, field)
265 call field%GetLocalMeshField(domid, sflx_mv)
266
267 call sflx_list%Get(atmos_phy_sf_sflx_mw_id, field)
268 call field%GetLocalMeshField(domid, sflx_mw)
269
270 call sflx_list%Get(atmos_phy_sf_sflx_sh_id, field)
271 call field%GetLocalMeshField(domid, sflx_sh)
272
273 call sflx_list%Get(atmos_phy_sf_sflx_lh_id, field)
274 call field%GetLocalMeshField(domid, sflx_lh)
275
276 call sflx_list%Get(atmos_phy_sf_sflx_qv_id, field)
277 call field%GetLocalMeshField(domid, sflx_qv)
278 !---
279
280 if (present(lcmesh3d)) then
281 call mesh%GetLocalMesh( domid, lcmesh )
282 nullify( lcmesh3d )
283
284 select type(lcmesh)
285 type is (localmesh3d)
286 if (present(lcmesh3d)) lcmesh3d => lcmesh
287 end select
288 end if
289
290 return
292
293end 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)
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_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 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 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 representing a field with 2D mesh.
Derived type representing a field with 3D mesh.
Derived type representing a field (base type)