From 710ba2285b217146d44f76b55b8d691df4cfe897 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Wed, 5 Jun 2024 08:21:32 +0200 Subject: [PATCH] Philippe 05/06/2024: bugfix: XSSUFL and others: allocate only once and only when necessary --- src/MNH/ini_modeln.f90 | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/MNH/ini_modeln.f90 b/src/MNH/ini_modeln.f90 index aad37b9c5..73260de51 100644 --- a/src/MNH/ini_modeln.f90 +++ b/src/MNH/ini_modeln.f90 @@ -2981,16 +2981,19 @@ END IF !* 33. Auto-coupling Atmos-Ocean LES NH ! ! Atmos Flux at interface -IF (LCOUPLES.AND.(.NOT.LOCEAN)) THEN - ALLOCATE(XSSUFL(IIU,IJU)); XSSUFL=0.0 - ALLOCATE(XSSVFL(IIU,IJU)); XSSVFL=0.0 - ALLOCATE(XSSTFL(IIU,IJU)); XSSTFL=0.0 - ALLOCATE(XSSRFL(IIU,IJU)); XSSRFL=0.0 -ELSE - ALLOCATE(XSSUFL(0,0)) - ALLOCATE(XSSVFL(0,0)) - ALLOCATE(XSSTFL(0,0)) - ALLOCATE(XSSRFL(0,0)) +! Allocate to a non-zero size only if LCOUPLES=T. It must be allocated only once (=>IF KMI==1) +IF ( KMI == 1 ) THEN + IF ( LCOUPLES ) THEN + ALLOCATE( XSSUFL(IIU,IJU) ); XSSUFL=0.0 + ALLOCATE( XSSVFL(IIU,IJU) ); XSSVFL=0.0 + ALLOCATE( XSSTFL(IIU,IJU) ); XSSTFL=0.0 + ALLOCATE( XSSRFL(IIU,IJU) ); XSSRFL=0.0 + ELSE + ALLOCATE( XSSVFL(0,0) ) + ALLOCATE( XSSTFL(0,0) ) + ALLOCATE( XSSRFL(0,0) ) + ALLOCATE( XSSUFL(0,0) ) + END IF END IF ! END SUBROUTINE INI_MODEL_n -- GitLab