Skip to content

Commit

Permalink
Fix memory errors: uninitialized variables, and NetCDF writes to arra…
Browse files Browse the repository at this point in the history
…ys that are too small (#668)

* move utility routines, data structures, and name generation out of FV3GFS_io.F90

* move RRFS SD state restart io to separate file and rename clm_lake_io.F90

* move rrfs sd emissions input code to FV3GFS_rrfs_sd_io.F90

* register sfc fields in FV3GFS_sfc_io.F90

* move oro reading to FV3GFS_oro_io.F90

* gwd I/O in FV3GFS_oro_io.F90

* store quilt restart data structures in FV3GFS_sfc_io types

* rrfs sd restart in quilt (still under testing)

* bug fixes for RRFS 32-bit physics
  • Loading branch information
SamuelTrahanNOAA authored Jul 10, 2023
1 parent 0bff645 commit 67e146d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6821,13 +6821,21 @@ subroutine grid_create (Grid, IM, Model)
allocate (Grid%ddy_o3 (IM))
allocate (Grid%jindx1_o3 (IM))
allocate (Grid%jindx2_o3 (IM))

Grid%ddy_o3 = clear_val
Grid%jindx1_o3 = clear_val
Grid%jindx2_o3 = clear_val
endif

!--- stratosphere h2o active
if ( Model%h2o_phys ) then
allocate (Grid%ddy_h (IM))
allocate (Grid%jindx1_h (IM))
allocate (Grid%jindx2_h (IM))

Grid%ddy_h = clear_val
Grid%jindx1_h = clear_val
Grid%jindx2_h = clear_val
endif

!--- iccn active
Expand All @@ -6838,6 +6846,13 @@ subroutine grid_create (Grid, IM, Model)
allocate (Grid%ddx_ci (IM))
allocate (Grid%iindx1_ci (IM))
allocate (Grid%iindx2_ci (IM))

Grid%ddy_ci = clear_val
Grid%jindx1_ci = clear_val
Grid%jindx2_ci = clear_val
Grid%ddx_ci = clear_val
Grid%iindx1_ci = clear_val
Grid%iindx2_ci = clear_val
endif

!--- iaerclm active
Expand All @@ -6848,6 +6863,13 @@ subroutine grid_create (Grid, IM, Model)
allocate (Grid%ddx_aer (IM))
allocate (Grid%iindx1_aer(IM))
allocate (Grid%iindx2_aer(IM))

Grid%ddy_aer = clear_val
Grid%jindx1_aer = clear_val
Grid%jindx2_aer = clear_val
Grid%ddx_aer = clear_val
Grid%iindx1_aer = clear_val
Grid%iindx2_aer = clear_val
endif

!--- Model%do_ugwpv1
Expand All @@ -6856,6 +6878,11 @@ subroutine grid_create (Grid, IM, Model)
allocate (Grid%ddy_j2tau (IM))
allocate (Grid%jindx1_tau (IM))
allocate (Grid%jindx2_tau (IM))

Grid%ddy_j1tau = clear_val
Grid%ddy_j2tau = clear_val
Grid%jindx1_tau = clear_val
Grid%jindx2_tau = clear_val
endif

end subroutine grid_create
Expand Down
2 changes: 1 addition & 1 deletion ccpp/physics

0 comments on commit 67e146d

Please sign in to comment.