Skip to content

Commit

Permalink
add allocate status checks
Browse files Browse the repository at this point in the history
        modified:   src/chemistry/aerosol/modal_aerosol_properties_mod.F90
  • Loading branch information
fvitt committed Sep 18, 2024
1 parent b376b2d commit a576635
Showing 1 changed file with 45 additions and 9 deletions.
54 changes: 45 additions & 9 deletions src/chemistry/aerosol/modal_aerosol_properties_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,36 @@ function constructor() result(newobj)
newobj%num_poa_ = npoa
newobj%num_bc_ = nbc

allocate(newobj%sulfate_mode_ndxs_(newobj%nbins()))
allocate(newobj%dust_mode_ndxs_(newobj%nbins()))
allocate(newobj%ssalt_mode_ndxs_(newobj%nbins()))
allocate(newobj%ammon_mode_ndxs_(newobj%nbins()))
allocate(newobj%nitrate_mode_ndxs_(newobj%nbins()))
allocate(newobj%msa_mode_ndxs_(newobj%nbins()))
allocate(newobj%sulfate_mode_ndxs_(newobj%nbins()),stat=ierr)
if( ierr /= 0 ) then
nullify(newobj)
return
end if
allocate(newobj%dust_mode_ndxs_(newobj%nbins()),stat=ierr)
if( ierr /= 0 ) then
nullify(newobj)
return
end if
allocate(newobj%ssalt_mode_ndxs_(newobj%nbins()),stat=ierr)
if( ierr /= 0 ) then
nullify(newobj)
return
end if
allocate(newobj%ammon_mode_ndxs_(newobj%nbins()),stat=ierr)
if( ierr /= 0 ) then
nullify(newobj)
return
end if
allocate(newobj%nitrate_mode_ndxs_(newobj%nbins()),stat=ierr)
if( ierr /= 0 ) then
nullify(newobj)
return
end if
allocate(newobj%msa_mode_ndxs_(newobj%nbins()),stat=ierr)
if( ierr /= 0 ) then
nullify(newobj)
return
end if

newobj%sulfate_mode_ndxs_ = 0
newobj%dust_mode_ndxs_ = 0
Expand All @@ -196,9 +220,21 @@ function constructor() result(newobj)
newobj%nitrate_mode_ndxs_ = 0
newobj%msa_mode_ndxs_ = 0

allocate(newobj%porganic_mode_ndxs_(newobj%nbins(),npoa))
allocate(newobj%sorganic_mode_ndxs_(newobj%nbins(),nsoa))
allocate(newobj%bcarbon_mode_ndxs_(newobj%nbins(),nbc))
allocate(newobj%porganic_mode_ndxs_(newobj%nbins(),npoa),stat=ierr)
if( ierr /= 0 ) then
nullify(newobj)
return
end if
allocate(newobj%sorganic_mode_ndxs_(newobj%nbins(),nsoa),stat=ierr)
if( ierr /= 0 ) then
nullify(newobj)
return
end if
allocate(newobj%bcarbon_mode_ndxs_(newobj%nbins(),nbc),stat=ierr)
if( ierr /= 0 ) then
nullify(newobj)
return
end if

newobj%porganic_mode_ndxs_ = 0._r8
newobj%sorganic_mode_ndxs_ = 0._r8
Expand Down

0 comments on commit a576635

Please sign in to comment.