Skip to content

Commit

Permalink
fix access violation crash
Browse files Browse the repository at this point in the history
  • Loading branch information
likeuclinux committed Dec 3, 2024
1 parent d66e442 commit 069fad0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 22 deletions.
1 change: 1 addition & 0 deletions dyn_em/start_em.F
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,7 @@ SUBROUTINE start_domain_em ( grid, allowed_to_read &
#endif
DEALLOCATE(z_at_q)
DEALLOCATE(dz8w)
IF (config_flags%p_lev_diags == PRESS_DIAGS ) THEN
CALL wrf_debug ( 200 , ' PLD: pressure level diags' )
Expand Down
47 changes: 27 additions & 20 deletions phys/module_bl_ysu.F
Original file line number Diff line number Diff line change
Expand Up @@ -353,27 +353,34 @@ subroutine ysu(u3d,v3d,t3d,qv3d,qc3d,qi3d,p3d,p3di,pi3d, &
present(b_v_bep) .and. present(b_t_bep) .and. present(b_q_bep) .and. &
present(b_e_bep) .and. present(dlg_bep) .and. present(dl_u_bep) .and. &
present(sf_bep) .and. present(vl_bep) .and. present(frc_urb2d)) then
do k = kts, kte
do i = its,ite
a_u_hv(i,k) = a_u_bep(i,k,j)
a_v_hv(i,k) = a_v_bep(i,k,j)
a_t_hv(i,k) = a_t_bep(i,k,j)
a_q_hv(i,k) = a_q_bep(i,k,j)
a_e_hv(i,k) = a_e_bep(i,k,j)
b_u_hv(i,k) = b_u_bep(i,k,j)
b_v_hv(i,k) = b_v_bep(i,k,j)
b_t_hv(i,k) = b_t_bep(i,k,j)
b_q_hv(i,k) = b_q_bep(i,k,j)
b_e_hv(i,k) = b_e_bep(i,k,j)
dlg_hv(i,k) = dlg_bep(i,k,j)
dl_u_hv(i,k) = dl_u_bep(i,k,j)
vlk_hv(i,k) = vl_bep(i,k,j)
sfk_hv(i,k) = sf_bep(i,k,j)

! following v4.5 logic to fix access violation
if(flag_bep) then

do k = kts, kte
do i = its,ite
a_u_hv(i,k) = a_u_bep(i,k,j)
a_v_hv(i,k) = a_v_bep(i,k,j)
a_t_hv(i,k) = a_t_bep(i,k,j)
a_q_hv(i,k) = a_q_bep(i,k,j)
a_e_hv(i,k) = a_e_bep(i,k,j)
b_u_hv(i,k) = b_u_bep(i,k,j)
b_v_hv(i,k) = b_v_bep(i,k,j)
b_t_hv(i,k) = b_t_bep(i,k,j)
b_q_hv(i,k) = b_q_bep(i,k,j)
b_e_hv(i,k) = b_e_bep(i,k,j)
dlg_hv(i,k) = dlg_bep(i,k,j)
dl_u_hv(i,k) = dl_u_bep(i,k,j)
vlk_hv(i,k) = vl_bep(i,k,j)
sfk_hv(i,k) = sf_bep(i,k,j)
enddo
enddo
enddo
do i = its, ite
frcurb_hv(i) = frc_urb2d(i,j)
enddo
do i = its, ite
frcurb_hv(i) = frc_urb2d(i,j)
enddo

endif

endif

do i = its, ite
Expand Down
14 changes: 12 additions & 2 deletions share/wrf_timeseries.F
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,20 @@ SUBROUTINE calc_ts( grid )
ALLOCATE ( earth_u_profile(grid%max_ts_level), earth_v_profile(grid%max_ts_level) )
#endif

IF ( grid%ntsloc_domain .LE. 0 ) RETURN
IF ( grid%ntsloc_domain .LE. 0 ) THEN
#if ( EM_CORE == 1 )
DEALLOCATE(earth_u_profile, earth_v_profile)
#endif
RETURN
END IF

#if ((EM_CORE == 1) && (DA_CORE != 1))
IF ( grid%dfi_opt /= DFI_NODFI .AND. grid%dfi_stage /= DFI_FST ) RETURN
IF ( grid%dfi_opt /= DFI_NODFI .AND. grid%dfi_stage /= DFI_FST ) THEN
#if ( EM_CORE == 1 )
DEALLOCATE(earth_u_profile, earth_v_profile)
#endif
RETURN
END IF
#endif

n = grid%next_ts_time
Expand Down

0 comments on commit 069fad0

Please sign in to comment.