Skip to content
Snippets Groups Projects
Commit cf832399 authored by JorisP's avatar JorisP
Browse files

Add ktest to check Meso-NH/sea coupling

parent 502f0777
No related branches found
No related tags found
1 merge request!3Mnh 57 dev cpl seasalt
Showing
with 368 additions and 21 deletions
......@@ -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' /
&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' /
......@@ -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
......
&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' /
......@@ -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
......
# 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
*.nam
*.txt
U10_CHA/
SEND_RECV/
debug.*
*timers*
namcouple
......
......@@ -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
#------------------------
......@@ -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}
......
*.nam
*.txt
SEND_RECV/
debug.*
*timers*
namcouple
nout.000000
#!/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
#!/bin/bash
rm -Rf SEND_RECV/
#!/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()
#------------------------
#!/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}
# ------------------------------------------
#!/bin/bash
python3 plot_check_exchanges_between_mesonh_and_toy.py
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment