From 6c3d54442358c63d6e7c7911ae97145a781af879 Mon Sep 17 00:00:00 2001 From: JorisP <pianezze.joris@gmail.com> Date: Wed, 10 Jul 2024 16:01:31 +0200 Subject: [PATCH] Add ktest to check Meso-NH/sea coupling --- ...G1.nam => EXSEG1.nam_for_A_cpl_mnh_toywav} | 7 +- .../EXSEG1.nam_for_B_cpl_mnh_toyoce | 73 ++++++++++ ...reate_restart_file_from_PREP_IDEAL_CASE.py | 2 + .../2_input_toy/TOYNAMELIST.nam_oce | 12 ++ .../{TOYNAMELIST.nam => TOYNAMELIST.nam_wav} | 0 .../{namcouple => namcouple_oce} | 4 +- .../3_input_oasis/namcouple_wav | 65 +++++++++ .../A_cpl_mnh_toy/clean_plot | 3 - .../.gitignore | 2 +- .../clean_mesonh_xyz | 0 .../A_cpl_mnh_toywav/clean_plot | 3 + ..._check_exchanges_between_mesonh_and_toy.py | 6 +- .../run_mesonh_xyz | 6 +- .../run_plot | 0 .../B_cpl_mnh_toyoce/.gitignore | 7 + .../B_cpl_mnh_toyoce/clean_mesonh_xyz | 15 ++ .../B_cpl_mnh_toyoce/clean_plot | 3 + ..._check_exchanges_between_mesonh_and_toy.py | 135 ++++++++++++++++++ .../B_cpl_mnh_toyoce/run_mesonh_xyz | 24 ++++ .../B_cpl_mnh_toyoce/run_plot | 3 + .../KTEST/013_Iroise_OASIS_coupling/Makefile | 22 +-- 21 files changed, 368 insertions(+), 24 deletions(-) rename MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/{EXSEG1.nam => EXSEG1.nam_for_A_cpl_mnh_toywav} (92%) create mode 100644 MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/EXSEG1.nam_for_B_cpl_mnh_toyoce create mode 100644 MY_RUN/KTEST/013_Iroise_OASIS_coupling/2_input_toy/TOYNAMELIST.nam_oce rename MY_RUN/KTEST/013_Iroise_OASIS_coupling/2_input_toy/{TOYNAMELIST.nam => TOYNAMELIST.nam_wav} (100%) rename MY_RUN/KTEST/013_Iroise_OASIS_coupling/3_input_oasis/{namcouple => namcouple_oce} (95%) create mode 100755 MY_RUN/KTEST/013_Iroise_OASIS_coupling/3_input_oasis/namcouple_wav delete mode 100755 MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/clean_plot rename MY_RUN/KTEST/013_Iroise_OASIS_coupling/{A_cpl_mnh_toy => A_cpl_mnh_toywav}/.gitignore (82%) rename MY_RUN/KTEST/013_Iroise_OASIS_coupling/{A_cpl_mnh_toy => A_cpl_mnh_toywav}/clean_mesonh_xyz (100%) create mode 100755 MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/clean_plot rename MY_RUN/KTEST/013_Iroise_OASIS_coupling/{A_cpl_mnh_toy => A_cpl_mnh_toywav}/plot_check_exchanges_between_mesonh_and_toy.py (98%) rename MY_RUN/KTEST/013_Iroise_OASIS_coupling/{A_cpl_mnh_toy => A_cpl_mnh_toywav}/run_mesonh_xyz (76%) rename MY_RUN/KTEST/013_Iroise_OASIS_coupling/{A_cpl_mnh_toy => A_cpl_mnh_toywav}/run_plot (100%) create mode 100644 MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/.gitignore create mode 100755 MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/clean_mesonh_xyz create mode 100755 MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/clean_plot create mode 100755 MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/plot_check_exchanges_between_mesonh_and_toy.py create mode 100755 MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/run_mesonh_xyz create mode 100755 MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/run_plot diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/EXSEG1.nam b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/EXSEG1.nam_for_A_cpl_mnh_toywav similarity index 92% rename from MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/EXSEG1.nam rename to MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/EXSEG1.nam_for_A_cpl_mnh_toywav index 752548352..cf4a99647 100644 --- a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/EXSEG1.nam +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/EXSEG1.nam_for_A_cpl_mnh_toywav @@ -3,9 +3,9 @@ CMODEL_NAME = 'mesonh' / &NAM_SFX_WAVE_CPL XTSTEP_CPL_WAVE = 60.0, - CWAVE_U10 = 'MNH__U10', + CWAVE_U10 = 'MNH_SEND', CWAVE_V10 = ' ', - CWAVE_CHA = 'MNH__CHA', + CWAVE_CHA = 'MNH_RECV', CWAVE_UCU = ' ', CWAVE_VCU = ' ', CWAVE_HS = ' ', @@ -67,6 +67,7 @@ &NAM_LBCn CLBCX = 2*'OPEN', CLBCY = 2*'OPEN' / -&NAM_DIAG_SURFn N2M=2 / +&NAM_DIAG_SURFn N2M = 2, + LSURF_BUDGET = T / &NAM_SEAFLUXn CSEA_FLUX='COARE3' / diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/EXSEG1.nam_for_B_cpl_mnh_toyoce b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/EXSEG1.nam_for_B_cpl_mnh_toyoce new file mode 100644 index 000000000..e53f899f1 --- /dev/null +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/EXSEG1.nam_for_B_cpl_mnh_toyoce @@ -0,0 +1,73 @@ +&NAM_OASIS LOASIS = .TRUE., + LOASIS_GRID = .TRUE., + CMODEL_NAME = 'mesonh' / + +&NAM_SFX_WAVE_CPL XTSTEP_CPL_WAVE = -1.0, + CWAVE_U10 = ' ', + CWAVE_V10 = ' ', + CWAVE_CHA = ' ', + CWAVE_UCU = ' ', + CWAVE_VCU = ' ', + CWAVE_HS = ' ', + CWAVE_TP = ' ' / + +&NAM_SFX_SEA_CPL XTSTEP_CPL_SEA = 60.0, + CSEA_FWSU = 'MNH_SEND', + CSEA_FWSV = ' ', + CSEA_HEAT = ' ', + CSEA_SNET = ' ', + CSEA_WIND = ' ', + CSEA_FWSM = ' ', + CSEA_EVAP = ' ', + CSEA_RAIN = ' ', + CSEA_SNOW = ' ', + CSEA_WATF = ' ', + CSEA_PRES = ' ', + CSEA_SST = 'MNH_RECV', + CSEA_UCU = ' ', + CSEA_VCU = ' ' / + +&NAM_CONF CCONF = 'START', + NVERB = 0, + NMODEL = 1, + CEXP = 'IROIS', + CSEG = '00-01', + CSPLIT = 'BSPLITTING' / + +&NAM_DYN XSEGLEN = 360., + LCORIO = .TRUE., + LNUMDIFU = .TRUE., + LNUMDIFTH = .FALSE., + XALKTOP = 0.001, + XALZBOT = 1200. / + +&NAM_BACKUP XBAK_TIME(1,1)=360. / + +&NAM_LUNITn CINIFILE = 'IROISE_5KM_201109_02_00', + CINIFILEPGD = 'IROISE_5KM' / + +&NAM_DYNn XTSTEP = 10., + CPRESOPT = 'ZRESI', + LVE_RELAX = .TRUE. / + +&NAM_ADVn CUVW_ADV_SCHEME = 'CEN4TH', + CTEMP_SCHEME = 'LEFR' , + CMET_ADV_SCHEME = 'PPM_01', + CSV_ADV_SCHEME = 'PPM_01' / + +&NAM_PARAMn CCLOUD = 'ICE3', + CTURB = 'TKEL', + CRAD = 'ECMW', + CDCONV = 'NONE', + CSCONV = 'EDKF' / + +&NAM_PARAM_RADn XDTRAD = 600., + XDTRAD_CLONLY = 600. / + +&NAM_LBCn CLBCX = 2*'OPEN', + CLBCY = 2*'OPEN' / + +&NAM_DIAG_SURFn N2M = 2, + LSURF_BUDGET = T / + +&NAM_SEAFLUXn CSEA_FLUX='COARE3' / diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/create_restart_file_from_PREP_IDEAL_CASE.py b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/create_restart_file_from_PREP_IDEAL_CASE.py index 738b6f996..30ec50dc3 100755 --- a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/create_restart_file_from_PREP_IDEAL_CASE.py +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/1_input_mnh/create_restart_file_from_PREP_IDEAL_CASE.py @@ -106,6 +106,7 @@ 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.) +varout=fout.createVariable('MNH_SEND','d',('nlat','nlon'),fill_value=999.) # ---------------------------------- # Write data arrays @@ -120,6 +121,7 @@ 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[:,:] +fout.variables['MNH_SEND'][:,:] = U10_MNH[:,:] # --------------------------------------- # Close the file diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/2_input_toy/TOYNAMELIST.nam_oce b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/2_input_toy/TOYNAMELIST.nam_oce new file mode 100644 index 000000000..11552c496 --- /dev/null +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/2_input_toy/TOYNAMELIST.nam_oce @@ -0,0 +1,12 @@ +&nam_grid ntime_steps = 6, + time_step = 60, + grid_file_name = 'grid_toy_model.nc' / + +&nam_fct_send type_send='const', + value_send=292 / + +&nam_recv_fields nrecv_fields=1, + name_recv_fields(1)='VARRCV01' / + +&nam_send_fields nsend_fields=1, + name_send_fields(1)='VARCNSTE' / diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/2_input_toy/TOYNAMELIST.nam b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/2_input_toy/TOYNAMELIST.nam_wav similarity index 100% rename from MY_RUN/KTEST/013_Iroise_OASIS_coupling/2_input_toy/TOYNAMELIST.nam rename to MY_RUN/KTEST/013_Iroise_OASIS_coupling/2_input_toy/TOYNAMELIST.nam_wav diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/3_input_oasis/namcouple b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/3_input_oasis/namcouple_oce similarity index 95% rename from MY_RUN/KTEST/013_Iroise_OASIS_coupling/3_input_oasis/namcouple rename to MY_RUN/KTEST/013_Iroise_OASIS_coupling/3_input_oasis/namcouple_oce index 2c5daee92..4e85d7c30 100755 --- a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/3_input_oasis/namcouple +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/3_input_oasis/namcouple_oce @@ -43,7 +43,7 @@ #~~~~~~~~~~~ # Field 1 : #~~~~~~~~~~~ -MNH__U10 VARRCV01 1 60 1 rst_A.nc EXPOUT +MNH_SEND VARRCV01 1 60 1 rst_A.nc EXPOUT 20 20 66 75 ssea toyt LAG=+10 R 0 R 0 SCRIPR @@ -56,7 +56,7 @@ BILINEAR LR SCALAR LATLON 1 #~~~~~~~~~~~ # Field 2 : #~~~~~~~~~~~ -VARSIN01 MNH__CHA 1 60 1 rst_T.nc EXPOUT +VARCNSTE MNH_RECV 1 60 1 rst_T.nc EXPOUT 66 75 20 20 toyt ssea LAG=+60 R 0 R 0 SCRIPR diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/3_input_oasis/namcouple_wav b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/3_input_oasis/namcouple_wav new file mode 100755 index 000000000..0ec7f18bc --- /dev/null +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/3_input_oasis/namcouple_wav @@ -0,0 +1,65 @@ +# This is a typical input file for OASIS3-MCT. +# Keywords used in previous versions of OASIS3 +# but now obsolete are marked "Not used" +# Don't hesitate to ask precisions or make suggestions (oasishelp@cerfacs.fr). +# +# Any line beginning with # is ignored. Blank lines are not allowed. +# +######################################################################### + $NFIELDS +# The number of fields described in the second part of the namcouple. +# + 2 + $END +######################################################################### + $NBMODEL +# The number of models in this experiment + their names (6 characters) +# + 2 mesonh toyexe + $END +########################################################################### + $RUNTIME +# The total simulated time for this run in seconds +# + 360 + $END +########################################################################### + $NLOGPRT +# Amount of information written to OASIS3-MCT log files (see User Guide) +# Premier nombre: quantite d'information pour debugger +# Second nombre: statistics des processeurs + 30 3 + $END +########################################################################### + $STRINGS +# +# The above variables are the general parameters for the experiment. +# Everything below has to do with the fields being exchanged. +# +# ----------------------------------------- +# MESONH (mesonh) ==> TOY (toyexe) +# ----------------------------------------- +# +#~~~~~~~~~~~ +# Field 1 : +#~~~~~~~~~~~ +MNH_SEND VARRCV01 1 60 1 rst_A.nc EXPOUT +20 20 66 75 ssea toyt LAG=+10 +R 0 R 0 +SCRIPR +BILINEAR LR SCALAR LATLON 1 +# +# ------------------------------------------ +# TOY (toyexe) ==> MESONH (mesonh) +# ------------------------------------------ +# +#~~~~~~~~~~~ +# Field 2 : +#~~~~~~~~~~~ +VARSIN01 MNH_RECV 1 60 1 rst_T.nc EXPOUT +66 75 20 20 toyt ssea LAG=+60 +R 0 R 0 +SCRIPR +DISTWGT LR SCALAR LATLON 1 4 +# + $END diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/clean_plot b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/clean_plot deleted file mode 100755 index ebf32dc74..000000000 --- a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/clean_plot +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -rm -Rf U10_CHA/ diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/.gitignore b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/.gitignore similarity index 82% rename from MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/.gitignore rename to MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/.gitignore index b6de864bb..866bfb671 100644 --- a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/.gitignore +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/.gitignore @@ -1,6 +1,6 @@ *.nam *.txt -U10_CHA/ +SEND_RECV/ debug.* *timers* namcouple diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/clean_mesonh_xyz b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/clean_mesonh_xyz similarity index 100% rename from MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/clean_mesonh_xyz rename to MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/clean_mesonh_xyz diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/clean_plot b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/clean_plot new file mode 100755 index 000000000..a0bc7024c --- /dev/null +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/clean_plot @@ -0,0 +1,3 @@ +#!/bin/bash + +rm -Rf SEND_RECV/ diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/plot_check_exchanges_between_mesonh_and_toy.py b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/plot_check_exchanges_between_mesonh_and_toy.py similarity index 98% rename from MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/plot_check_exchanges_between_mesonh_and_toy.py rename to MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/plot_check_exchanges_between_mesonh_and_toy.py index 25f860c80..dcca2ee68 100755 --- a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/plot_check_exchanges_between_mesonh_and_toy.py +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/plot_check_exchanges_between_mesonh_and_toy.py @@ -28,8 +28,8 @@ name_file_send_mnh = glob.glob('*mesonh_01.nc')[0] name_file_recv_mnh = glob.glob('*mesonh_02.nc')[0] name_file_send_toy = glob.glob('*toyexe_02.nc')[0] name_file_recv_toy = glob.glob('*toyexe_01.nc')[0] -name_var01 = name_file_send_mnh[5:8] -name_var02 = name_file_recv_mnh[5:8] +name_var01 = name_file_send_mnh[4:8] +name_var02 = name_file_recv_mnh[4:8] # ######################################################### @@ -132,4 +132,4 @@ ax.set_ylim(( max(np.min(lat_mnh[1:-1,1:-1]),np.min(lat_toy[1:-1,1:-1])), min(np #------------------------ plt.savefig(curdir_path+name_var01+"_"+name_var02+"/"+name_var01+"_"+name_var02+".png", bbox_inches='tight', dpi=400) plt.close() -#------------------------ \ No newline at end of file +#------------------------ diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/run_mesonh_xyz b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/run_mesonh_xyz similarity index 76% rename from MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/run_mesonh_xyz rename to MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/run_mesonh_xyz index 6ee0120d1..28bcf4da4 100755 --- a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/run_mesonh_xyz +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/run_mesonh_xyz @@ -8,16 +8,16 @@ export PATH_EXETOY=${SRC_MESONH}/src/LIB/toy_2.0/ #~~~~~ MESONH ln -sf ../1_input_mnh/IROISE_5KM* . -ln -sf ../1_input_mnh/EXSEG1.nam . +ln -sf ../1_input_mnh/EXSEG1.nam_for_A_cpl_mnh_toywav EXSEG1.nam cp ../1_input_mnh/rstrt_MNH.nc rst_A.nc #~~~~~ TOY ln -sf ../2_input_toy/grid_toy_model.nc . -ln -sf ../2_input_toy/TOYNAMELIST.nam . +ln -sf ../2_input_toy/TOYNAMELIST.nam_wav TOYNAMELIST.nam cp ../2_input_toy/rstrt_TOY.nc rst_T.nc #~~~~~ OASIS -ln -fs ../3_input_oasis/namcouple . +ln -fs ../3_input_oasis/namcouple_wav namcouple # ------------------------------------------ time mpirun -np 1 $PATH_EXETOY/toy_model : -np 1 MESONH${XYZ} diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/run_plot b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/run_plot similarity index 100% rename from MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toy/run_plot rename to MY_RUN/KTEST/013_Iroise_OASIS_coupling/A_cpl_mnh_toywav/run_plot diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/.gitignore b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/.gitignore new file mode 100644 index 000000000..866bfb671 --- /dev/null +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/.gitignore @@ -0,0 +1,7 @@ +*.nam +*.txt +SEND_RECV/ +debug.* +*timers* +namcouple +nout.000000 diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/clean_mesonh_xyz b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/clean_mesonh_xyz new file mode 100755 index 000000000..9ed68a75f --- /dev/null +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/clean_mesonh_xyz @@ -0,0 +1,15 @@ +#!/bin/bash + +rm -f file_* +rm -f IROIS* +rm -f OUTPUT_LIST* REMAP* +rm -f PRESSURE* +rm -f *.nc +rm -f EXSEG1.nam +rm -f namcouple +rm -f TOYNAMELIST.nam +rm -f debug* mesonh* toyexe* +rm -f nout.000000 +rm -f OUTPUT_TOY.txt +rm -f pipe_name + diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/clean_plot b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/clean_plot new file mode 100755 index 000000000..a0bc7024c --- /dev/null +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/clean_plot @@ -0,0 +1,3 @@ +#!/bin/bash + +rm -Rf SEND_RECV/ diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/plot_check_exchanges_between_mesonh_and_toy.py b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/plot_check_exchanges_between_mesonh_and_toy.py new file mode 100755 index 000000000..7add3bc0d --- /dev/null +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/plot_check_exchanges_between_mesonh_and_toy.py @@ -0,0 +1,135 @@ +#!/bin/python3 +# -------------------------------------------------------- +# +# Author ( date ) : +# J. Pianezze ( 29.09.2023 ) +# +# ~~~~~~~~~~~~~~~ +# Script used to verify OASIS exchanges between +# Meso-NH and toy models +# ~~~~~~~~~~~~~~~ +# +# -------------------------------------------------------- + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +import os, glob +import netCDF4 +import numpy as np +import matplotlib.pyplot as plt +from matplotlib.colors import BoundaryNorm +curdir_path = os.getcwd()+'/' +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# ######################################################### +# ### To be defined by user ### +# ######################################################### + +name_file_send_mnh = glob.glob('*mesonh_01.nc')[0] +name_file_recv_mnh = glob.glob('*mesonh_02.nc')[0] +name_file_send_toy = glob.glob('*toyexe_02.nc')[0] +name_file_recv_toy = glob.glob('*toyexe_01.nc')[0] +name_var01 = name_file_send_mnh[4:8] +name_var02 = name_file_recv_mnh[4:8] + +# ######################################################### + +# --------------------------------------- +# Create directory to store figures +# --------------------------------------- +try : + os.mkdir(curdir_path+name_var01+'_'+name_var02+'/') +except OSError: + print('Directory already created') +else: + print('Making directory') + +# --------------------------------------- +# Open files +# --------------------------------------- +file_send_toy = netCDF4.Dataset(name_file_send_toy) +file_recv_mnh = netCDF4.Dataset(name_file_recv_mnh) +file_recv_toy = netCDF4.Dataset(name_file_recv_toy) +file_send_mnh = netCDF4.Dataset(name_file_send_mnh) +file_grids = netCDF4.Dataset('grids.nc') + +# --------------------------------------- +# Read lon/lat +# --------------------------------------- +lon_toy = file_grids.variables['toyt.lon'] ; nlon_toy = np.shape(lon_toy)[1] +lat_toy = file_grids.variables['toyt.lat'] ; nlat_toy = np.shape(lat_toy)[0] +lon_mnh = file_grids.variables['ssea.lon'] ; nlon_mnh = np.shape(lon_mnh)[1] +lat_mnh = file_grids.variables['ssea.lat'] ; nlat_mnh = np.shape(lat_mnh)[0] + +# --------------------------------------- +# Read variables +# --------------------------------------- +var_send_toy = file_send_toy.variables[name_file_send_toy[0:8]][-2,:,:] +var_recv_toy = file_recv_toy.variables[name_file_recv_toy[0:8]][-1,:,:]*1000.0 +var_send_mnh = file_send_mnh.variables[name_file_send_mnh[0:8]][-2,:,:]*1000.0 +var_recv_mnh = file_recv_mnh.variables[name_file_recv_mnh[0:8]][-1,:,:] + +mask_mnh = (var_send_mnh[:,:] > 1E10) +var_send_mnh = np.ma.MaskedArray(var_send_mnh, mask=mask_mnh) +var_recv_mnh = np.ma.MaskedArray(var_recv_mnh, mask=mask_mnh) + +mask_toy = (var_recv_toy[:,:] == 0.0) +var_send_toy = np.ma.MaskedArray(var_send_toy, mask=mask_toy) +var_recv_toy = np.ma.MaskedArray(var_recv_toy, mask=mask_toy) + +# ----------------------------------------------------------- +# Create figure +# ----------------------------------------------------------- +fig = plt.figure() + +# ----------------------------------------------------------- +# Define colormap and norm +# ----------------------------------------------------------- +cmap_wnd = plt.cm.RdBu_r +cmap_toy = plt.cm.RdBu_r + +levels_wnd = np.arange(-9.0, -7.1, 0.1) +levels_toy = np.arange(289.0, 291.1, 0.1) + +norm_wnd = BoundaryNorm(levels_wnd, ncolors=cmap_wnd.N, clip=True) +norm_toy = BoundaryNorm(levels_toy, ncolors=cmap_toy.N, clip=True) + +#---------------------- +ax = fig.add_subplot(221) +plt.title('(a) Send by MNH') +cs = plt.pcolormesh(lon_mnh[:,:],lat_mnh[:,:],var_send_mnh[:,:],cmap=cmap_wnd,norm=norm_wnd) +cbar = plt.colorbar(cs,orientation='vertical',format='%.2f') +plt.tick_params(axis='x',which='both',labelbottom=False) +ax.set_xlim(( max(np.min(lon_mnh[1:-1,1:-1]),np.min(lon_toy[1:-1,1:-1])), min(np.max(lon_mnh[1:-1,1:-1]),np.max(lon_toy[1:-1,1:-1])) )) +ax.set_ylim(( max(np.min(lat_mnh[1:-1,1:-1]),np.min(lat_toy[1:-1,1:-1])), min(np.max(lat_mnh[1:-1,1:-1]),np.max(lat_toy[1:-1,1:-1])) )) + +#---------------------- +ax = fig.add_subplot(222) +plt.title('(b) Received by TOY') +cs = plt.pcolormesh(lon_toy[:,:],lat_toy[:,:],var_recv_toy[:,:],cmap=cmap_wnd,norm=norm_wnd) +cbar = plt.colorbar(cs,orientation='vertical',format='%.2f') +plt.tick_params(axis='x',which='both',labelbottom=False) +plt.tick_params(axis='y',which='both',labelleft =False) +ax.set_xlim(( max(np.min(lon_mnh[1:-1,1:-1]),np.min(lon_toy[1:-1,1:-1])), min(np.max(lon_mnh[1:-1,1:-1]),np.max(lon_toy[1:-1,1:-1])) )) +ax.set_ylim(( max(np.min(lat_mnh[1:-1,1:-1]),np.min(lat_toy[1:-1,1:-1])), min(np.max(lat_mnh[1:-1,1:-1]),np.max(lat_toy[1:-1,1:-1])) )) + +#---------------------- +ax = fig.add_subplot(223) +plt.title('(c) Send by TOY') +cs = plt.pcolormesh(lon_toy[:,:],lat_toy[:,:],var_send_toy[:,:],cmap=plt.cm.RdBu_r,vmin=np.min(var_send_toy), vmax=np.max(var_send_toy)) +cbar = plt.colorbar(cs,orientation='vertical',format='%.1f') +ax.set_xlim(( max(np.min(lon_mnh[1:-1,1:-1]),np.min(lon_toy[1:-1,1:-1])), min(np.max(lon_mnh[1:-1,1:-1]),np.max(lon_toy[1:-1,1:-1])) )) +ax.set_ylim(( max(np.min(lat_mnh[1:-1,1:-1]),np.min(lat_toy[1:-1,1:-1])), min(np.max(lat_mnh[1:-1,1:-1]),np.max(lat_toy[1:-1,1:-1])) )) + +#---------------------- +ax = fig.add_subplot(224) +plt.title('(d) Received by MNH') +cs = plt.pcolormesh(lon_mnh[:,:],lat_mnh[:,:],var_recv_mnh[:,:],cmap=plt.cm.RdBu_r,vmin=np.min(var_send_toy), vmax=np.max(var_send_toy)) +cbar = plt.colorbar(cs,orientation='vertical',format='%.1f') +plt.tick_params(axis='y',which='both',labelleft=False) +ax.set_xlim(( max(np.min(lon_mnh[1:-1,1:-1]),np.min(lon_toy[1:-1,1:-1])), min(np.max(lon_mnh[1:-1,1:-1]),np.max(lon_toy[1:-1,1:-1])) )) +ax.set_ylim(( max(np.min(lat_mnh[1:-1,1:-1]),np.min(lat_toy[1:-1,1:-1])), min(np.max(lat_mnh[1:-1,1:-1]),np.max(lat_toy[1:-1,1:-1])) )) + +#------------------------ +plt.savefig(curdir_path+name_var01+"_"+name_var02+"/"+name_var01+"_"+name_var02+".png", bbox_inches='tight', dpi=400) +plt.close() +#------------------------ diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/run_mesonh_xyz b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/run_mesonh_xyz new file mode 100755 index 000000000..19252124c --- /dev/null +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/run_mesonh_xyz @@ -0,0 +1,24 @@ +#!/bin/bash + +echo '--------------------------------------' +echo ' Run Meso-NH coupling ' +echo '--------------------------------------' + +export PATH_EXETOY=${SRC_MESONH}/src/LIB/toy_2.0/ + +#~~~~~ MESONH +ln -sf ../1_input_mnh/IROISE_5KM* . +ln -sf ../1_input_mnh/EXSEG1.nam_for_B_cpl_mnh_toyoce EXSEG1.nam +cp ../1_input_mnh/rstrt_MNH.nc rst_A.nc + +#~~~~~ TOY +ln -sf ../2_input_toy/grid_toy_model.nc . +ln -sf ../2_input_toy/TOYNAMELIST.nam_oce TOYNAMELIST.nam +cp ../2_input_toy/rstrt_TOY.nc rst_T.nc + +#~~~~~ OASIS +ln -fs ../3_input_oasis/namcouple_oce namcouple + +# ------------------------------------------ +time mpirun -np 1 $PATH_EXETOY/toy_model : -np 1 MESONH${XYZ} +# ------------------------------------------ diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/run_plot b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/run_plot new file mode 100755 index 000000000..fd117c240 --- /dev/null +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/B_cpl_mnh_toyoce/run_plot @@ -0,0 +1,3 @@ +#!/bin/bash + +python3 plot_check_exchanges_between_mesonh_and_toy.py diff --git a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/Makefile b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/Makefile index e74e60f19..4a5d204ee 100644 --- a/MY_RUN/KTEST/013_Iroise_OASIS_coupling/Makefile +++ b/MY_RUN/KTEST/013_Iroise_OASIS_coupling/Makefile @@ -1,11 +1,15 @@ 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_cpl_mnh_toy/ && run_mesonh_xyz - cd A_cpl_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_toywav/ && run_mesonh_xyz + cd A_cpl_mnh_toywav/ && run_plot + cd B_cpl_mnh_toyoce/ && run_mesonh_xyz + cd B_cpl_mnh_toyoce/ && run_plot clean: - 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 + cd 1_input_mnh/ && clean_prep_mesonh_xyz + cd 2_input_toy/ && clean_prep_toy + cd A_cpl_mnh_toywav/ && clean_mesonh_xyz + cd A_cpl_mnh_toywav/ && clean_plot + cd B_cpl_mnh_toyoce/ && clean_mesonh_xyz + cd B_cpl_mnh_toyoce/ && clean_plot -- GitLab