From eda8ef3a6dfe23ddd91b8d849973a99ed8726c5e Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Fri, 9 Dec 2022 11:41:30 +0100
Subject: [PATCH] Philippe 09/12/2022: flyers: correction for 'FIX' aircrafts
 if store timestep smaller than model 1 timestep

---
 src/MNH/aircraft_balloon_evol.f90 | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/MNH/aircraft_balloon_evol.f90 b/src/MNH/aircraft_balloon_evol.f90
index 8b6383b57..933c9c319 100644
--- a/src/MNH/aircraft_balloon_evol.f90
+++ b/src/MNH/aircraft_balloon_evol.f90
@@ -239,8 +239,12 @@ CALL GET_MODEL_NUMBER_ll(IMI)
 
 SELECT TYPE ( TPFLYER )
   CLASS IS ( TAIRCRAFTDATA)
-    !Do the positioning only if model 1 (data will be available to others after)
-    MODEL1AIR: IF ( IMI == 1 ) THEN
+    ! For 'MOB' aircrafts, do the positioning only if model 1 (data will be available to others after)
+    !     aircraft store timestep is always a multiple of model 1 timestep
+    ! For 'FIX' aircrafts, do the computation only on the correct model
+    !     (important especially if store timestep is smaller than model 1 timestep)
+    IF (      ( TPFLYER%CMODEL == 'MOB' .AND. IMI == 1              ) &
+         .OR. ( TPFLYER%CMODEL == 'FIX' .AND. IMI == TPFLYER%NMODEL ) ) THEN
       !Do we have to store aircraft data?
       CALL FLYER_CHECK_STORESTEP( TPFLYER )
 
@@ -256,7 +260,8 @@ SELECT TYPE ( TPFLYER )
       ELSE
         TPFLYER%LFLY = .FALSE.
       END IF
-    END IF MODEL1AIR
+
+    END IF
 
     ! For aircrafts, data has only to be computed at store moments
     IF ( IMI == TPFLYER%NMODEL .AND. TPFLYER%LFLY .AND. TPFLYER%LSTORE ) THEN
-- 
GitLab