FE-Project
Loading...
Searching...
No Matches
mod_atmos_phy_tb_vars.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
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_tracer, only: qa
21
23 use scale_mesh_base, only: meshbase
25 use scale_mesh_base3d, only: &
26 meshbase3d, &
27 dimtype_xyz => meshbase3d_dimtypeid_xyz
30 use scale_localmeshfield_base, only: &
32 use scale_meshfield_base, only: &
34
37
39
40 use scale_model_var_manager, only: &
41 modelvarmanager, variableinfo
42 use scale_model_mesh_manager, only: modelmeshbase
43
49 tb_momx_t_vid => atmos_phy_tb_momx_t_id,tb_momy_t_vid => atmos_phy_tb_momy_t_id, &
50 tb_momz_t_vid => atmos_phy_tb_momz_t_id, tb_rhot_t_vid => atmos_phy_tb_rhot_t_id
51
52 use mod_atmos_mesh, only: atmosmesh
53
54 !-----------------------------------------------------------------------------
55 implicit none
56 private
57
58
59 !-----------------------------------------------------------------------------
60 !
61 !++ Public type & procedures
62 !
63 type, public :: atmosphytbvars
64 type(meshfield3d), allocatable :: tends(:)
65 type(modelvarmanager) :: tends_manager
66
67 type(meshfield3d), allocatable :: auxvars(:)
68 type(modelvarmanager) :: auxvars_manager
69 integer :: auxvars_commid
70
71 type(meshfield3d), allocatable :: diagvars(:)
72 type(modelvarmanager) :: diagvars_manager
73
74 integer :: tends_num_tot
75 contains
76 procedure :: init => atmosphytbvars_init
77 procedure :: final => atmosphytbvars_final
78 procedure :: history => atmosphytbvars_history
79 end type atmosphytbvars
80
82
83 !-----------------------------------------------------------------------------
84 !
85 !++ Private procedures
86 !
87 !-------------------
88
89contains
90!OCL SERIAL
91 subroutine atmosphytbvars_init( this, model_mesh )
92
93 use scale_tracer, only: &
94 tracer_name, tracer_desc, tracer_unit
97
98 implicit none
99 class(atmosphytbvars), target, intent(inout) :: this
100 class(modelmeshbase), target, intent(in) :: model_mesh
101
102 integer :: iv
103 integer :: iq
104 logical :: reg_file_hist
105
106 class(atmosmesh), pointer :: atm_mesh
107 class(meshbase2d), pointer :: mesh2D
108 class(meshbase3d), pointer :: mesh3D
109 !--------------------------------------------------
110
111 log_info('AtmosPhyTbVars_Init',*)
112
113 this%TENDS_NUM_TOT = atmos_phy_tb_tends_num1 + qa
114
115 !- Initialize auxiliary and diagnostic variables
116
117 nullify( atm_mesh )
118 select type(model_mesh)
119 class is (atmosmesh)
120 atm_mesh => model_mesh
121 end select
122 mesh3d => atm_mesh%ptr_mesh
123
124 call mesh3d%GetMesh2D( mesh2d )
125
126 !- Get variable information
127 ! call atm_phy_tb_dgm_common_get_varinfo( auxvar_info, diagvar_info, tbtend_info ) ! (out)
128
129 !- Initialize objects to variables with turbulent model
130
131 call this%tends_manager%Init()
132 call this%auxvars_manager%Init()
133 call this%diagvars_manager%Init()
134
135 allocate( this%diagvars(atmos_phy_tb_diag_num) )
136 allocate( this%tends(this%TENDS_NUM_TOT) )
137 allocate( this%auxvars(atmos_phy_tb_aux_num) )
138
140 this%tends, this%auxvars, this%diagvars, & ! (inout)
141 this%tends_manager, this%auxvars_manager, this%diagvars_manager, & ! (inout)
142 this%TENDS_NUM_TOT, mesh3d ) ! (in)
143
144 !- Setup communication
145
146 call atm_mesh%Create_communicator( &
149 this%auxvars_manager, & ! (inout)
150 this%auxvars(:), & ! (in)
151 this%auxvars_commid ) ! (out)
152
153 return
154 end subroutine atmosphytbvars_init
155
156!OCL SERIAL
157 subroutine atmosphytbvars_final( this )
158 implicit none
159 class(atmosphytbvars), intent(inout) :: this
160 !--------------------------------------------------
161
162 log_info('AtmosPhyTbVars_Final',*)
163
164 call this%tends_manager%Final()
165 deallocate( this%tends )
166
167 call this%auxvars_manager%Final()
168 deallocate( this%auxvars )
169
170 call this%diagvars_manager%Final()
171 deallocate( this%diagvars )
172
173 return
174 end subroutine atmosphytbvars_final
175
176!OCL SERIAL
177 subroutine atmosphytbvars_getlocalmeshfields_tend( domID, mesh, tb_tends_list, &
178 tb_MOMX_t, tb_MOMY_t, tb_MOMZ_t, tb_RHOT_t, tb_RHOQ_t, &
179 lcmesh3D &
180 )
181
182 use scale_mesh_base, only: meshbase
184 implicit none
185
186 integer, intent(in) :: domid
187 class(meshbase), intent(in) :: mesh
188 class(modelvarmanager), intent(inout) :: tb_tends_list
189 class(localmeshfieldbase), pointer, intent(out) :: tb_momx_t
190 class(localmeshfieldbase), pointer, intent(out) :: tb_momy_t
191 class(localmeshfieldbase), pointer, intent(out) :: tb_momz_t
192 class(localmeshfieldbase), pointer, intent(out) :: tb_rhot_t
193 type(localmeshfieldbaselist), intent(out), optional :: tb_rhoq_t(:)
194 class(localmesh3d), pointer, intent(out), optional :: lcmesh3d
195
196 class(meshfieldbase), pointer :: field
197 class(localmeshbase), pointer :: lcmesh
198
199 integer :: iq
200 !-------------------------------------------------------
201
202 !--
203 call tb_tends_list%Get(tb_momx_t_vid, field)
204 call field%GetLocalMeshField(domid, tb_momx_t)
205
206 call tb_tends_list%Get(tb_momy_t_vid, field)
207 call field%GetLocalMeshField(domid, tb_momy_t)
208
209 call tb_tends_list%Get(tb_momz_t_vid, field)
210 call field%GetLocalMeshField(domid, tb_momz_t)
211
212 call tb_tends_list%Get(tb_rhot_t_vid, field)
213 call field%GetLocalMeshField(domid, tb_rhot_t)
214
215 !---
216 if ( present(tb_rhoq_t) ) then
217 do iq = 1, size(tb_rhoq_t)
218 call tb_tends_list%Get(atmos_phy_tb_tends_num1 + iq, field)
219 call field%GetLocalMeshField(domid, tb_rhoq_t(iq)%ptr)
220 end do
221 end if
222
223 if (present(lcmesh3d)) then
224 call mesh%GetLocalMesh( domid, lcmesh )
225 nullify( lcmesh3d )
226
227 select type(lcmesh)
228 type is (localmesh3d)
229 if (present(lcmesh3d)) lcmesh3d => lcmesh
230 end select
231 end if
232
233 return
235
236!OCL SERIAL
237 subroutine atmosphytbvars_history( this )
239 implicit none
240 class(atmosphytbvars), intent(inout) :: this
241
242 integer :: v
243 integer :: hst_id
244 type(meshfield3d) :: tmp_field
245 class(meshbase3d), pointer :: mesh3d
246 !-------------------------------------------------------------------------
247
248 mesh3d => this%auxvars(1)%mesh
249
250 do v = 1, this%TENDS_NUM_TOT
251 hst_id = this%tends(v)%hist_id
252 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%tends(v) )
253 end do
254
255 do v = 1, atmos_phy_tb_aux_num
256 hst_id = this%auxvars(v)%hist_id
257 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%auxvars(v) )
258 end do
259
260 do v = 1, atmos_phy_tb_diag_num
261 hst_id = this%diagvars(v)%hist_id
262 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%diagvars(v) )
263 end do
264
265 return
266 end subroutine atmosphytbvars_history
267
268end module mod_atmos_phy_tb_vars
module Atmosphere / Mesh
module ATMOSPHERE physics / sub-grid scale turbulence
subroutine atmosphytbvars_init(this, model_mesh)
subroutine, public atmosphytbvars_getlocalmeshfields_tend(domid, mesh, tb_tends_list, tb_momx_t, tb_momy_t, tb_momz_t, tb_rhot_t, tb_rhoq_t, lcmesh3d)
module FElib / Fluid dyn solver / Atmosphere / Physics turbulence / Common
integer, parameter, public atmos_phy_tb_aux_scalar_num
integer, parameter, public atmos_phy_tb_aux_hvec_num
integer, parameter, public atmos_phy_tb_diag_num
subroutine, public atm_phy_tb_dgm_common_setup_variables(tends, auxvars, diagvars, tends_manager, auxvar_manager, diagvar_manager, tends_num_tot, mesh3d)
integer, parameter, public atmos_phy_tb_tends_num1
integer, parameter, public atmos_phy_tb_momy_t_id
integer, parameter, public atmos_phy_tb_aux_htensor_num
integer, parameter, public atmos_phy_tb_aux_num
integer, parameter, public atmos_phy_tb_momz_t_id
integer, parameter, public atmos_phy_tb_rhot_t_id
integer, parameter, public atmos_phy_tb_momx_t_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
module FElib / Data / Communication base
FElib / model framework / mesh manager.
FElib / model framework / variable manager.