From c66ea1a4892c1ebeaf6a5503cc4af2b260137df0 Mon Sep 17 00:00:00 2001
From: JorisP <pianezze.joris@gmail.com>
Date: Mon, 2 Oct 2023 17:27:31 +0200
Subject: [PATCH] Move build directory for OASIS from LIB to dir_obj, modify
 current simulation time output and improve coupling ktest directory

---
 .../Create_restart_file_for_MNH.ncl           | 132 ------------------
 .../Create_restart_file_for_MNH.py            |  98 -------------
 .../1_INPUT_MNH/get_pgd_files                 |  31 ----
 .../1_INPUT_MNH/run_prep_mesonh_xyz           |  44 ------
 .../EXSEG1.nam_OCEAN                          |   0
 .../EXSEG1.nam_WAVE                           |   0
 .../PRE_IDEA1.nam                             |   0
 .../{1_INPUT_MNH => 1_input_mnh}/PRE_PGD1.nam |   0
 .../clean_prep_mesonh_xyz                     |   4 +-
 ...reate_restart_file_from_PREP_IDEAL_CASE.py | 113 +++++++++++++++
 .../1_input_mnh/get_pgd_files                 |  41 ++++++
 .../1_input_mnh/run_prep_mesonh_xyz           |  35 +++++
 .../013_Iroise_ideal_case_coupling/Makefile   |  18 +--
 src/MNH/mesonh.f90                            |   2 +-
 src/Makefile.MESONH.mk                        |   2 +-
 15 files changed, 202 insertions(+), 318 deletions(-)
 delete mode 100755 MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/Create_restart_file_for_MNH.ncl
 delete mode 100755 MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/Create_restart_file_for_MNH.py
 delete mode 100755 MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/get_pgd_files
 delete mode 100755 MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/run_prep_mesonh_xyz
 rename MY_RUN/KTEST/013_Iroise_ideal_case_coupling/{1_INPUT_MNH => 1_input_mnh}/EXSEG1.nam_OCEAN (100%)
 rename MY_RUN/KTEST/013_Iroise_ideal_case_coupling/{1_INPUT_MNH => 1_input_mnh}/EXSEG1.nam_WAVE (100%)
 rename MY_RUN/KTEST/013_Iroise_ideal_case_coupling/{1_INPUT_MNH => 1_input_mnh}/PRE_IDEA1.nam (100%)
 rename MY_RUN/KTEST/013_Iroise_ideal_case_coupling/{1_INPUT_MNH => 1_input_mnh}/PRE_PGD1.nam (100%)
 rename MY_RUN/KTEST/013_Iroise_ideal_case_coupling/{1_INPUT_MNH => 1_input_mnh}/clean_prep_mesonh_xyz (83%)
 create mode 100755 MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/create_restart_file_from_PREP_IDEAL_CASE.py
 create mode 100755 MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/get_pgd_files
 create mode 100755 MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/run_prep_mesonh_xyz

diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/Create_restart_file_for_MNH.ncl b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/Create_restart_file_for_MNH.ncl
deleted file mode 100755
index f1baa0c09..000000000
--- a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/Create_restart_file_for_MNH.ncl
+++ /dev/null
@@ -1,132 +0,0 @@
-;================================================;
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
-; ================================================;
-;##############################################
-;#============================================#
-;#      Creating restart file from prep real
-;#                 case files : mesonh model
-;#      Adapation from Create_restart_file_for_MNH.py
-;#      Author : S. Bielli
-;#      Date   :      2016
-;#============================================#
-;##############################################
-;
-begin
-;
-curdir_path=systemfunc("pwd")+"/"
-;
-file_RSTRT = curdir_path+"IROISE_5KM_201109_02_00.nc"
-a=addfile(file_RSTRT,"r")
-
-; fichier *.nc
-dims = getfilevardimsizes(a,"LON")
-print(dims)
-imax=dims(1)-2
-jmax=dims(0)-2
-LON_MNH=a->LON(1:jmax,1:imax)
-LAT_MNH=a->LAT(1:jmax,1:imax)
-U10_MNH=a->UT(0,2,1:jmax,1:imax)
-V10_MNH=a->VT(0,2,1:jmax,1:imax)
-PRES_MNH=a->PABST(0,2,1:jmax,1:imax)
-
-if(isfilevar(a,"EVAP3D")) then
-  EVAP_MNH=a->EVAP3D(1:jmax,1:imax)
-else
-  print("EVAP3D not found... imposed at 0!")
-  EVAP_MNH=new(dimsizes(LON_MNH),typeof(LON_MNH))
-  EVAP_MNH=0.
-end if
-
-if(isfilevar(a,"INPRR3D")) then
-  RAIN_MNH=a->INPRR3D(1:jmax,1:imax)
-else
-  print("INPRR3D not found... imposed at 0!")
-  RAIN_MNH=new(dimsizes(LON_MNH),typeof(LON_MNH))
-  RAIN_MNH=0.
-end if
-
-if(isfilevar(a,"FMU")) then
-  FMU_MNH=a->FMU(1:jmax,1:imax)
-  FMV_MNH=a->FMV(1:jmax,1:imax)
-  H_MNH=a->H(1:jmax,1:imax)
-  RN_MNH=a->RN(1:jmax,1:imax)
-else
-  print("Turbulent fluxes FMU, FMV, H and LE not found... imposed at 0!")
-  FMU_MNH=new(dimsizes(LON_MNH),typeof(LON_MNH))
-  FMU_MNH=0.
-  FMV_MNH=new(dimsizes(LON_MNH),typeof(LON_MNH))
-  FMV_MNH=0.
-  H_MNH=new(dimsizes(LON_MNH),typeof(LON_MNH))
-  H_MNH=0.
-  RN_MNH=new(dimsizes(LON_MNH),typeof(LON_MNH))
-  RN_MNH=0.
-end if
-
-;########################################################################
-
-print("------------------------------------------")
-print(" Creating netcdf file : rstrt_MNH.nc")
-
-fout=curdir_path+"rstrt_MNH.nc"
-c=addfile(fout,"c")
-c@Description="Restart file for OASIS coupling"
-
-; ----------------------------------
-; Create the variables of the files
-; ----------------------------------
-FMU_MNH!0="nlat"
-FMU_MNH!1="nlon"
-FMU_MNH@_FillValue=999.
-
-FMV_MNH!0="nlat"
-FMV_MNH!1="nlon"
-FMV_MNH@_FillValue=999.
-
-H_MNH!0="nlat"
-H_MNH!1="nlon"
-H_MNH@_FillValue=999.
-
-RN_MNH!0="nlat"
-RN_MNH!1="nlon"
-RN_MNH@_FillValue=999.
-
-EVAP_MNH!0="nlat"
-EVAP_MNH!1="nlon"
-EVAP_MNH@_FillValue=999.
-
-RAIN_MNH!0="nlat"
-RAIN_MNH!1="nlon"
-RAIN_MNH@_FillValue=999.
-
-PRES_MNH!0="nlat"
-PRES_MNH!1="nlon"
-PRES_MNH@_FillValue=999.
-
-U10_MNH!0="nlat"
-U10_MNH!1="nlon"
-U10_MNH@_FillValue=999.
-
-V10_MNH!0="nlat"
-V10_MNH!1="nlon"
-V10_MNH@_FillValue=999.
-
-; ----------------------------------
-; Write out the data arrays into the file
-; ----------------------------------
-c->MNH_FMSU=FMU_MNH
-c->MNH_FMSV=FMV_MNH
-c->MNH_HEAT=H_MNH
-c->MNH_SNET=RN_MNH
-c->MNH_EVAP=EVAP_MNH
-c->MNH_RAIN=RAIN_MNH
-c->MNH_PRES=PRES_MNH
-c->MNH__U10=U10_MNH
-c->MNH__V10=V10_MNH
-
-print("Closing netcdf file : rstrt_MNH.nc")
-print("-----------------------------------------")
-;#####################################################
-
-end
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/Create_restart_file_for_MNH.py b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/Create_restart_file_for_MNH.py
deleted file mode 100755
index 39b2f8aeb..000000000
--- a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/Create_restart_file_for_MNH.py
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/python3
-# -*- coding: utf-8 -*-
-#
-##############################################
-#============================================#
-#      Creating restart file from prep real
-#                 case files : mesonh model
-#      Author : J. Pianezze
-#      Date   :        2015
-#============================================#
-##############################################
-
-import netCDF4
-import numpy as np
-import os
-
-curdir_path=os.path.abspath(os.curdir)+'/'
-
-file_RSTRT = netCDF4.Dataset(curdir_path+'IROISE_5KM_201109_02_00.nc')
-
-LON_MNH=file_RSTRT.variables['LON'][1:-1,1:-1]
-LAT_MNH=file_RSTRT.variables['LAT'][1:-1,1:-1]
-U10_MNH=file_RSTRT.variables['UT'][0,2,1:-1,1:-1]
-V10_MNH=file_RSTRT.variables['VT'][0,2,1:-1,1:-1]
-PRES_MNH=file_RSTRT.variables['PABST'][0,2,1:-1,1:-1]
-
-try:
-  EVAP_MNH=file_RSTRT.variables['EVAP3D'][0,1:-1,1:-1]
-except KeyError:
-  print('EVAP3D not found... imposed at 0!')
-  EVAP_MNH=np.zeros((np.shape(LON_MNH)[0],np.shape(LON_MNH)[1]))
-
-try:
-  RAIN_MNH=file_RSTRT.variables['INPRR3D'][0,1:-1,1:-1]
-except KeyError:
-  print('INPRR3D not found... imposed at 0!')
-  RAIN_MNH=np.zeros((np.shape(LON_MNH)[0],np.shape(LON_MNH)[1]))
-
-try:
-  FMU_MNH=file_RSTRT.variables['FMU'][0,1:-1,1:-1]
-  FMV_MNH=file_RSTRT.variables['FMV'][0,1:-1,1:-1]
-  H_MNH=file_RSTRT.variables['H'][0,1:-1,1:-1]
-  RN_MNH=file_RSTRT.variables['RN'][0,1:-1,1:-1]
-except KeyError:
-  print('Turbulent fluxes FMU, FMV, H and LE not found... imposed at 0!')
-  FMU_MNH=np.zeros((np.shape(LON_MNH)[0],np.shape(LON_MNH)[1]))
-  FMV_MNH=np.zeros((np.shape(LON_MNH)[0],np.shape(LON_MNH)[1]))
-  H_MNH=np.zeros((np.shape(LON_MNH)[0],np.shape(LON_MNH)[1]))
-  RN_MNH=np.zeros((np.shape(LON_MNH)[0],np.shape(LON_MNH)[1]))
-
-########################################################################
-
-print('------------------------------------------')
-print(' Creating netcdf file : rstrt_MNH.nc')
-
-fout=netCDF4.Dataset(curdir_path+'rstrt_MNH.nc','w',format='NETCDF3_64BIT')
-fout.Description='Restart file for OASIS coupling'
-
-# ----------------------------------
-# Create the dimensions of the files
-# ----------------------------------
-fout.createDimension ('nlon', len(LON_MNH[0,:]))
-fout.createDimension ('nlat', len(LAT_MNH[:,0]))
-
-# ----------------------------------
-# Create the variables of the files
-# ----------------------------------
-varout=fout.createVariable('MNH_FMSU','d',('nlat','nlon'),fill_value=999.)
-varout=fout.createVariable('MNH_FMSV','d',('nlat','nlon'),fill_value=999.)
-varout=fout.createVariable('MNH_HEAT','d',('nlat','nlon'),fill_value=999.)
-varout=fout.createVariable('MNH_SNET','d',('nlat','nlon'),fill_value=999.)
-varout=fout.createVariable('MNH_EVAP','d',('nlat','nlon'),fill_value=999.)
-varout=fout.createVariable('MNH_RAIN','d',('nlat','nlon'),fill_value=999.)
-varout=fout.createVariable('MNH_PRES','d',('nlat','nlon'),fill_value=999.)
-varout=fout.createVariable('MNH__U10','d',('nlat','nlon'),fill_value=999.)
-varout=fout.createVariable('MNH__V10','d',('nlat','nlon'),fill_value=999.)
-
-# ----------------------------------
-# Write out the data arrays into the file
-# ----------------------------------
-fout.variables['MNH_FMSU'][:,:] = FMU_MNH[:,:]
-fout.variables['MNH_FMSV'][:,:] = FMV_MNH[:,:]
-fout.variables['MNH_HEAT'][:,:] = H_MNH[:,:]
-fout.variables['MNH_SNET'][:,:] = RN_MNH[:,:]
-fout.variables['MNH_EVAP'][:,:] = EVAP_MNH[:,:]
-fout.variables['MNH_RAIN'][:,:] = RAIN_MNH[:,:]
-fout.variables['MNH_PRES'][:,:] = PRES_MNH[:,:]
-fout.variables['MNH__U10'][:,:] = U10_MNH[:,:]
-fout.variables['MNH__V10'][:,:] = V10_MNH[:,:]
-
-# ---------------------------------------
-# close the file
-# ---------------------------------------
-fout.close()
-
-print(' Closing netcdf file : rstrt_MNH.nc')
-print('-----------------------------------------')
-#####################################################
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/get_pgd_files b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/get_pgd_files
deleted file mode 100755
index 87a41a027..000000000
--- a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/get_pgd_files
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-#
-#     Modif
-#     J.Escobar 11/04/2014 get PGD files from 'dir_open' directory ( without psswd )
-#     J.Escobar 25/04/2013 get LICENCE files
-#
-PREP_PGD_FILES=${PREP_PGD_FILES:-"$HOME/PREP_PGD_FILES_WWW"} ; export PREP_PGD_FILES
-echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
-echo "!!!!            WARNING                  !!!!"
-echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
-echo 
-echo you need 3GO to download this files in
-echo 
-echo PREP_PGD_FILES=$PREP_PGD_FILES  
-echo 
-echo if OK press ENTER  else CTRL-C
-read RIEN
-set -x
-mkdir -p $PREP_PGD_FILES
-cd $PREP_PGD_FILES
-PGD_URL="http://mesonh.aero.obs-mip.fr/mesonh/dir_open/dir_PGDFILES"
-WGET="wget"
-export PGD_URL
-for file in LICENSE_ECOCLIMAP.txt LICENSE_soil_data.txt \
-            gtopo30.dir gtopo30.hdr \
-            SAND_HWSD_MOY.hdr SAND_HWSD_MOY.dir CLAY_HWSD_MOY.hdr CLAY_HWSD_MOY.dir \
-            ECOCLIMAP_v2.0.hdr ECOCLIMAP_v2.0.dir etopo2.nc
-do
-[ -f $file ] || ( ${WGET} -c -nd $PGD_URL/$file.gz ; gunzip $file.gz ; ) 
-done
-
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/run_prep_mesonh_xyz b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/run_prep_mesonh_xyz
deleted file mode 100755
index 336291b68..000000000
--- a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/run_prep_mesonh_xyz
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-echo '--------------------------------------'
-echo '--  input for Meso-NH : PREP_PGD      '
-echo '--------------------------------------'
-PREP_PGD_FILES=${PREP_PGD_FILES:-"$HOME/PREP_PGD_FILES_WWW"} ; export PREP_PGD_FILES
-if [ "$PREP_PGD_FILES" = "" ]
-then
-
-echo 'Your directory PREP_PGD_FILES=$PREP_PGD_FILES doesnt exist.'
-echo 'Please define the location of your PREP_PGD_FILES through'
-echo 'the environment variable PREP_PGD_FILES'
-exit
-
-else
- 
-ln -sf $PREP_PGD_FILES/CLAY_HWSD_MOY.??? .
-ln -sf $PREP_PGD_FILES/SAND_HWSD_MOY.??? .
-ln -sf $PREP_PGD_FILES/ECOCLIMAP_v2.0.??? .
-ln -sf $PREP_PGD_FILES/gtopo30.??? .
-ln -sf $PREP_PGD_FILES/etopo2.nc .
-
-time ${MONORUN} PREP_PGD${XYZ}
-
-#rm *.hdr
-#rm *.dir
-#rm etopo2.nc
-
-echo '---------------------------------------'
-echo '--  input for Meso-NH : PREP_IDEAL_CASE'
-echo '---------------------------------------'
-
-time ${MONORUN} PREP_IDEAL_CASE${XYZ}
-
-echo '---------------------------------------'
-echo '--  input for Meso-NH :                ' 
-echo '--  Create_restart_file_for_MNH.ncl/py '
-echo '---------------------------------------'
-
-rm -f rstrt_MNH.nc
-#ncl Create_restart_file_for_MNH.ncl
-python3 Create_restart_file_for_MNH.py
-
-fi
-#----------------------------
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/EXSEG1.nam_OCEAN b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/EXSEG1.nam_OCEAN
similarity index 100%
rename from MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/EXSEG1.nam_OCEAN
rename to MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/EXSEG1.nam_OCEAN
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/EXSEG1.nam_WAVE b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/EXSEG1.nam_WAVE
similarity index 100%
rename from MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/EXSEG1.nam_WAVE
rename to MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/EXSEG1.nam_WAVE
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/PRE_IDEA1.nam b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/PRE_IDEA1.nam
similarity index 100%
rename from MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/PRE_IDEA1.nam
rename to MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/PRE_IDEA1.nam
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/PRE_PGD1.nam b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/PRE_PGD1.nam
similarity index 100%
rename from MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/PRE_PGD1.nam
rename to MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/PRE_PGD1.nam
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/clean_prep_mesonh_xyz b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/clean_prep_mesonh_xyz
similarity index 83%
rename from MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/clean_prep_mesonh_xyz
rename to MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/clean_prep_mesonh_xyz
index f0551d49d..79700bbab 100755
--- a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_INPUT_MNH/clean_prep_mesonh_xyz
+++ b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/clean_prep_mesonh_xyz
@@ -1,13 +1,13 @@
 #!/bin/bash
 
-# cleaning PGD files
+# cleaning PREP_PGD files
 rm -f IROISE* fort*
 rm -f file*
 rm -f *.dir *.hdr
 rm -f OUTPUT_LISTING* OUTPUT_TRANSFER pipe* *.tex
 rm -f etop*
 
-# cleaning PIC files
+# cleaning PREP_IDEAL_CASE files
 rm -f arome* 
 rm -f file*
 rm -f ecmwf* OUTPUT_LISTING* OUTPUT_TRANSFER pipe* *.tex
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/create_restart_file_from_PREP_IDEAL_CASE.py b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/create_restart_file_from_PREP_IDEAL_CASE.py
new file mode 100755
index 000000000..fcc4c0cb4
--- /dev/null
+++ b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/create_restart_file_from_PREP_IDEAL_CASE.py
@@ -0,0 +1,113 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+#
+# --------------------------------------------------------
+#
+#                 Author  (    date    ) :
+#             J. Pianezze ( 29.09.2023 )
+#
+#                    ~~~~~~~~~~~~~~~
+#         Script used to create restart file from
+#                    PREP_IDEAL_CASE
+#                    ~~~~~~~~~~~~~~~
+#
+# --------------------------------------------------------
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+import os
+import netCDF4
+import numpy as np
+curdir_path = os.getcwd()+'/'
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+cfg_debug   = False
+
+if cfg_debug : print('++++++++++++++++++++++++++++++++++++++++++++++')
+if cfg_debug : print('+++                                           ')
+if cfg_debug : print('+++   0. Read variables from PREP_IDEAL_CASE  ')
+if cfg_debug : print('+++                                           ')
+if cfg_debug : print('++++++++++++++++++++++++++++++++++++++++++++++')
+
+file_RSTRT = netCDF4.Dataset(curdir_path+'IROISE_5KM_201109_02_00.nc')
+
+LON_MNH    = file_RSTRT.variables['LON']  [    1:-1,1:-1] ; nlon_MNH=len(LON_MNH[0,:])
+LAT_MNH    = file_RSTRT.variables['LAT']  [    1:-1,1:-1] ; nlat_MNH=len(LAT_MNH[:,0])
+
+U10_MNH    = file_RSTRT.variables['UT']   [0,2,1:-1,1:-1]
+V10_MNH    = file_RSTRT.variables['VT']   [0,2,1:-1,1:-1]
+PRES_MNH   = file_RSTRT.variables['PABST'][0,2,1:-1,1:-1]
+
+try:
+  EVAP_MNH = file_RSTRT.variables['EVAP3D'][0,1:-1,1:-1]
+except KeyError:
+  print('EVAP3D not found... imposed at 0!')
+  EVAP_MNH = np.zeros((nlat_MNH, nlon_MNH))
+
+try:
+  RAIN_MNH = file_RSTRT.variables['INPRR3D'][0,1:-1,1:-1]
+except KeyError:
+  print('INPRR3D not found... imposed at 0!')
+  RAIN_MNH = np.zeros((nlat_MNH, nlon_MNH))
+
+try:
+  FMU_MNH = file_RSTRT.variables['FMU'][0,1:-1,1:-1]
+  FMV_MNH = file_RSTRT.variables['FMV'][0,1:-1,1:-1]
+  H_MNH   = file_RSTRT.variables['H']  [0,1:-1,1:-1]
+  RN_MNH  = file_RSTRT.variables['RN'] [0,1:-1,1:-1]
+except KeyError:
+  print('Turbulent fluxes FMU, FMV, H and LE not found... imposed at 0!')
+  FMU_MNH = np.zeros((nlat_MNH, nlon_MNH))
+  FMV_MNH = np.zeros((nlat_MNH, nlon_MNH))
+  H_MNH   = np.zeros((nlat_MNH, nlon_MNH))
+  RN_MNH  = np.zeros((nlat_MNH, nlon_MNH))
+
+if cfg_debug : print('++++++++++++++++++++++++++++++++++++++++++++++')
+if cfg_debug : print('+++                                           ')
+if cfg_debug : print('+++   1. Create netcdf file                   ')
+if cfg_debug : print('+++                                           ')
+if cfg_debug : print('++++++++++++++++++++++++++++++++++++++++++++++')
+
+# ---------------------------------------
+#   Open the file
+# ---------------------------------------
+fout=netCDF4.Dataset(curdir_path+'rstrt_MNH.nc','w',format='NETCDF3_64BIT')
+fout.Description='Restart file for MNH coupling'
+
+# ----------------------------------
+#   Create the dimensions
+# ----------------------------------
+fout.createDimension ('nlon', nlon_MNH)
+fout.createDimension ('nlat', nlat_MNH)
+
+# ----------------------------------
+#   Create the variables
+# ----------------------------------
+varout=fout.createVariable('MNH_TAUX','d',('nlat','nlon'),fill_value=999.)
+varout=fout.createVariable('MNH_TAUY','d',('nlat','nlon'),fill_value=999.)
+varout=fout.createVariable('MNH_HEAT','d',('nlat','nlon'),fill_value=999.)
+varout=fout.createVariable('MNH_SNET','d',('nlat','nlon'),fill_value=999.)
+varout=fout.createVariable('MNH_EVAP','d',('nlat','nlon'),fill_value=999.)
+varout=fout.createVariable('MNH_RAIN','d',('nlat','nlon'),fill_value=999.)
+varout=fout.createVariable('MNH_WATF','d',('nlat','nlon'),fill_value=999.)
+varout=fout.createVariable('MNH_PRES','d',('nlat','nlon'),fill_value=999.)
+varout=fout.createVariable('MNH__U10','d',('nlat','nlon'),fill_value=999.)
+varout=fout.createVariable('MNH__V10','d',('nlat','nlon'),fill_value=999.)
+
+# ----------------------------------
+#   Write data arrays 
+# ----------------------------------
+fout.variables['MNH_TAUX'][:,:] = FMU_MNH[:,:]
+fout.variables['MNH_TAUY'][:,:] = FMV_MNH[:,:]
+fout.variables['MNH_HEAT'][:,:] = H_MNH[:,:]
+fout.variables['MNH_SNET'][:,:] = RN_MNH[:,:]
+fout.variables['MNH_EVAP'][:,:] = EVAP_MNH[:,:]
+fout.variables['MNH_RAIN'][:,:] = RAIN_MNH[:,:]
+fout.variables['MNH_WATF'][:,:] = RAIN_MNH[:,:]-EVAP_MNH[:,:]
+fout.variables['MNH_PRES'][:,:] = RAIN_MNH[:,:]
+fout.variables['MNH__U10'][:,:] = U10_MNH[:,:]
+fout.variables['MNH__V10'][:,:] = V10_MNH[:,:]
+
+# ---------------------------------------
+#   Close the file
+# ---------------------------------------
+fout.close()
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/get_pgd_files b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/get_pgd_files
new file mode 100755
index 000000000..2866ac48b
--- /dev/null
+++ b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/get_pgd_files
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+#     Modif
+#     J. Pianezze 20/09/2023 add test on directory and file's presence
+#     J. Escobar  11/04/2014 get PGD files from 'dir_open' directory ( without psswd )
+#     J. Escobar  25/04/2013 get LICENCE files
+#
+export PREP_PGD_FILES=${PREP_PGD_FILES:-"$HOME/PREP_PGD_FILES_WWW"}
+export PGD_URL="http://mesonh.aero.obs-mip.fr/mesonh/dir_open/dir_PGDFILES"
+export WGET="wget"
+
+if [ ! -d ${PREP_PGD_FILES} ]
+then
+   echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+   echo "!!!!            WARNING                  !!!!"
+   echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+   echo
+   echo you need 3GO to download this files in
+   echo
+   echo PREP_PGD_FILES=$PREP_PGD_FILES
+   echo
+   echo if OK press ENTER else CTRL-C
+   read
+   mkdir -p $PREP_PGD_FILES
+fi
+
+cd $PREP_PGD_FILES
+
+for file in LICENSE_ECOCLIMAP.txt LICENSE_soil_data.txt \
+            gtopo30.hdr           gtopo30.dir           \
+            SAND_HWSD_MOY.hdr     SAND_HWSD_MOY.dir     \
+	    CLAY_HWSD_MOY.hdr     CLAY_HWSD_MOY.dir     \
+            ECOCLIMAP_v2.0.hdr    ECOCLIMAP_v2.0.dir    \
+	    etopo2.nc
+do
+   if [ ! -f $file ]
+   then
+      echo 'Download' ${file}
+      ${WGET} -c -nd $PGD_URL/$file.gz ; gunzip $file.gz
+   fi
+done
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/run_prep_mesonh_xyz b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/run_prep_mesonh_xyz
new file mode 100755
index 000000000..3b7058a21
--- /dev/null
+++ b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/1_input_mnh/run_prep_mesonh_xyz
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+export PREP_PGD_FILES=${PREP_PGD_FILES:-"$HOME/PREP_PGD_FILES_WWW"}
+
+if [ ! -d ${PREP_PGD_FILES} ]
+then
+
+   echo 'Your directory PREP_PGD_FILES=$PREP_PGD_FILES doesnt exist.'
+   echo 'Please define the location of your PREP_PGD_FILES through'
+   echo 'the environment variable PREP_PGD_FILES.'
+   exit
+
+else
+ 
+   echo '---------------------------------------'
+   echo '   Create input for Meso-NH : PREP_PGD '
+   echo '---------------------------------------'
+   ln -sf $PREP_PGD_FILES/CLAY_HWSD_MOY.??? .
+   ln -sf $PREP_PGD_FILES/SAND_HWSD_MOY.??? .
+   ln -sf $PREP_PGD_FILES/ECOCLIMAP_v2.0.??? .
+   ln -sf $PREP_PGD_FILES/gtopo30.??? .
+   ln -sf $PREP_PGD_FILES/etopo2.nc .
+   time ${MONORUN} PREP_PGD${XYZ}
+
+   echo '----------------------------------------------'
+   echo '   Create input for Meso-NH : PREP_IDEAL_CASE '
+   echo '----------------------------------------------'
+   time ${MONORUN} PREP_IDEAL_CASE${XYZ}
+
+   echo '--------------------------------------------'
+   echo '   Create restart file from PREP_IDEAL_CASE '
+   echo '--------------------------------------------'
+   python3 create_restart_file_from_PREP_IDEAL_CASE.py
+
+fi
diff --git a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/Makefile b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/Makefile
index f19f2f03a..e74e60f19 100644
--- a/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/Makefile
+++ b/MY_RUN/KTEST/013_Iroise_ideal_case_coupling/Makefile
@@ -1,11 +1,11 @@
 all:
-	cd 1_INPUT_MNH/ && get_pgd_files
-	cd 1_INPUT_MNH/ && run_prep_mesonh_xyz
-	cd 2_INPUT_TOY/ && run_prep_toy
-	cd A_RUN_MNH_TOY/ && run_mesonh_xyz
-	cd A_RUN_MNH_TOY/ && run_plot
+	cd 1_input_mnh/   && get_pgd_files
+	cd 1_input_mnh/   && run_prep_mesonh_xyz
+	cd 2_input_toy/   && run_prep_toy
+	cd A_cpl_mnh_toy/ && run_mesonh_xyz
+	cd A_cpl_mnh_toy/ && run_plot
 clean:
-	cd 1_INPUT_MNH/ && clean_prep_mesonh_xyz
-	cd 2_INPUT_TOY/ && clean_prep_toy
-	cd A_RUN_MNH_TOY/ && clean_mesonh_xyz
-	cd A_RUN_MNH_TOY/ && clean_plot
+	cd 1_input_mnh/   && clean_prep_mesonh_xyz
+	cd 2_input_toy/   && clean_prep_toy
+	cd A_cpl_mnh_toy/ && clean_mesonh_xyz
+	cd A_cpl_mnh_toy/ && clean_plot
diff --git a/src/MNH/mesonh.f90 b/src/MNH/mesonh.f90
index a210092e6..ad97c43b7 100644
--- a/src/MNH/mesonh.f90
+++ b/src/MNH/mesonh.f90
@@ -235,7 +235,7 @@ DO
   ITEMP_MODEL1=ITEMP_MODEL1+1
   !
   CALL DATETIME_DISTANCE(TDTSEG,TDTCUR,ZTIMEC)
-  WRITE(TLUOUT%NLU,*) 'Current simulation time: ', ZTIMEC, '/', XSEGLEN-XTSTEP
+  WRITE(TLUOUT%NLU,*) 'Current simulation time: ', ZTIMEC, ' s / ', XSEGLEN-XTSTEP, ' s'
   CALL GO_TOMODEL_ll(1,IINFO_ll)
   CALL GOTO_MODEL(1)
   CALL MODEL_n( ITEMP_MODEL1, TZBAKFILE, TZDTMODELN, GEXIT )
diff --git a/src/Makefile.MESONH.mk b/src/Makefile.MESONH.mk
index 5a45c0632..592b47ae0 100644
--- a/src/Makefile.MESONH.mk
+++ b/src/Makefile.MESONH.mk
@@ -495,7 +495,7 @@ endif
 ##########################################################
 #
 ifeq "$(VER_OASIS)" "OASISAUTO"
-OASIS_PATH ?= ${SRC_MESONH}/src/LIB/oasis3-mct_${VERSION_OASIS}/compile_generic_mesonh
+OASIS_PATH ?= ${OBJDIR_MASTER}/OASIS3-MCT_5.0
 OASIS_KEY ?= ${OASIS_PATH}/build/lib/psmile.MPI1/mod_oasis.mod
 # INC_OASIS     : includes all *o and *mod for each library
 INC_OASIS      ?= -I${OASIS_PATH}/build/lib/psmile.MPI1 -I$(OASIS_PATH)/build/lib/mct -I$(OASIS_PATH)/build/lib/scrip
-- 
GitLab