Index: /branches/GRISLIv3/launching_area/Master-files/Param/TEMPS-NETCDF-cycle.dat
===================================================================
--- /branches/GRISLIv3/launching_area/Master-files/Param/TEMPS-NETCDF-cycle.dat	(revision 494)
+++ /branches/GRISLIv3/launching_area/Master-files/Param/TEMPS-NETCDF-cycle.dat	(revision 494)
@@ -0,0 +1,21 @@
+TEMPS-HZ.dat
+
+Permet de définir les temps auxquels ont lieu les sorties hz :
+Deux méthodes complémentaires: 
+
+1) sortie régulière. dtsortie_hz(ndtsortie) est un tableau qui contient 
+les pas de temps de sortie. Pour chaque variable on choisi celui qu'on
+veut par indice dans dt_out_hz
+
+2) predef_tsort(npredeft)  est un tableaux de temps prédéfinis pour les sorties
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fin des commentaires~~~~~~~~~~~~~
+2			nbr de classes a sortir	dans ce run	    	
+1  2 	class   (voir les classes et variables dans LISTE_VAR_NCDF.dat)
+-------------------------------------------------------------------------------------------
+1	ndtsortie      lecture de dtsortie_hz
+1000.
+-------------------------------------------------------------------------------------------
+1	npredeft        lecture de predef_tsort
+0.
+-------------------------------------------------------------------------------------------
Index: /branches/GRISLIv3/launching_area/Master-files/Param/cycle_PMIP_hemin40_param_list.dat
===================================================================
--- /branches/GRISLIv3/launching_area/Master-files/Param/cycle_PMIP_hemin40_param_list.dat	(revision 494)
+++ /branches/GRISLIv3/launching_area/Master-files/Param/cycle_PMIP_hemin40_param_list.dat	(revision 494)
@@ -0,0 +1,411 @@
+!  Parametres du run : geoplace GI2S_5T Groenland Ice2sea 5 km cut Tamsin
+
+!___________________________________________________________
+&runpar                       ! nom du bloc parametres du run
+ runname      =  "RUNNAME"   ! 8 caracteres 
+ icompteur    =    1
+ iout         =    2  
+ reprcptr     =  "../../../Fichier-CPTR/deg-HN40_2.nc"
+ itracebug    = 0
+ num_tracebug = 166	
+ comment_run  = "Degla IPSL clim_forcage"
+/
+! runname    : nom de l experience (8 caracteres)
+! icompteur  : reprise dans un fichier  0 -> non, 1 -> oui, 2 -> T et Hwat
+!              3-> T seulement
+! iout       : 1-> sortie cptr pour reprise,2 -> sortie nc pour reprise 
+! reprcptr   : nom du fichier
+!___________________________________________________________
+&grdline                 ! bloc grounding line
+
+ igrdline     =            0
+ Schoof       =            1
+ ibmelt_inv   =            0
+ /
+! igrdline :  1 ligne d echouage fixée, 3 recul forcé, 0 sans traitement specifique, 2 paleo gr line
+! Schoof   :  0 pas de Schoof, 1 flux de Schoof
+
+!___________________________________________________________
+&timesteps                ! bloc timestep
+
+ tend      =   RUNTEND
+ tbegin    =   RUNTBEGIN
+ dtmin     =   2.e-3
+ dtmax     =   1.  
+ dtt	   =   1.
+ testdiag  =   0.025      !0.016     
+ /
+! tous les temps en annees. tbegin et tend : debut et fin du run 
+! pour equation masse, pas de temps mini -> dtmin, maxi -> dtmax
+! dtt : pas de temps long
+! testdiag, pour gerer le pas de temps dynamique dt
+! ordres de grandeur (a moduler selon dx) : 
+! 40 km dtmin=2.e-3, dtmax=1., dtt=5., tesdiag=0.02
+
+!___________________________________________________________
+&topo_file
+ topo_ref        = "Greenland_Bamber-et-al_composite_hemin40.nc" !"SHB_ICE6G-40k_hemin40.nc" !"SHB_GLAC1D_21k_hemin40.nc" !"ICE6G_21k.nc" !"Greenland_Bamber-et-al_composite_hemin40.nc"
+ topo_dep        = "Greenland_Bamber-et-al_composite_hemin40.nc" !"SHB_ICE6G-40k_hemin40.nc" !"SHB_GLAC1D_21k_hemin40.nc" !"ICE6G_21k.nc" !"Greenland_Bamber-et-al_composite_hemin40.nc"
+ grid_topo       = "coord-nord-40km.dat"
+ ghf_fich        = "ijphi_hemin40.nc"
+/
+! topo_ref= topo ref isostasie
+! topo_dep= topo de depart
+! grid_topo : fichier i,j,x,y,lon,lat
+! ghf_fich  : fichier flux geothermique
+!___________________________________________________________
+&mass_conserv            ! conservation de la masse
+adv_frac        =  2.    ! 2-> advection seule
+V_limit         = 3000.  ! maximum velocity for mass conservation : depend de la calotte
+/
+! Conservation de la masse avec equation advection-diffusion '
+! la repartition depend de adv_frac'
+! >1  -> advection seule'
+! 0   -> diffusion seule'
+! 0<*<1   -> fraction de l advection'
+! -1 -> zones diffusion + zones advecttion'
+! V_limit depend de la calotte : typiquement 3000 en Antarctique, 10000 au Groenland
+
+!--------------------------------------------------------------------
+&eaubasale1              ! nom du premier bloc eau basale 
+ 
+ ecoulement_eau =  T
+ hwatermax      =    5000.000    
+ infiltr        =   1.e-3   !1.0000001E-03
+ /
+! ecoulement eau : .false. -> modele bucket, sinon equ. diffusion
+! hwatermax :  hauteur d eau basale maximum dans le sediment (m)
+! infiltr est la quantite d eau qui peut s infiltrer dans le sol (m/an)
+
+!___________________________________________________________
+&param_hydr             ! nom du  bloc parametres hydrauliques 
+ 
+ hmax_till      =    20.00000    
+ poro_till      =   0.5000000    
+ kond0          =   0.000193342957286257   !10.000000E-05
+/
+! hmax_till (m) : epaisseur max du sediment 
+! poro_till : porosite du sediment 
+! conductivite du sediment :  kond0 (m/s)
+
+!____________________________________________________________
+&calving                        !   nom du bloc calving méthode Vincent
+
+Hcoup_plateau   =      250. !50     !   tres petit quand shelves fixes sinon 250
+Hcoup_abysses   =       250. !400     !   tres petit quand shelves fixes sinon 250
+prof_plateau   =       50. !100     !   tres petit quand shelves fixes sinon 250
+prof_abysses   =       1000. !800     !   tres petit quand shelves fixes sinon 250
+ifrange         =       4
+meth_Hcoup      =       0
+/
+
+! Hcoup epaisseurs de coupure pour les zones peu prodondes et profondes
+! Hcoup_plateau<Hcoup_abysses && prof_plateau<prof_abysse
+! prof profondeur delimitant les zones peu prodondes et profondes
+! ifrange=0 -> pas de traitement particulier sur les bords
+! ifrange=1 -> traitement de Vincent avec ice shelves frangeants
+! ifrange=2 -> ice shelves frangeant seulement si bm-bmelt positif
+! meth_hcoup pour faire eventuellement varier Hcoup avec le climat
+!____________________________________________________________
+! loi de deformation 1          module deformation_mod_2lois
+&loidef_1
+
+exposant_1       = 3.
+temp_trans_1     = -6.5
+enhanc_fact_1    = 1.82595387172575          ! Grice2sea 3.         
+coef_cold_1      = 1.660E-16
+Q_cold_1         = 7.820E+04
+coef_warm_1      = 2.000E-16
+Q_warm_1         = 9.545E+04
+/
+! exposant (glen), temperature de transition (ttrans)
+! enhancement factor (sf)
+! pour les temperatures inf. a Temp_trans :
+!            coef_cold (Bat1) et Q_cold (Q1)
+! pour les temperatures sup. a Temp_trans :
+!            coef_warm (Bat2) et Q_warm (Q2)
+!________________________________________________________ 
+! loi de deformation 2          module deformation_mod_2lois
+&loidef_2
+
+exposant_2       = 1.
+temp_trans_2     = -10.
+enhanc_fact_2    = 1.            ! Grice2sea 3.         
+coef_cold_2      = 8.313E-08
+Q_cold_2         = 4.000E+04
+coef_warm_2      = 8.313E-08
+Q_warm_2         = 6.000E+04
+/
+! exposant (glen), temperature de transition (ttrans)
+! enhancement factor (sf)
+! pour les temperatures inf. a Temp_trans :
+!            coef_cold (Bat1) et Q_cold (Q1)
+! pour les temperatures sup. a Temp_trans :
+!            coef_warm (Bat2) et Q_warm (Q2)
+!___________________________________________________________ 
+ 
+&diagno_rheol              ! nom du bloc  diagno_rheol
+
+sf01           = 	0.125   ! 0.125
+sf03           = 	0.125   ! 0.125
+sffunc         =        0
+pvimin         =        1.5e3   ! 1.e3
+/  
+! coefficients par rapport a la loi glace posee                        
+! sf01 : coefficient viscosite loi lineaire 
+! sf03 : coefficient viscosite loi n=3 
+! sffunc : 1 for visco coef that depends on enh factor
+! pvimin : valeur de pvi pour les noeuds fictifs ~ 1.e3
+! tres petit par rapport aux valeurs standards ~ 1.e10
+!___________________________________________________________ 
+
+! furst_schoof
+&furst_schoof
+
+frot_coef = 0.6   !0.035
+gr_select = 1
+/
+! frot_coef  = ',frot_coef
+! gr_select  = ',gr_select
+! gr_select = 1 : Tsai , 2 : Schoof'
+!___________________________________________________________
+&lapse_month                                  !  module climat_forcage_mois_mod'
+
+lect_lapse      = 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0  ! 12 mois
+/
+! laspe rates janvier -> decembre en deg/km
+!___________________________________________________________
+&clim_coupl_atm                                ! nom du bloc
+
+mincoefbmelt  =  0.
+maxcoefbmelt  =  2.
+filforc       = "forcage-429k-quiquet-et-al_CP2013_glacial-index_Waelbroeck_AMOC.dat" !"signal-cycle-hemin.dat" !""40k.dat" !"778k.dat"
+snow          =       .true.
+! mincoefbmelt : borne mini de coefbmshelf
+! maxcoefbmelt : borne maxi de coefbmshelf
+! filforc : fichier de forcage nivx des mers
+! snow   : .true. si neige, .false. si precip
+/
+!___________________________________________________________ 
+&ablation                                     !  module ablation_mod'
+
+pdd_type        = RUNPDDTYPE 
+annual          = .false.
+Cice            = 0.008
+Csnow           = 0.003
+csi             = 0.6
+sigma_ice       = 5.5
+/
+! pdd_type : 0 reeh, 1 Fausto, 2 Tarasov
+! annual : T = annuel, F = mensuel
+! Cice and Csnow, melting factors for ice and snow 
+! sigma variabilite Tday
+! csi proportion of melted water that can refreeze
+
+!___________________________________________________________ 
+&clim_pert                                    ! nom du bloc
+
+coefT           =       1.
+rappact		=	0.07                    ! 0.05->0.75  0.07 -> 0.5
+retroac		=	1
+rapbmshelf      =       5.  
+mincoefbmelt 	= 	0.
+maxcoefbmelt	= 	2.
+filforc         =     'forcage-900k-2007-Parrenin-Bassinot.dat' !'LGM_permanent.dat'
+/
+!___________________________________________________________ 
+&clim_pert_massb                                   ! nom du bloc
+
+coefT           =     0. ! 1.
+filforc         =   'forcage-429k-2007-Jouzel-Waelbroeck_AMOC.dat' ! 'quiquet-et-al_CP2013_forcage.dat' !'forcage-900k-2007-Parrenin-Bassinot.dat' !'LGM_permanent.dat'
+pertsmb		=     0  !1  !1
+rapsmb		=     0. !0.07 !7
+pertbmb		=     1
+coefbmb   =     10.
+/
+! pertsmb = 1, smb pert via tpert / pertsmb = 0, smb = cst
+!----------------------------------------------------------
+&meca_SIA_L1                        ! bloc resol_meca 
+
+i_resolmeca 	=	 2
+/
+! i_resolmeca type d association entre SIA et L1'
+! i_resolmeca=0  chacun dans sa zone'
+! i_resolmeca=1  dans les zones stream, addition si uxdef > uxL1 (MIS11 Cairns)
+! i_resolmeca=2  addition systematique dans les zones stream 
+
+!----------------------------------------------------------
+! pour le module tracer (suivi d'isotopes)
+&tracer
+file_tr_dat	= "../INPUT/tracer.dat"
+file_tr_out	= "../RESULTATS/tracer.out"
+file_tr_dep	= "../RESULTATS/deparchive.out"
+lambdab         = 0.0001
+agemax          = 1000000
+coefT_tra       = 1.
+rappact_tra	= 0.07
+filforc         = "quiquet-et-al_CP2013_forcage.dat" !"forcage-900k-2007-Parrenin-Bassinot.dat"
+pert_type	= 0
+/
+!----------------------------------------------------------
+!  module lect_climref_Ice2sea    
+&clim_smb_T_gen
+smb_file         = 'smb_MARv3.5.2-25km_1958_1989mean_hemin40.nc' !'smb_ERAI_MAR_highres_1989-2008mean_hemin40.nc'   ! smb (en kg/m2/an
+coef_smb_unit    = 1.0893e-3    ! 1.0989e-3          ! 1.0989e-3  pour1/910  1.0893e-3 pour 1/918 (valeur habituelle)
+temp_annual_file ='Tann-cism-hemin40.nc'                            ! annual surface temperature
+/
+!----------------------------------------------------------
+! module climat_Grice2sea_mod
+&lapse_rates
+T_lapse_rate     =  0. !-6.309e-3    ! celui pour la T annuelle de Fausto
+/
+!----------------------------------------------------------
+! module climat_forcage
+&clim_forcage
+clim_ref_file = 'MPI-ESM-P-piControl-hemin40.nc' !'climato_monthly_t2m_era_int_precip_GPCP_1979-1999_hemin40.nc'
+ntr = 3
+ttr_temp = -126000, -21000, 0.
+!forcage_file = 'IPSL-CM5A-LR-piControl-hemin40.nc', 'IPSL-CM5A-LR-lgm-hemin40.nc', 'IPSL-CM5A-LR-piControl-hemin40.nc'
+!forcage_file = 'MPI-ESM1-2-LR-piControl-hemin40.nc', 'MPI-ESM1-2-LR-lgm-hemin40.nc', 'MPI-ESM1-2-LR-piControl-hemin40.nc'
+forcage_file = 'MPI-ESM-P-piControl-hemin40.nc', 'MPI-ESM-P-lgm-hemin40.nc', 'MPI-ESM-P-piControl-hemin40.nc'
+!forcage_file = 'MIROC-ESM-lgm-laure16.nc' , 'MIROC-ESM-piControl-laure16.nc'
+!forcage_file = 'GISS-E2-R-lgm-laure16.nc' , 'GISS-E2-R-piControl-laure16.nc'
+!forcage_file = 'FGOALS-g2-lgm-laure16.nc' , 'FGOALS-g2-piControl-laure16.nc'
+!forcage_file = 'AWI-ESM-1-1-LR-lgm-laure16.nc' , 'AWI-ESM-1-1-LR-piControl-laure16.nc'
+!forcage_file = 'INM-CM4-8-lgm-laure16.nc' , 'INM-CM4-8-piControl-laure16.nc'
+!forcage_file = 'MIROC-ES2L-lgm-laure16.nc' , 'MIROC-ES2L-piControl-laure16.nc'
+!forcage_file = 'MPI-ESM1-2-LR-lgm-laure16.nc' , 'MPI-ESM1-2-LR-piControl-laure16.nc'
+typerun = 0
+lapserate = 0.007
+rappact = 0.11
+filforc = 'forcage-429k-quiquet-et-al_CP2013_glacial-index_Waelbroeck_AMOC.dat' !'forcage-429k-2007-Jouzel-Waelbroeck_AMOC.dat'
+pertbmb = 1
+coefT   = 1.
+coefbmb = 10.
+r_atmvar = RUNRATMVAR
+/
+!----------------------------------------------------------
+&clim_snap
+nb_snap           = 200
+time_depart_snaps = 2000000
+ecart_snap        = 1.
+file_smb_snap     = 'smb_ECHAM5_A1B_MAR_highres_all_time.nc'
+massb_time        = 0     ! 0=fixe, 1:interpolation snapshots
+/
+!----------------------------------------------------------
+&grad_smb                        !routine init_grad_smb 
+file_grad_smb     = 'GRISLI_gradients_MAR_00.txt'
+/
+!---------------------------------------------------------
+&imposed_regions_rsl               ! module  imposed_regions_rsl
+nb_reg           = 1
+filreg           = Hemin40_Hudson.grd
+filforc          = rsl_hudson_forc.txt
+/
+!
+!___________________________________________________________
+&bmelt_seuil                     ! module  bmelt_seuil_prof
+bm_grz           = 0.3      !3
+bmshelf_plateau  = 0.2        !0.4
+bmshelf_abysses  = 10.
+depth_talus      = -1000.
+/
+! Pour l actuel : bm_grz a la grounding line
+!                 bmshelf_plateau sur le plateau continental
+!                 bmshelf_abysses pour les grandes profondeurs
+!       depth_talus, negative, separation entre les 2 domaines
+!___________________________________________________________ 
+&beta_prescr                                   ! dragging_prescr_beta'
+beta_c_file = 'beta-GISCAM23_20ans.grd'        ! 'beta_Fab_10avril12_bord.grd'    ! 'beta_fab_comb_alpha_v4.grd'
+beta_limgz  = .5e6                             ! -1.e12 pour plastic ?    ! .5e6 en visqueux   
+beta_min    = 1 !10.                           ! for grounded ice (Pa)
+beta_mult   = 1.                               ! coefficient multiplicateur    
+/
+! read beta on centered grid
+! beta_file : nom des fichiers qui contiennent les betamx et betamy
+! beta-estime-run07.dat calcul direct beta sans modif 
+! beta-staggered-15km-opt1.dat premier test en utilisant beta calcule  avec iterations
+! above beta_limgz, gzmx is false if negative : no sliding
+! betamx_file = not read anymore
+! betamy_file = not read anymore
+!___________________________________________________________
+&beta_iter_vitbil                              ! beta_iter_vitbil
+
+time_iter      = 5                             ! temps de demarrage des iterations
+nb_iter_vitbil = 2                             ! nombre d'iterations par pas de temps (dtt)
+coef_iter_vitbil = 1.                          ! coefficient pour rapport des vitesses <=1
+Umag_bil_file  = 'ebauche_vitbil_GrIce2sea.grd'  ! fichier des vitesses de bilan centrees
+time_reiter    = 200.                          ! temps entre 2 iterations
+/
+!
+!___________________________________________________________
+&drag_param_beta                              ! drag_beta_param_mod
+
+beta_slope     = 0.001584297807517     !1.e-3
+beta_expo      = 1.      !1.0
+betamax    = 5.e5     ! maximum value of beta
+betamin    = 100. !10.   ! minimum value of beta
+/
+!
+!___________________________________________________________
+&drag_param_beta_sedim                       ! drag_beta_param_sedim_mod
+
+beta_slope    = 0.001584297807517    !1.e-3
+beta_expo     = 1.     !1.0
+betamax    = 5.e5     ! maximum value of beta
+betamin    = 100. !10.   ! minimum value of beta
+file_sedim  = 'sediment_ij_hemin40.grd'
+seuil_sedim = 200.
+coef_sedim  = 1.e-1
+/
+!
+!___________________________________________________________
+&drag_coulomb_friction                        ! drag_coulomb_friction
+
+cf            = 0.1584297807517
+m_nolin       = 1.
+niter_nolin   = 1
+betamax    = 5.e5     ! maximum value of beta
+betamin    = 100.   ! minimum value of beta
+bool_sedim = .T.
+file_sedim  = 'sediment_ij_hemin40.grd'
+seuil_sedim = 200.
+coef_sedim  = 1.e-1
+/
+! cf: a friction coefficient (to be tuned)
+! m_nolin: non-linear exponent, from 1 to infinity (put -1 for infinity)
+!          m_nolin=1/q in Pattyn TC 2017, q in [0:1]
+! niter_nolin: number of iterations to solve the non-linearity (expensive!)
+!
+!___________________________________________________________
+&spinup                                ! warning : 2 different modules
+ispinup = 0
+/
+! with module no_spinup
+! ispinup = 0     run standard ou calcul du beta
+! ispinup = 1     temperature equilibrium with grisli velocities'
+!
+! with module spinup_vitbil
+! ispinup = 2     conservation de la masse avec vitesses bilan '
+! ispinup = 3     equilibre temperature avec vitesses bilan'
+!
+!___________________________________________________________
+&vitbil_upwind             ! nom du bloc vitbil calcule sur le mailles staggered
+balance_Ux_file = 'Uy_moy_stag_5km.nc'
+balance_Uy_file = 'Ux_moy_stag_5km.nc'
+/
+!balance_Ux_file = 'Ux_moy_stag_5km.nc'
+!balance_Uy_file = 'Uy_moy_stag_5km.nc'
+!balance_vel_file = 'Umoy-for-calc-beta_LBq15-06_ZBL_15km.dat'
+! balance_vel_file = 'Uslid-for-calc-beta_LBq15-06_ZBL_15km.dat'
+! balance_vel_file = 'Umoy-for-calc-beta_LBq15-06_ZBL_15km.dat'
+! balance_vel_file = 'Vitbil-stag-pour-spinup_merge_runs_Lbq_ZBL_15km.dat'
+! balance velocities on staggered grid Ux, Uy 
+!___________________________________________________________
+&output_regions
+nbregions       = 7
+region_file     = 'Basins_Greenland_aurel.grd'
+/
+! nbregions   = nombre de regions
+! region_file = carte des regions
+!_______________________________________________________________________________
Index: /branches/GRISLIv3/launching_area/go_GRISLI_PMIP_cycle.sh
===================================================================
--- /branches/GRISLIv3/launching_area/go_GRISLI_PMIP_cycle.sh	(revision 494)
+++ /branches/GRISLIv3/launching_area/go_GRISLI_PMIP_cycle.sh	(revision 494)
@@ -0,0 +1,173 @@
+#!/bin/bash
+# script pour lancer un cycle
+
+# name of the run:
+#IPSL
+namerun="CYCLE40_MPI-abs-ELSA-3"
+#geoplace="euras40"
+#geoplace="euras20"
+#geoplace="euras10"
+geoplace="hemin40"
+#geoplace="laure16"
+
+tmodelend="0."
+tmodelbegin="-126000."
+tmodellength="126000."
+runatmvar="0.25"
+runpdd="2"
+
+parallel="no" # "yes or no?"
+proc_number="4" # number of processor used
+ppn_number=$proc_number # number of cpus (ppn)
+
+queue="xlong"  # specify queue used : short, medium, long, xlong...
+
+# Files used
+grisli_run_file="Master-files/grisli.run.lsce"                        # grisli.run
+param_file="Master-files/Param/cycle_PMIP_${geoplace}_param_list.dat"                    # param file
+TEMPS_NETCDF_file="Master-files/Param/TEMPS-NETCDF-cycle.dat"               # TEMPS-NETCDF.dat
+
+
+case ${geoplace} in
+  euras40 ) exename="Euras-40" ; INPUTDIR="EURASIE40" ;;
+  euras20 ) exename="Euras-20" ; INPUTDIR="EURASIE20" ;;
+  euras10 ) exename="Euras-10" ; INPUTDIR="EURASIE10" ;;
+  hemin40 ) exename="Hemin-40" ; INPUTDIR="HEMIN40" ;;
+  laure16 ) exename="Laure-16" ; INPUTDIR="LAURE16" ;;
+esac
+
+#Revision number :
+rev=`svn info | grep "vision: " | awk '{print $2}'`
+echo "Code revision svn "$rev
+
+echo "-------------------------------------"
+echo "    Now launching run: "   $namerun
+echo "      -------------------------      "
+
+#--------------------------------------------------
+# Check if times are ok:
+#--------------------------------------------------
+
+tcheck=`echo "$tmodelbegin + $tmodellength" | bc -l`
+tcheckbis=`echo "$tmodelend + 0" | bc -l`
+if [ $tcheck != $tcheckbis ]; then
+    echo "The times provided are wrong!"
+    echo $tcheck $tcheckbis
+    echo "Tbegin:" $tmodelbegin ", Tend:" $tmodelend ", length:" $tmodellength
+    exit 0
+else
+    echo "The times provided are correct."
+fi
+
+#--------------------------------------------------
+# The different directories:
+#--------------------------------------------------
+LAUNCHING_DIR=`pwd`
+GRISLI_DIR=${LAUNCHING_DIR%%/launching_area}
+RUNDIR=${GRISLI_DIR}"/RUNS/"${namerun} #-r${rev}
+MODELMASTER=${GRISLI_DIR}"/SOURCES"
+MODEL=${RUNDIR}"/SOURCES"
+
+if [ -d $RUNDIR ]; then
+    echo "This run exists, do you really want to overwrite?"
+    echo "You have 3 sec. to do a ctr+c..."
+    sleep 3
+    echo "Ok, your choice."
+else
+    mkdir $RUNDIR
+    echo "      Run will be in:"
+    echo "  " $RUNDIR
+fi
+
+if [ -d $MODEL ]; then
+    echo "model dir already created, cleaning up before copying files"
+    rm -rf $MODEL"/"*
+else
+    mkdir $MODEL
+fi
+ 
+cp -R $MODELMASTER"/"* $MODEL"/."
+svn status $MODELMASTER > $MODEL"/svn.status.txt"
+svn diff $MODELMASTER > $MODEL"/svn.diff.txt"
+
+if [ -d $RUNDIR"/bin" ]; then
+    echo "exe in bin/"
+else
+    mkdir $RUNDIR"/bin"
+fi
+
+if [ -d $RUNDIR"/RESULTATS" ]; then
+    echo "exe in RESULTATS/"
+else
+    mkdir $RUNDIR"/RESULTATS"
+fi
+
+if [ -d $RUNDIR"/INPUT" ]; then
+    echo "inputs are linked to model master"
+else
+    echo "inputs will be linked to model master"
+    mkdir $RUNDIR"/INPUT"
+fi
+
+
+    
+echo "Now copying master files to the working directory:"
+echo $RUNDIR
+echo "And to the model directory:"
+echo $MODEL
+
+cp $TEMPS_NETCDF_file $MODEL"/Fichiers-parametres/TEMPS-NETCDF.dat"
+cp $param_file $RUNDIR"/bin/${geoplace}_param_list.dat"
+
+cp $grisli_run_file $RUNDIR"/bin/grisli.run"
+
+cd $RUNDIR"/INPUT"
+ln -sf ${GRISLI_DIR}"/INPUT/"${INPUTDIR} .
+ln -sf ${GRISLI_DIR}"/INPUT/Forcage" .
+ln -sf ${GRISLI_DIR}"/INPUT/tracer.dat" .
+
+#--------------------------------------------------
+# Replacing key words:
+#--------------------------------------------------
+
+# run spec.:
+sed -i "s/RUNNAME/$namerun/" $RUNDIR"/bin/${geoplace}_param_list.dat"
+sed -i "s/RUNTBEGIN/$tmodelbegin/" $RUNDIR"/bin/${geoplace}_param_list.dat"
+sed -i "s/RUNTEND/$tmodelend/" $RUNDIR"/bin/${geoplace}_param_list.dat"
+sed -i "s/RUNRATMVAR/$runatmvar/" $RUNDIR"/bin/${geoplace}_param_list.dat"
+sed -i "s/RUNPDDTYPE/$runpdd/" $RUNDIR"/bin/${geoplace}_param_list.dat"
+
+# submission script:
+sed -i "s|SOURCESREP|$MODEL|" $RUNDIR"/bin/grisli.run"
+sed -i "s|EXEREP|$RUNDIR\/bin|" $RUNDIR"/bin/grisli.run"
+sed -i "s/RUNNAME/$namerun/" $RUNDIR"/bin/grisli.run"
+sed -i "s/EXE_NAME/$exename/g" $RUNDIR"/bin/grisli.run"
+
+if [ $parallel = "yes" ]; then
+    sed -i "s/QUEUE/${queue}p/" $RUNDIR"/bin/grisli.run"
+    sed -i "s/PROC_NUMBER/$proc_number/" $RUNDIR"/bin/grisli.run"
+    sed -i "s/PPN_NUMBER/$ppn_number/" $RUNDIR"/bin/grisli.run"
+else
+    sed -i "s/QUEUE/$queue/" $RUNDIR"/bin/grisli.run"
+    sed -i "s/PROC_NUMBER/1/" $RUNDIR"/bin/grisli.run"
+    sed -i "s/PPN_NUMBER/1/" $RUNDIR"/bin/grisli.run"
+    sed -i "/export\ MKL_NUM_THREADS/d" $RUNDIR"/bin/grisli.run"
+    sed -i "/export\ OMP_NUM_THREADS/d" $RUNDIR"/bin/grisli.run"
+    sed -i "/export\ KMP_STACKSIZE/d" $RUNDIR"/bin/grisli.run"
+fi
+
+# Makefile:
+if [ $parallel = "yes" ]; then
+    sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-parallel.inc/" $RUNDIR"/SOURCES/Makefile"
+else
+    sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-sequential.inc/" $RUNDIR"/SOURCES/Makefile"
+fi
+
+
+#--------------------------------------------------
+# Submitting the job:
+#--------------------------------------------------
+cd $RUNDIR"/bin"
+echo "submitting the job"
+#qsub $RUNDIR"/bin/grisli.run"
+echo "-------------------------------------"
