From 28ce0fdb5202ff37dcb4ab68c34f8268cb5c1047 Mon Sep 17 00:00:00 2001 From: Nick Featherstone Date: Tue, 11 Jun 2024 16:45:00 -0600 Subject: [PATCH] added check to ensure file is open before writing and closing file in write_to_disk --- src/IO/Spherical_IO.F90 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/IO/Spherical_IO.F90 b/src/IO/Spherical_IO.F90 index 3f72fb12..0f664350 100755 --- a/src/IO/Spherical_IO.F90 +++ b/src/IO/Spherical_IO.F90 @@ -776,11 +776,12 @@ Subroutine Write_to_Disk(self,this_iter,simtime) ! 12 is for the simtime+iteration at the end. full_disp = self%buffer%qdisp*self%buffer%nvals+12 new_disp = self%hdisp+full_disp*(self%current_rec-ncache) - !If (responsible) Write(6,*)'check disp: ', self%buffer%qdisp, self%buffer%ncache, self%buffer%spectral - Call self%buffer%write_data(disp=new_disp,file_unit=funit) - Call self%buffer%reset_cache_index() - If (output_rank) Call self%closefile_par() + If (self%file_open) Then + Call self%buffer%write_data(disp=new_disp,file_unit=funit) + Call self%buffer%reset_cache_index() + If (output_rank) Call self%closefile_par() + Endif Endif