From c5905193780f688279e613ee8e5821963062b6c6 Mon Sep 17 00:00:00 2001
From: Juan ESCOBAR <juan.escobar@aero.obs-mip.fr>
Date: Fri, 24 Nov 2023 18:10:31 +0100
Subject: [PATCH] Juan 24/11/2023:multigrid.f90 , Temporarely Bypass Seg-Fault
 at deallocation of Multigrid variable in mg_finalise

---
 .../multigrid.f90                             | 27 ++++++++++---------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/LIB/tensorproductmultigrid_Source/multigrid.f90 b/src/LIB/tensorproductmultigrid_Source/multigrid.f90
index ff1a75b0f..c00d329c1 100644
--- a/src/LIB/tensorproductmultigrid_Source/multigrid.f90
+++ b/src/LIB/tensorproductmultigrid_Source/multigrid.f90
@@ -451,13 +451,13 @@ contains
           call print_elapsed(t_coarsesolve(level,m),.True.,1.0_rl)
           call print_elapsed(t_total(level,m),.True.,1.0_rl)
        endif
-      if (LUseO) then
+      if (LUseO .AND. .FALSE. ) then
       deallocate(xu_mg(level,m)%s)
       deallocate(xb_mg(level,m)%s)
       deallocate(xr_mg(level,m)%s)
       endif
 
-      if (LUseT) then
+      if (LUseT .AND. .FALSE. ) then
          !$acc exit data delete(xu_mg(level,m)%st)  
          deallocate(xu_mg(level,m)%st)
          !
@@ -478,16 +478,19 @@ contains
       reduced_m = .false.
       level = level-1
     end do
-    deallocate(xu_mg)
-    deallocate(xb_mg)
-    deallocate(xr_mg)
-    deallocate(t_total)
-    deallocate(t_smooth)
-    deallocate(t_restrict)
-    deallocate(t_prolongate)
-    deallocate(t_residual)
-    deallocate(t_addcorr)
-    deallocate(t_coarsesolve)
+
+    IF (.FALSE.) then 
+       deallocate(xu_mg)
+       deallocate(xb_mg)
+       deallocate(xr_mg)
+       deallocate(t_total)
+       deallocate(t_smooth)
+       deallocate(t_restrict)
+       deallocate(t_prolongate)
+       deallocate(t_residual)
+       deallocate(t_addcorr)
+       deallocate(t_coarsesolve)
+    END IF
     !if ( (i_am_master_mpi) ) write(STDOUT,'("")')
     if ( (i_am_master_mpi) .and. (mg_param%verbose >= 10) ) write(STDOUT,'("")')    
   end subroutine mg_finalise
-- 
GitLab