From 34ff80595b527d8f900b8df9d99a4e0b44bb70eb Mon Sep 17 00:00:00 2001
From: Quentin Rodier <quentin.rodier@meteo.fr>
Date: Thu, 4 Jul 2024 13:42:17 +0200
Subject: [PATCH] Quentin 04/07/2024: test cases fixes

---
 .../BLAZE/01_flat_2WC/02_mesonh/run_test      |   1 +
 .../BLAZE/02_flat_A2F/02_mesonh/run_test      |   1 +
 .../BLAZE/03_flat_F2A/02_mesonh/run_test      |   1 +
 .../INTEGRATION_CASES/LOCAL/BLAZE/fuelmap.py  |  25 ++++
 .../SIMU1/004_prep_real_d1/run_prep_real_case |   4 +-
 .../LOCAL/HYDRO/002_mesonh/EXSEG1.nam         | 114 +-----------------
 .../LOCAL/HYDRO/003_python/plot_HYDRO.py      |  30 ++---
 7 files changed, 46 insertions(+), 130 deletions(-)
 create mode 100644 MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/fuelmap.py

diff --git a/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/01_flat_2WC/02_mesonh/run_test b/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/01_flat_2WC/02_mesonh/run_test
index 092809ac7..15cc800ec 100755
--- a/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/01_flat_2WC/02_mesonh/run_test
+++ b/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/01_flat_2WC/02_mesonh/run_test
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 # generate FuelMap.nc and FuelMap.des files
+ln -sf ../../fuelmap.py .
 python3 fuelmap.py
 
 time MESONH${XYZ}
diff --git a/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/02_flat_A2F/02_mesonh/run_test b/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/02_flat_A2F/02_mesonh/run_test
index b979b3ee2..574eaf533 100755
--- a/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/02_flat_A2F/02_mesonh/run_test
+++ b/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/02_flat_A2F/02_mesonh/run_test
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 # generate FuelMap.nc and FuelMap.des files
+ln -sf ../../fuelmap.py .
 python3 fuelmap.py
 
 time MESONH${XYZ}
diff --git a/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/03_flat_F2A/02_mesonh/run_test b/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/03_flat_F2A/02_mesonh/run_test
index 2a295894e..e466a9ba7 100755
--- a/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/03_flat_F2A/02_mesonh/run_test
+++ b/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/03_flat_F2A/02_mesonh/run_test
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 # generate FuelMap.nc and FuelMap.des files
+ln -sf ../../fuelmap.py .
 python3 fuelmap.py
 
 time MESONH${XYZ}
diff --git a/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/fuelmap.py b/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/fuelmap.py
new file mode 100644
index 000000000..80dc3ba50
--- /dev/null
+++ b/MY_RUN/INTEGRATION_CASES/LOCAL/BLAZE/fuelmap.py
@@ -0,0 +1,25 @@
+"""fuelmap.py
+
+MesoNH Blaze canonic test case
+"""
+from pyrolib.fuelmap import FuelDatabase, FuelMap
+
+# create fuel db
+my_db = FuelDatabase()
+
+# load existing database
+my_db.load_fuel_database("FireFluxI")
+
+# create a FuelMap
+my_fuelmap = FuelMap(fuel_db=my_db)
+
+# add a fuel patch of the tall grass fuel from the FireFluxI database
+## to show the available fuel keys of the database, use print(my_db)
+my_fuelmap.add_fuel_rectangle_patch(pos1=[0, 2500], pos2=[0, 1250], fuel_key="FireFluxI_tall_grass")
+
+# add a ignition patch
+my_fuelmap.add_ignition_rectangle_patch(pos1=[1000, 1025], pos2=[625, 650], ignition_time=0)
+
+# dump for mesonh
+my_fuelmap.dump_mesonh()
+my_fuelmap.dump()
\ No newline at end of file
diff --git a/MY_RUN/INTEGRATION_CASES/LOCAL/DOUBLE_GRIDNESTING/SIMU1/004_prep_real_d1/run_prep_real_case b/MY_RUN/INTEGRATION_CASES/LOCAL/DOUBLE_GRIDNESTING/SIMU1/004_prep_real_d1/run_prep_real_case
index bfd819775..104a7b57f 100755
--- a/MY_RUN/INTEGRATION_CASES/LOCAL/DOUBLE_GRIDNESTING/SIMU1/004_prep_real_d1/run_prep_real_case
+++ b/MY_RUN/INTEGRATION_CASES/LOCAL/DOUBLE_GRIDNESTING/SIMU1/004_prep_real_d1/run_prep_real_case
@@ -1,8 +1,8 @@
 #!/bin/sh
 
 ln -sf ../003_prep_nest_pgd/PGD1*neste* .
-ln -sf /cnrm/phynh/data1/rodierq/GRIB_KTEST/ecmwf.OD.20030810.00 .
-if [ ! -f ecmwf.OD.20030810.00 ]; then
+cp -f /cnrm/phynh/data1/rodierq/GRIB_KTEST/ecmwf.OD.20030810.00 .
+if [ ! -d ecmwf.OD.20030810.00 ]; then
 	wget -c -nd http://mesonh.aero.obs-mip.fr/mesonh/dir_doc/dir_namelist_examples/GRIB_KTEST/ecmwf.OD.20030810.00
 fi
 
diff --git a/MY_RUN/INTEGRATION_CASES/LOCAL/HYDRO/002_mesonh/EXSEG1.nam b/MY_RUN/INTEGRATION_CASES/LOCAL/HYDRO/002_mesonh/EXSEG1.nam
index 9970cd2d4..e80e888f0 100644
--- a/MY_RUN/INTEGRATION_CASES/LOCAL/HYDRO/002_mesonh/EXSEG1.nam
+++ b/MY_RUN/INTEGRATION_CASES/LOCAL/HYDRO/002_mesonh/EXSEG1.nam
@@ -71,24 +71,6 @@
              CCLOUD  = "NONE",		! cloud (REVE,KESS,ICE3)
              CDCONV  = "NONE" /		! deep convection
 !
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-! options for the radiation in the model n
-!
-&NAM_PARAM_RADn /					! not used
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-! options for the convective scheme
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-! ground ?? - not in the standard version any more
-!
-!&NAM_PARAM_GROUNDn /
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
 ! boundary conditions for the model n
 !
 &NAM_LBCn    CLBCX = 2*"CYCL",		! boundary condition in x
@@ -96,39 +78,6 @@
 	     XCPHASE = 20.0 /		! phase speed of outgoing 
 					! gravity waves
 !
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-! options for turbulence
-!
-&NAM_TURBn   XIMPL = 0.,		! 1 default (not implicit)
-					! 0.5 Crank Nicholson scheme 
-					! 0 puerly explicit scheme
-	     CTURBLEN = "DELT",		! type of turb. mixing lenght
-	     CTURBDIM = "3DIM",		! cubic root of the grid volume
-	     LTURB_DIAG = .FALSE.,	! store diagnostic quantities
-	     LTURB_FLX = .FALSE., 	! store all turbulent fluxes
-             /	! not sure
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-! options for chemistry
-!
-&NAM_CH_MNHCn /				! not used
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-! temporal series in diagnostic file of model n
-!
-NAM_SERIESn /				! not used ?
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-! options for stiff solver in model n
-!
-&NAM_CH_SOLVERn /			! use defaults
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
 ! global configuration parameters
 !
 &NAM_CONF    
@@ -166,17 +115,11 @@ NAM_SERIESn /				! not used ?
 					! the sponge layer
 !
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 
-! grid nesting configuration
-!
-&NAM_NESTING /				! not used
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !
 ! output times
 !
 !
-&NAM_BACKUP   XBAK_TIME(1,1)=0.,
+&NAM_BACKUP   XBAK_TIME(1,1)=10.,
              XBAK_TIME(1,2)=10.,
             XBAK_TIME(1,3)=1500.,
              XBAK_TIME(1,4)=3000.,
@@ -188,61 +131,6 @@ NAM_SERIESn /				! not used ?
              XBAK_TIME(1,10)=12000.,
             XBAK_TIME(1,11)=13500.,
              XBAK_TIME(1,12)=15000./
-!&NAM_FMOUT   XBAK_TIME(1,1)=0.,
-!            XBAK_TIME(1,2)=5.,
-!           XBAK_TIME(1,3)=10.,
-!            XBAK_TIME(1,4)=15.,
-!            XBAK_TIME(1,5)=20.,
-!            XBAK_TIME(1,6)=25.,
-!            XBAK_TIME(1,7)=30.,
-!            XBAK_TIME(1,8)=35.,
-!            XBAK_TIME(1,9)=40.,
-!            XBAK_TIME(1,10)=45.,
-!            XBAK_TIME(1,11)=50.,
-!            XBAK_TIME(1,12)=55./
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-! different budgets - not used
-!
-&NAM_BUDGET / 
-&NAM_BU_RU /
-&NAM_BU_RV /
-&NAM_BU_RW /
-&NAM_BU_RTH /
-&NAM_BU_RTKE /
-&NAM_BU_RRV /
-&NAM_BU_RRC /
-&NAM_BU_RRR /
-&NAM_BU_RRI /
-&NAM_BU_RRS /
-&NAM_BU_RRG /
-&NAM_BU_RRH /
-&NAM_BU_RSV /
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! averages used in LES mode
-&NAM_LES    /				! not used
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-! aditional user defined variables
-!
-&NAM_BLANK 
-!          CDUMMY1='MOMENTUM_FLUX', 	! caclulate momentum flux
-           CDUMMY2='test'               ! file name for mom. flux
-           NDUMMY1=28,			! height of the useful domain
-                                        ! including level 1
-           XDUMMY1=20., 		! background wind speed
-           XDUMMY2=1.,  		! mountain height in m
-           XDUMMY3=1000.,               ! scaling factor
-           XDUMMY8=0.8 , 
-           LDUMMY8 = .F./
-!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!
-! forcing parameters
-&NAM_FRC /				! not used
 !
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !
diff --git a/MY_RUN/INTEGRATION_CASES/LOCAL/HYDRO/003_python/plot_HYDRO.py b/MY_RUN/INTEGRATION_CASES/LOCAL/HYDRO/003_python/plot_HYDRO.py
index 6cc617a61..5df6a6da3 100644
--- a/MY_RUN/INTEGRATION_CASES/LOCAL/HYDRO/003_python/plot_HYDRO.py
+++ b/MY_RUN/INTEGRATION_CASES/LOCAL/HYDRO/003_python/plot_HYDRO.py
@@ -15,9 +15,9 @@ os.system('rm -f tempgraph*')
 #
 path=""
     
-LnameFiles = ['HYDRO.1.CEN4T.00'+str(i)+'.nc' for i in range(1,10)] + ['HYDRO.1.CEN4T.01'+str(i)+'.nc' for i in range(3)]
+LnameFiles = ['HYDRO.1.CEN4T.00'+str(i)+'.nc' for i in range(1,10)] + ['HYDRO.1.CEN4T.01'+str(i)+'.nc' for i in range(2)]
 
-Dvar_input = {"f"+str(i):['UT','WT','LSUM','ni_u','level', 'ni','level_w','time'] for i in range(1,13)}
+Dvar_input = {"f"+str(i):['UT','WT','LSUM','ni_u','level', 'ni','level_w','time'] for i in range(1,12)}
 
 #  Read the variables in the files
 Dvar = {}
@@ -28,9 +28,9 @@ Dvar = read_netcdf(LnameFiles, Dvar_input, path=path, removeHALO=True)
 ###############################################################
 Panel1 = PanelPlot(6,2, [40,80],'Hydro : UT(time) - LSUM(0)', xlabelSize=25, ylabelSize=25, legendSize=25, timeSize=25, cbTicksLabelSize=25, cbTitleSize=25, xyTicksLabelSize=25, minmaxTextSize=25, titleSize=30, bigtitleSize=40)
 
-Lplot = [Dvar['f'+str(i)]['UT'] - Dvar['f1']['LSUM'] for i in range(1,13)]
-LaxeX = [Dvar['f'+str(i)]['ni_u'] for i in range(1,13)]
-LaxeY = [Dvar['f'+str(i)]['level'] for i in range(1,13)]
+Lplot = [Dvar['f'+str(i)]['UT'] - Dvar['f1']['LSUM'] for i in range(1,12)]
+LaxeX = [Dvar['f'+str(i)]['ni_u'] for i in range(1,12)]
+LaxeY = [Dvar['f'+str(i)]['level'] for i in range(1,12)]
 
 Ltitle = ['']*len(Lplot)
 Lcbarlabel = ['m/s']*len(Lplot)
@@ -40,7 +40,7 @@ Lminval = [-31.25]*len(Lplot)
 Lmaxval = [31.25]*len(Lplot)
 Lstep = [2.5]*len(Lplot)
 Lstepticks = Lstep
-Ltime = [Dvar['f'+str(i)]['time'] for i in range(1,13)]
+Ltime = [Dvar['f'+str(i)]['time'] for i in range(1,12)]
 Lcolormap = ['seismic']*len(Lplot)
 Lfacconv = [1000]*len(Lplot)
 fig1 = Panel1.psectionV(Lxx=LaxeX, Lzz=LaxeY, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval,
@@ -53,9 +53,9 @@ Panel1.save_graph(1,fig1)
 ###############################################################
 Panel2 = PanelPlot(6,2, [40,80],'Hydro : Vertical velocity WT', xlabelSize=25, ylabelSize=25, legendSize=25, timeSize=25, cbTicksLabelSize=25, cbTitleSize=25, xyTicksLabelSize=25, minmaxTextSize=25, titleSize=30, bigtitleSize=40)
 
-Lplot = [Dvar['f'+str(i)]['WT'] for i in range(1,13)]
-LaxeX = [Dvar['f'+str(i)]['ni'] for i in range(1,13)]
-LaxeY = [Dvar['f'+str(i)]['level_w'] for i in range(1,13)]
+Lplot = [Dvar['f'+str(i)]['WT'] for i in range(1,12)]
+LaxeX = [Dvar['f'+str(i)]['ni'] for i in range(1,12)]
+LaxeY = [Dvar['f'+str(i)]['level_w'] for i in range(1,12)]
 
 Ltitle = ['']*len(Lplot)
 Lcbarlabel = ['m/s']*len(Lplot)
@@ -65,7 +65,7 @@ Lminval = [-4.75]*len(Lplot)
 Lmaxval = [4.75]*len(Lplot)
 Lstep = [0.5]*len(Lplot)
 Lstepticks = Lstep
-Ltime = [Dvar['f'+str(i)]['time'] for i in range(1,13)]
+Ltime = [Dvar['f'+str(i)]['time'] for i in range(1,12)]
 Lcolormap = ['seismic']*len(Lplot)
 Lfacconv = [1000]*len(Lplot)
 fig2 = Panel2.psectionV(Lxx=LaxeX, Lzz=LaxeY, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, 
@@ -78,9 +78,9 @@ Panel2.save_graph(2,fig2)
 ###############################################################
 Panel3 = PanelPlot(6,2, [40,80],'Hydro : WT(time) - WT(0)', xlabelSize=25, ylabelSize=25, legendSize=25, timeSize=25, cbTicksLabelSize=25, cbTitleSize=25, xyTicksLabelSize=25, minmaxTextSize=25, titleSize=30, bigtitleSize=40)
 
-Lplot = [Dvar['f'+str(i)]['WT'] - Dvar['f1']['WT'] for i in range(2,13)]
-LaxeX = [Dvar['f'+str(i)]['ni'] for i in range(2,13)]
-LaxeY = [Dvar['f'+str(i)]['level_w'] for i in range(2,13)]
+Lplot = [Dvar['f'+str(i)]['WT'] - Dvar['f1']['WT'] for i in range(2,12)]
+LaxeX = [Dvar['f'+str(i)]['ni'] for i in range(2,12)]
+LaxeY = [Dvar['f'+str(i)]['level_w'] for i in range(2,12)]
 
 Ltitle = ['']*len(Lplot)
 Lcbarlabel = ['m/s']*len(Lplot)
@@ -90,10 +90,10 @@ Lminval = [-0.034] + [-4.25]*(len(Lplot)-1)
 Lmaxval = [0.034] + [4.25]*(len(Lplot)-1)
 Lstep = [0.004] + [0.5]*(len(Lplot)-1)
 Lstepticks = Lstep
-Ltime = [Dvar['f'+str(i)]['time'] for i in range(2,13)]
+Ltime = [Dvar['f'+str(i)]['time'] for i in range(2,12)]
 Lcolormap = ['seismic']*len(Lplot)
 Lfacconv = [1000]*len(Lplot)
 fig3 = Panel3.psectionV(Lxx=LaxeX, Lzz=LaxeY, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, 
                         Lstep=Lstep, Lstepticks=Lstepticks, Lcbarlabel=Lcbarlabel, Ltime=Ltime, Lcolormap=Lcolormap, Lfacconv=Lfacconv)
 
-Panel3.save_graph(3,fig3)
\ No newline at end of file
+Panel3.save_graph(3,fig3)
-- 
GitLab