NOAA-PSL / stochastic_physics

Contains the stochastic physics pattern generator for the Unified Forecast System
Other
6 stars 41 forks source link

add finalize subroutine for stochastic physics #32

Closed pjpegion closed 3 years ago

pjpegion commented 3 years ago

This a new feature to add a finalize subroutine to deallocate array at the end of a run. Associated with PRs https://github.com/NOAA-EMC/fv3atm/pull/199 and https://github.com/ufs-community/ufs-weather-model/issues/278

HenryRWinterbottom commented 3 years ago

I would strongly suggest adding if-deftype statements to this PR. For example, instead of:

deallocate(variable)

do:

if(allocated(variable)) deallocate(variable)

This better protects the code from possible and difficult to chase segmentation faults in the future -- at least based on my experience.

pjpegion commented 3 years ago

@HenryWinterbottom-NOAA good point, I thought about doing it, but was just lazy.

HenryRWinterbottom commented 3 years ago

@pjpegion If you are planning to do it, just send me a note (or submit a new PR) and I am happy to approve.

pjpegion commented 3 years ago

@HenryWinterbottom-NOAA I added the if (allocated()) conditionals

pjpegion commented 3 years ago

Looks like the changes you are suggesting are for the fv3atm PR.

climbfuji commented 3 years ago

Looks like the changes you are suggesting are for the fv3atm PR.

Yes, sorry.