FE-Project
Loading...
Searching...
No Matches
scale_atm_dyn_dgm_nonhydro3d_etot_heve.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module FElib / Fluid dyn solver / Atmosphere / Regional nonhydrostatic model / HEVE
3!!
4!! @par Description
5!! HEVE DGM scheme for Atmospheric dynamical process.
6!! The governing equations is a fully compressible nonhydrostatic equations,
7!! which consist of mass, momentum, and thermodynamics (total energy conservation) equations.
8!!
9!! @author Yuta Kawai, Team SCALE
10!<
11!-------------------------------------------------------------------------------
12#include "scaleFElib.h"
14 !-----------------------------------------------------------------------------
15 !
16 !++ Used modules
17 !
18 use scale_precision
19 use scale_io
20 use scale_prc
21 use scale_prof
22 use scale_const, only: &
23 grav => const_grav, &
24 rdry => const_rdry, &
25 cpdry => const_cpdry, &
26 cvdry => const_cvdry, &
27 pres00 => const_pre00
28
30 use scale_element_base, only: &
39
43 dens_vid => prgvar_ddens_id, etot_vid => prgvar_etot_id, &
44 momx_vid => prgvar_momx_id, momy_vid => prgvar_momy_id, &
45 momz_vid => prgvar_momz_id, &
47
48 !-----------------------------------------------------------------------------
49 implicit none
50 private
51 !-----------------------------------------------------------------------------
52 !
53 !++ Public procedures
54 !
58
59 !-----------------------------------------------------------------------------
60 !
61 !++ Public parameters & variables
62 !
63
64 !-----------------------------------------------------------------------------
65 !
66 !++ Private procedures & variables
67 !
68 !-------------------
69
70contains
72 implicit none
73 class(meshbase3d), intent(in) :: mesh
74 !--------------------------------------------
75
77 return
79
80
82 implicit none
83 !--------------------------------------------
84
86 return
88
89 !-------------------------------
90
91!OCL SERIAL
93 DENS_dt, MOMX_dt, MOMY_dt, MOMZ_dt, ETot_dt, & ! (out)
94 ddens_, momx_, momy_, momz_, etot_, dpres_, & ! (in)
95 dens_hyd, pres_hyd, pres_hyd_ref, therm_hyd, & ! (in)
96 coriolis, rtot, cvtot, cptot, dphyddx, dphyddy, & ! (in)
97 element3d_operation, dx, dy, dz, sx, sy, sz, lift, & ! (in)
98 lmesh, elem, lmesh2d, elem2d ) ! (in)
99
102
103 implicit none
104
105 class(localmesh3d), intent(in) :: lmesh
106 class(elementbase3d), intent(in) :: elem
107 class(localmesh2d), intent(in) :: lmesh2d
108 class(elementbase2d), intent(in) :: elem2d
109 class(elementoperationbase3d), intent(in) :: element3d_operation
110 type(sparsemat), intent(in) :: dx, dy, dz, sx, sy, sz, lift
111 real(rp), intent(out) :: dens_dt(elem%np,lmesh%nea)
112 real(rp), intent(out) :: momx_dt(elem%np,lmesh%nea)
113 real(rp), intent(out) :: momy_dt(elem%np,lmesh%nea)
114 real(rp), intent(out) :: momz_dt(elem%np,lmesh%nea)
115 real(rp), intent(out) :: etot_dt(elem%np,lmesh%nea)
116 real(rp), intent(in) :: ddens_(elem%np,lmesh%nea)
117 real(rp), intent(in) :: momx_(elem%np,lmesh%nea)
118 real(rp), intent(in) :: momy_(elem%np,lmesh%nea)
119 real(rp), intent(in) :: momz_(elem%np,lmesh%nea)
120 real(rp), intent(in) :: etot_(elem%np,lmesh%nea)
121 real(rp), intent(in) :: dpres_(elem%np,lmesh%nea)
122 real(rp), intent(in) :: dens_hyd(elem%np,lmesh%nea)
123 real(rp), intent(in) :: pres_hyd(elem%np,lmesh%nea)
124 real(rp), intent(in) :: pres_hyd_ref(elem%np,lmesh%nea)
125 real(rp), intent(in) :: therm_hyd(elem%np,lmesh%nea)
126 real(rp), intent(in) :: coriolis(elem2d%np,lmesh2d%nea)
127 real(rp), intent(in) :: rtot(elem%np,lmesh%nea)
128 real(rp), intent(in) :: cvtot(elem%np,lmesh%nea)
129 real(rp), intent(in) :: cptot(elem%np,lmesh%nea)
130 real(rp), intent(in) :: dphyddx(elem%np,lmesh%nea)
131 real(rp), intent(in) :: dphyddy(elem%np,lmesh%nea)
132
133 real(rp) :: fx(elem%np), fy(elem%np), fz(elem%np), liftdelflx(elem%np)
134 real(rp) :: dpres_hyd(elem%np), gradphyd_x(elem%np), gradphyd_y(elem%np)
135 real(rp) :: del_flux(elem%nfptot,lmesh%ne,prgvar_num)
136 real(rp) :: del_flux_hyd(elem%nfptot,lmesh%ne,2)
137 real(rp) :: rdens_(elem%np), u_(elem%np), v_(elem%np), w_(elem%np), wt_(elem%np)
138 real(rp) :: cori(elem%np)
139 real(rp) :: drho(elem%np)
140 real(rp) :: gsqrtv(elem%np), rgsqrtv(elem%np)
141
142 integer :: ke, ke2d
143
144 real(rp) :: gamm, rgamm
145 real(rp) :: rp0
146 real(rp) :: rovp0, p0ovr
147
148 real(rp) :: enthalpy_(elem%np)
149 !------------------------------------------------------------------------
150
151 call prof_rapstart('cal_dyn_tend_bndflux', 3)
152 call get_ebnd_flux( &
153 del_flux, del_flux_hyd, & ! (out)
154 ddens_, momx_, momy_, momz_, etot_, dpres_, dens_hyd, pres_hyd, & ! (in)
155 rtot, cvtot, cptot, & ! (in)
156 lmesh%Gsqrt, lmesh%GI3(:,:,1), lmesh%GI3(:,:,2), lmesh%zlev(:,:), & ! (in)
157 lmesh%normal_fn(:,:,1), lmesh%normal_fn(:,:,2), lmesh%normal_fn(:,:,3), & ! (in)
158 lmesh%vmapM, lmesh%vmapP, & ! (in)
159 lmesh, elem, lmesh2d, elem2d ) ! (in)
160 call prof_rapend('cal_dyn_tend_bndflux', 3)
161
162 !-----
163 call prof_rapstart('cal_dyn_tend_interior', 3)
164 gamm = cpdry / cvdry
165 rgamm = cvdry / cpdry
166 rp0 = 1.0_rp / pres00
167 rovp0 = rdry * rp0
168 p0ovr = pres00 / rdry
169
170 !$omp parallel do private( ke, ke2d, Cori, &
171 !$omp rdens_, u_, v_, w_, wt_, &
172 !$omp enthalpy_, drho, &
173 !$omp DPRES_hyd, GradPhyd_x, GradPhyd_y, &
174 !$omp GsqrtV, RGsqrtV, &
175 !$omp Fx, Fy, Fz, LiftDelFlx )
176 do ke = lmesh%NeS, lmesh%NeE
177 !--
178 ke2d = lmesh%EMap3Dto2D(ke)
179 cori(:) = coriolis(elem%IndexH2Dto3D(:),ke2d)
180
181 gsqrtv(:) = lmesh%Gsqrt(:,ke) / lmesh%GsqrtH(elem%IndexH2Dto3D,ke2d)
182 rgsqrtv(:) = 1.0_rp / gsqrtv(:)
183
184 !--
185 rdens_(:) = 1.0_rp / (ddens_(:,ke) + dens_hyd(:,ke))
186 u_(:) = momx_(:,ke) * rdens_(:)
187 v_(:) = momy_(:,ke) * rdens_(:)
188 w_(:) = momz_(:,ke) * rdens_(:)
189 wt_(:) = w_(:) * rgsqrtv(:) + lmesh%GI3(:,ke,1) * u_(:) + lmesh%GI3(:,ke,2) * v_(:)
190
191 ! DPRES_(:) = ( CPtot(:,ke) / CVtot(:,ke) - 1.0_RP ) &
192 ! * ( ETOT_(:,ke) - Grav * ( DDENS_(:,ke) + DENS_hyd(:,ke) ) * lmesh%zlev(:,ke) &
193 ! - 0.5_RP * ( MOMX_(:,ke) * u_(:) + MOMY_(:,ke) * v_(:) + MOMZ_(:,ke) * w_(:) ) ) &
194 ! - PRES_hyd(:,ke)
195
196 enthalpy_(:) = etot_(:,ke) + pres_hyd(:,ke) + dpres_(:,ke)
197
198 drho(:) = matmul(intrpmat_vpordm1, ddens_(:,ke))
199
200 !-- Gradient hydrostatic pressure
201
202 dpres_hyd(:) = pres_hyd(:,ke) - pres_hyd_ref(:,ke)
203
204 call sparsemat_matmul(dx, gsqrtv(:) * dpres_hyd(:), fx)
205 call sparsemat_matmul(dz, gsqrtv(:) * lmesh%GI3(:,ke,1) * dpres_hyd(:), fz)
206 call sparsemat_matmul(lift, lmesh%Fscale(:,ke) * del_flux_hyd(:,ke,1), liftdelflx)
207 gradphyd_x(:) = lmesh%Escale(:,ke,1,1) * fx(:) &
208 + lmesh%Escale(:,ke,3,3) * fz(:) &
209 + liftdelflx(:)
210
211 call sparsemat_matmul(dy, gsqrtv(:) * dpres_hyd(:), fy)
212 call sparsemat_matmul(dz, gsqrtv(:) * lmesh%GI3(:,ke,2) * dpres_hyd(:), fz)
213 call sparsemat_matmul(lift, lmesh%Fscale(:,ke) * del_flux_hyd(:,ke,2), liftdelflx)
214 gradphyd_y(:) = lmesh%Escale(:,ke,2,2) * fy(:) &
215 + lmesh%Escale(:,ke,3,3) * fz(:) &
216 + liftdelflx(:)
217
218 !-- DENS
219 call sparsemat_matmul(dx, lmesh%Gsqrt(:,ke) * momx_(:,ke), fx)
220 call sparsemat_matmul(dy, lmesh%Gsqrt(:,ke) * momy_(:,ke), fy)
221 call sparsemat_matmul(dz, lmesh%Gsqrt(:,ke) * ( ddens_(:,ke) + dens_hyd(:,ke) ) * wt_(:), fz)
222 call sparsemat_matmul(lift, lmesh%Fscale(:,ke) * del_flux(:,ke,dens_vid), liftdelflx)
223
224 dens_dt(:,ke) = - ( &
225 lmesh%Escale(:,ke,1,1) * fx(:) &
226 + lmesh%Escale(:,ke,2,2) * fy(:) &
227 + lmesh%Escale(:,ke,3,3) * fz(:) &
228 + liftdelflx(:) ) / lmesh%Gsqrt(:,ke)
229
230 !-- MOMX
231 call sparsemat_matmul(dx, lmesh%Gsqrt(:,ke) * ( u_(:) * momx_(:,ke) + dpres_(:,ke) ), fx)
232 call sparsemat_matmul(dy, lmesh%Gsqrt(:,ke) * v_(:) * momx_(:,ke) , fy)
233 call sparsemat_matmul(dz, lmesh%Gsqrt(:,ke) * ( wt_(:) * momx_(:,ke) &
234 + lmesh%GI3(:,ke,1) * dpres_(:,ke) ), fz)
235 call sparsemat_matmul(lift, lmesh%Fscale(:,ke) * del_flux(:,ke,momx_vid), liftdelflx)
236
237 momx_dt(:,ke) = &
238 - ( lmesh%Escale(:,ke,1,1) * fx(:) &
239 + lmesh%Escale(:,ke,2,2) * fy(:) &
240 + lmesh%Escale(:,ke,3,3) * fz(:) &
241 + liftdelflx(:) ) / lmesh%Gsqrt(:,ke) &
242 - gradphyd_x(:) * rgsqrtv(:) &
243 + cori(:) * momy_(:,ke)
244
245 !-- MOMY
246 call sparsemat_matmul(dx, lmesh%Gsqrt(:,ke) * u_(:) * momy_(:,ke) , fx)
247 call sparsemat_matmul(dy, lmesh%Gsqrt(:,ke) * ( v_(:) * momy_(:,ke) + dpres_(:,ke) ), fy)
248 call sparsemat_matmul(dz, lmesh%Gsqrt(:,ke) * ( wt_(:) * momy_(:,ke) &
249 + lmesh%GI3(:,ke,2) * dpres_(:,ke) ), fz)
250 call sparsemat_matmul(lift, lmesh%Fscale(:,ke) * del_flux(:,ke,momy_vid), liftdelflx)
251
252 momy_dt(:,ke) = &
253 - ( lmesh%Escale(:,ke,1,1) * fx(:) &
254 + lmesh%Escale(:,ke,2,2) * fy(:) &
255 + lmesh%Escale(:,ke,3,3) * fz(:) &
256 + liftdelflx(:) ) / lmesh%Gsqrt(:,ke) &
257 - gradphyd_y(:) * rgsqrtv(:) &
258 - cori(:) * momx_(:,ke)
259
260 !-- MOMZ
261 call sparsemat_matmul(dx, lmesh%Gsqrt(:,ke) * u_(:) * momz_(:,ke), fx)
262 call sparsemat_matmul(dy, lmesh%Gsqrt(:,ke) * v_(:) * momz_(:,ke), fy)
263 call sparsemat_matmul(dz, lmesh%Gsqrt(:,ke) * ( wt_(:) * momz_(:,ke) &
264 + rgsqrtv(:) * dpres_(:,ke) ), fz)
265 call sparsemat_matmul(lift, lmesh%Fscale(:,ke) * del_flux(:,ke,momz_vid), liftdelflx)
266
267 momz_dt(:,ke) = &
268 - ( lmesh%Escale(:,ke,1,1) * fx(:) &
269 + lmesh%Escale(:,ke,2,2) * fy(:) &
270 + lmesh%Escale(:,ke,3,3) * fz(:) &
271 + liftdelflx(:) ) / lmesh%Gsqrt(:,ke) &
272 - grav * drho(:)
273
274 !-- ETOT
275 call sparsemat_matmul(dx, lmesh%Gsqrt(:,ke) * u_(:) * enthalpy_(:), fx)
276 call sparsemat_matmul(dy, lmesh%Gsqrt(:,ke) * v_(:) * enthalpy_(:), fy)
277 call sparsemat_matmul(dz, lmesh%Gsqrt(:,ke) * wt_(:) * enthalpy_(:), fz)
278 call sparsemat_matmul(lift, lmesh%Fscale(:,ke) * del_flux(:,ke,etot_vid), liftdelflx)
279
280 etot_dt(:,ke) = &
281 - ( lmesh%Escale(:,ke,1,1) * fx(:) &
282 + lmesh%Escale(:,ke,2,2) * fy(:) &
283 + lmesh%Escale(:,ke,3,3) * fz(:) &
284 + liftdelflx(:) ) / lmesh%Gsqrt(:,ke)
285 end do
286
287 call prof_rapend('cal_dyn_tend_interior', 3)
288
289 return
291
module FElib / Fluid dyn solver / Atmosphere / Nonhydrostatic model / Common
subroutine, public atm_dyn_dgm_nonhydro3d_common_init(mesh)
Initialize a common module for atmospheric nonhydrostatic dynamical core.
real(rp), dimension(:,:), allocatable, public intrpmat_vpordm1
subroutine, public atm_dyn_dgm_nonhydro3d_common_final()
Finalize a common module for atmospheric nonhydrostatic dynamical core.
module FElib / Fluid dyn solver / Atmosphere / Nonhydrostatic model / Numflux
subroutine, public atm_dyn_dgm_nonhydro3d_etot_heve_numflux_get_generalvc(del_flux, del_flux_hyd, ddens_, momx_, momy_, momz_, etot_, dpres_, dens_hyd, pres_hyd, rtot, cvtot, cptot, gsqrt, g13, g23, zlev, nx, ny, nz, vmapm, vmapp, lmesh, elem, lmesh2d, elem2d)
module FElib / Fluid dyn solver / Atmosphere / Regional nonhydrostatic model / HEVE
subroutine, public atm_dyn_dgm_nonhydro3d_etot_heve_cal_tend(dens_dt, momx_dt, momy_dt, momz_dt, etot_dt, ddens_, momx_, momy_, momz_, etot_, dpres_, dens_hyd, pres_hyd, pres_hyd_ref, therm_hyd, coriolis, rtot, cvtot, cptot, dphyddx, dphyddy, element3d_operation, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d)
module FElib / Element / Base
module FElib / Element / hexahedron
module FElib / Element / Operation / Base
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
module FElib / Mesh / Base 3D
module FElib / Data / base
Module common / sparsemat.
Derived type representing a 2D reference element.
Derived type representing a 3D reference element.
Derived type representing a hexahedral 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 3D local mesh.
Derived type to manage a computational mesh (base type for 3D domain)
Derived type representing a field with 3D mesh.
Derived type to manage a sparse matrix.