Skip to content

Commit 02b9712

Browse files
authored
Release stable iaufix (MPAS-Dev#31)
Bug fixes in IAU merged into the latest version of release-stable The major bug fix is to include the increment in dry density in updating the tendency for the coupled edge winds (ru). In the equation of d(r * u) = r * du + dr * u, the second term (dr*u) in RHS was missing in the original code. To add it back in, I also modified the code defining several new variables such as u, cellsOnEdge and rho_amb_edge. mpas_atm_iau.F: A bug fixed in tend_ru (tendencies for coupled edge winds) mpas_atm_core.F: A log message added for the IAU input stream Tests passed.
1 parent 1ef7305 commit 02b9712

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/core_atmosphere/dynamics/mpas_atm_iau.F

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,17 @@ real (kind=RKIND) function atm_iau_coef(configs, itimestep, dt) result(wgt_iau)
6464

6565
if(trim(iau_opt) == 'on') then ! HA: We should be able to expand this for more options later on.
6666

67-
nsteps_iau = nint(time_window_sec / dt)
67+
nsteps_iau = nint(time_window_sec / dt) ! how many steps to which analysis increments (=Xamb) are applied.
6868
!if(debug) call mpas_log_write('atm_compute_iau_coef: nsteps_iau = $i', intArgs=(/nsteps_iau/))
6969

70+
! In the atm_add_tend_anal_incr subroutine, the weight function (wgt_iau) will be applied as below.
71+
! f_wgt = 1/nsteps_iau = dt/time_window_sec ! this can be expanded for 4DIAU later.
72+
! dX/dt = Xamb/dt * f_wgt
73+
! = Xamb/dt * dt/time_window_sec
74+
! = Xamb/time_window_sec
75+
!=> dX/dt = Xamb * wgt_iau where wgt_iau = 1 / time_window_sec
76+
7077
if(itimestep <= nsteps_iau) then
71-
!wgt_iau = 1./nsteps_iau
7278
wgt_iau = 1.0_RKIND / time_window_sec
7379
if(debug) call mpas_log_write('atm_compute_iau_coef: wgt_iau = $r', realArgs=(/wgt_iau/))
7480
end if
@@ -98,9 +104,13 @@ subroutine atm_add_tend_anal_incr (configs, structs, itimestep, dt, tend_ru, ten
98104
type (mpas_pool_type), pointer :: mesh
99105

100106
integer :: iEdge, iCell, i, j, k, n
107+
integer :: cell1, cell2 ! added by Soyoung (Jan-13-2022)
101108
integer, pointer :: nCells, nEdges, nCellsSolve, nEdgesSolve, nVertLevels
102109
integer, pointer:: index_qv
103110
integer, pointer:: moist_start, moist_end
111+
integer, dimension(:,:), pointer :: cellsOnEdge ! added by Soyoung (Jan-13-2022)
112+
real (kind=RKIND) :: rho_amb_edge ! added by Soyoung (Jan-14-2022)
113+
! Soyoung: amb stands for A-minus-B (e.g., analysis increments) in this module.
104114

105115
real (kind=RKIND), dimension(:,:), pointer :: rho_edge, rho_zz, theta_m, theta, u, zz, &
106116
tend_th, tend_w
@@ -132,11 +142,13 @@ subroutine atm_add_tend_anal_incr (configs, structs, itimestep, dt, tend_ru, ten
132142
call mpas_pool_get_dimension(mesh, 'nVertLevels', nVertLevels)
133143

134144
call mpas_pool_get_array(mesh, 'zz', zz)
145+
call mpas_pool_get_array(mesh, 'cellsOnEdge', cellsOnEdge) ! added by Soyoung (Jan-13-2022)
135146

136147
call mpas_pool_get_array(state, 'theta_m', theta_m, 1)
137148
call mpas_pool_get_array(state, 'scalars', scalars, 1)
138149
call mpas_pool_get_array(state, 'rho_zz', rho_zz, 2)
139150
call mpas_pool_get_array(diag , 'rho_edge', rho_edge)
151+
call mpas_pool_get_array(state, 'u', u, 1) ! added by Soyoung (Jan-13-2022)
140152

141153
call mpas_pool_get_dimension(state, 'moist_start', moist_start)
142154
call mpas_pool_get_dimension(state, 'moist_end', moist_end)
@@ -166,8 +178,11 @@ subroutine atm_add_tend_anal_incr (configs, structs, itimestep, dt, tend_ru, ten
166178

167179
! add coupled tendencies for u on edges
168180
do i = 1, nEdgesSolve
181+
cell1 = cellsOnEdge(1,i) ! added by Soyoung (Jan-13-2022)
182+
cell2 = cellsOnEdge(2,i) ! added by Soyoung (Jan-13-2022)
169183
do k = 1, nVertLevels
170-
tend_ru(k,i) = tend_ru(k,i) + wgt_iau * rho_edge(k,i) * u_amb(k,i)
184+
rho_amb_edge = 0.5_RKIND * (rho_amb(k,cell1)/zz(k,cell1) + rho_amb(k,cell2)/zz(k,cell2)) ! added by Soyoung (Jan-14-2022)
185+
tend_ru(k,i) = tend_ru(k,i) + wgt_iau * (rho_edge(k,i) * u_amb(k,i) + rho_amb_edge * u(k,i)) ! added by Soyoung (Jan-14-2022)
171186
enddo
172187
enddo
173188

src/core_atmosphere/mpas_atm_core.F

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ function atm_core_init(domain, startTimeStamp) result(ierr)
132132
call mpas_log_write('********************************************************************************', messageType=MPAS_LOG_ERR)
133133
call mpas_log_write('Error reading IAU files', messageType=MPAS_LOG_ERR)
134134
call mpas_log_write('********************************************************************************', messageType=MPAS_LOG_CRIT)
135+
else ! Added by Soyoung on Jan-2022
136+
call mpas_log_write('*********************************')
137+
call mpas_log_write('Done reading the IAU input stream')
138+
call mpas_log_write('*********************************')
135139
end if
136140
call MPAS_stream_mgr_reset_alarms(domain % streamManager, streamID='iau', ierr=ierr)
137141

0 commit comments

Comments
 (0)