From 380017cee696dd1d9ff2cf9db318ed41b999e5cc Mon Sep 17 00:00:00 2001 From: cflag Date: Mon, 22 Apr 2024 05:54:50 +0200 Subject: [PATCH] Release the memory allocated in the mhd module --- src/mhd.f90 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mhd.f90 b/src/mhd.f90 index ab2e9ac2d..c5569acb6 100644 --- a/src/mhd.f90 +++ b/src/mhd.f90 @@ -87,8 +87,17 @@ subroutine mhd_fin() implicit none + ! Close the IO unit opened in the subroutine mhd_sta if (nrank==0) close(mhd_iounit) + ! Release memory + if (allocated(Bmean)) deallocate(Bmean) + if (allocated(Bm)) deallocate(Bm) + if (allocated(magelf)) deallocate(magelf) + if (allocated(Je)) deallocate(Je) + if (allocated(dBm)) deallocate(dBm) + if (allocated(elcpot)) deallocate(elcpot) + end subroutine mhd_fin ! subroutine int_time_magnet