Ignore:
Timestamp:
02/11/21 16:46:40 (3 years ago)
Author:
acosce
Message:

new configuration for LMDZORINCA coupled with Dynamico

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CONFIG/UNIFORM/v7/ICOLMDZORINCA_v7/GENERAL/DRIVER/lmdz.driver

    r5542 r5586  
    55    IGCM_debug_PushStack "ATM_Initialize" 
    66 
    7     # Read the resolution from the variables ResolAtm set in config.card UserChoices section or from .resol file 
    8     if [ X$ResolAtm != X ] ; then 
    9         # ResolAtm is set in config.card 
    10         RESOL_ATM_3D=${ResolAtm} 
    11     elif [ -f ${SUBMIT_DIR}/../.resol ] ; then 
    12         # ResolAtm was not set in config.card, try to read .resol file 
    13         eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x39 
    14     else 
    15         IGCM_debug_Exit "ResolAtm is not set in config.card and the .resol file does not exist." 
    16         IGCM_debug_Verif_Exit 
    17     fi 
    18      
    19     IGCM_debug_Print 1 "The atomsopheric resolution is ${RESOL_ATM_3D} "  
    20  
    21     RESOL_ATM_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' ) 
    22     RESOL_ATM_X=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $1}' ) 
    23     RESOL_ATM_Y=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $2}' ) 
    24     RESOL_ATM_XY="${RESOL_ATM_X}x${RESOL_ATM_Y}" 
    25     RESOL_ATM=LMD${RESOL_ATM_X}${RESOL_ATM_Y} 
     7 
     8    # Define the resolution only if the composant ICO for DYNAMICO is not set in config.card 
     9    if [ X${config_ListOfComponents_ICO} = X ] ; then 
     10 
     11        # Read the resolution from the variables ResolAtm set in config.card UserChoices section or from .resol file 
     12        if [ X$ResolAtm != X ] ; then 
     13            # ResolAtm is set in config.card 
     14            RESOL_ATM_3D=${ResolAtm} 
     15        elif [ -f ${SUBMIT_DIR}/../.resol ] ; then 
     16            # ResolAtm was not set in config.card, try to read .resol file 
     17            eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x39 
     18        else 
     19            IGCM_debug_Exit "ResolAtm is not set in config.card and the .resol file does not exist." 
     20            IGCM_debug_Verif_Exit 
     21        fi 
     22         
     23        RESOL_ATM_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' ) 
     24        RESOL_ATM_X=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $1}' ) 
     25        RESOL_ATM_Y=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $2}' ) 
     26        RESOL_ATM_XY="${RESOL_ATM_X}x${RESOL_ATM_Y}" 
     27        RESOL_ATM=LMD${RESOL_ATM_X}${RESOL_ATM_Y} 
     28 
     29        IGCM_debug_Print 1 "The atomsopheric resolution is ${RESOL_ATM_3D} "  
     30    else 
     31        RESOL_ATM_Z=${dynamico_UserChoices_RESOL_ATM_Z} 
     32        RESOL_NBP=${dynamico_UserChoices_RESOL_NBP} 
     33    fi 
    2634 
    2735    ##- LMDZ physics version 
     
    4856    ConfType=${lmdz_UserChoices_ConfType} 
    4957 
     58 
    5059    IGCM_debug_PopStack "ATM_Initialize" 
    5160} 
     
    193202 
    194203 
    195  
    196204    ## Activate diagnostic output files and set output_level for each file 
    197205 
     
    261269    # histdaystrataer 
    262270    if [ X${lmdz_UserChoices_output_level_histdaystrataer} = X ] || [ X${lmdz_UserChoices_output_level_histdaystrataer} = XNONE ] ; then 
    263         IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer enabled FALSE 
    264         IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer output_level 0 
    265     else 
    266         IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer enabled TRUE 
    267         IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer output_level ${lmdz_UserChoices_output_level_histstrataer} 
     271    IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer enabled FALSE 
     272    IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer output_level 0 
     273    else 
     274    IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer enabled TRUE 
     275    IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer output_level ${lmdz_UserChoices_output_level_histstrataer} 
    268276    fi 
    269277 
     
    312320 
    313321    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def 
     322 
    314323    if [ ${CumulPeriod} -eq 1 ] ; then 
    315324        IGCM_comp_modifyDefFile blocker run.def raz_date  1 
     
    319328 
    320329    ##-- Calendar type for LMDZ and create_etat0_limit 
     330    #    calend is read from both LMDZ dynamics and physics parts of the model 
    321331    case ${config_UserChoices_CalendarType} in 
    322332        leap|gregorian) 
     
    330340    esac 
    331341 
     342 
     343    ## -- Modify more calendar related variables. 
    332344    IGCM_comp_modifyDefFile blocker run.def dayref    ${InitDay} 
     345    # Following variables are read by LMDZ dynamics  
    333346    IGCM_comp_modifyDefFile blocker run.def nday      ${PeriodLengthInDays} 
    334347 
    335     # Set anneeref different for gcm and ce0l 
    336     # Test if executable create_etat0_limit is present and lmdz.x is not present 
    337     if [ -f create_etat0_limit* ] || [ -f ce0l* ] && [ ! -f lmdz.x ] ; then 
    338         # for case ce0l : always take current year 
    339         IGCM_comp_modifyDefFile blocker run.def anneeref ${year} 
    340  
    341         # Temporary, set use_filtre_fft=n because we now use dyn3d for ce0l version where fft is not implemented.  
    342         # In more recent versions of LMDZ, this will not be needed.  
    343         IGCM_comp_modifyDefFile force   run.def use_filtre_fft n 
     348    # Set anneeref different for gcm and create_etat0_limit mode 
     349    # Test if keyword create_etat0_limit=y is set in dynamico.card or in lmdz.card 
     350    if [ X${lmdz_UserChoices_create_etat0_limit} = Xy ] || [ X${dynamico_UserChoices_create_etat0_limit} = Xy ] ; then 
     351       # for case create_etat0_limit : always take current year 
     352       IGCM_comp_modifyDefFile blocker run.def anneeref ${year} 
     353         
     354       # Temporary, set use_filtre_fft=n because we now use dyn3d for ce0l version where fft is not implemented.  
     355       # In more recent versions of LMDZ, this will not be needed.  
     356           IGCM_comp_modifyDefFile force   run.def use_filtre_fft n 
    344357    else 
    345358        # for case gcm : take first year of simulation 
    346359        IGCM_comp_modifyDefFile blocker run.def anneeref ${InitYear} 
    347360    fi 
     361     
    348362 
    349363    ## Determine from the variable ListOfComponents in config.card coupling to external models  
     
    370384        echo "Activate coupling to INCA, set type_trac=inca in run.def" 
    371385        IGCM_comp_modifyDefFile blocker run.def type_trac inca 
    372         IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1   
     386        IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1 
    373387    elif [ X${config_ListOfComponents_CHM} = Xreprobus ] ; then 
    374388        echo "Activate coupling to REPROBUS, set type_trac=repr in run.def" 
    375389        IGCM_comp_modifyDefFile blocker run.def type_trac repr 
    376390        IGCM_comp_modifyDefFile blocker run.def config_inca none 
    377         IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1   
     391        IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1 
    378392    elif [ X${config_UserChoices_ConfigType} = XESMCO2 ] ; then  
    379393        echo "ESM config, set type_trac=co2i in run.def" 
     
    503517    fi 
    504518 
     519 
    505520    # physiq.def : Modify parameter tau_gl if it is set in lmdz.card 
    506521    if [ ! X${lmdz_UserChoices_tau_gl} = X ]; then  
     
    520535 
    521536 
    522     ## Read ByPass_hgardfou_teta option in lmdz.card --> divide teta* by 2 if [ $ByPass_hgardfou_teta = 1 ] 
    523     ByPass_hgardfou_teta=${lmdz_UserChoices_ByPass_hgardfou_teta} 
    524     if [ X"${ByPass_hgardfou_teta}" = X"y" ] ; then 
    525         awk '{ if ($0 ~ /^teta.*=/) {split($0,a,"=") ; print a[1]"="a[2]/2"."} else print $0}' gcm.def > gcm.def.tmp 
    526         IGCM_sys_Mv gcm.def.tmp gcm.def 
    527         echo 
    528         IGCM_debug_Print 1 "ByPass_hgardfou_teta : ^teta*/2 in gcm.def" 
    529         echo 
    530         cat gcm.def 
    531         ByPass_hgardfou_teta=n 
    532         IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_teta "${ByPass_hgardfou_teta}" 
    533     fi 
    534  
    535     ## Read ByPass_hgardfou_mats option in lmdz.card --> purmats=y 2 if [ $ByPass_hgardfou_mats = 1 ] 
    536     ByPass_hgardfou_mats=${lmdz_UserChoices_ByPass_hgardfou_mats} 
    537     if [ X"${ByPass_hgardfou_mats}" = X"y" ] ; then 
    538         sed -e "s/^purmats=.*/purmats=y/" gcm.def > gcm.def.tmp 
    539         IGCM_sys_Mv gcm.def.tmp gcm.def 
    540         echo 
    541         IGCM_debug_Print 1 "ByPass_hgardfou_mats : purmats=y in gcm.def" 
    542         echo 
    543         cat gcm.def 
    544         ByPass_hgardfou_mats=n 
    545         IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_mats "${ByPass_hgardfou_mats}" 
    546     fi 
     537    # Specific ByPass option only used with LMDZ dynamcis (without DYNMAICO) 
     538    if [ X${config_ListOfComponents_ICO} = X ] ; then 
     539 
     540        ## Read ByPass_hgardfou_teta option in lmdz.card --> divide teta* by 2 if [ $ByPass_hgardfou_teta = 1 ] 
     541        ByPass_hgardfou_teta=${lmdz_UserChoices_ByPass_hgardfou_teta} 
     542        if [ X"${ByPass_hgardfou_teta}" = X"y" ] ; then 
     543            awk '{ if ($0 ~ /^teta.*=/) {split($0,a,"=") ; print a[1]"="a[2]/2"."} else print $0}' gcm.def > gcm.def.tmp 
     544            IGCM_sys_Mv gcm.def.tmp gcm.def 
     545            echo 
     546            IGCM_debug_Print 1 "ByPass_hgardfou_teta : ^teta*/2 in gcm.def" 
     547            echo 
     548            cat gcm.def 
     549            ByPass_hgardfou_teta=n 
     550            IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_teta "${ByPass_hgardfou_teta}" 
     551        fi 
     552         
     553        ## Read ByPass_hgardfou_mats option in lmdz.card --> purmats=y 2 if [ $ByPass_hgardfou_mats = 1 ] 
     554        ByPass_hgardfou_mats=${lmdz_UserChoices_ByPass_hgardfou_mats} 
     555        if [ X"${ByPass_hgardfou_mats}" = X"y" ] ; then 
     556            sed -e "s/^purmats=.*/purmats=y/" gcm.def > gcm.def.tmp 
     557            IGCM_sys_Mv gcm.def.tmp gcm.def 
     558            echo 
     559            IGCM_debug_Print 1 "ByPass_hgardfou_mats : purmats=y in gcm.def" 
     560            echo 
     561            cat gcm.def 
     562            ByPass_hgardfou_mats=n 
     563            IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_mats "${ByPass_hgardfou_mats}" 
     564        fi 
     565    fi 
     566 
    547567 
    548568    # Add include of LMDZ context in iodef.xml 
     
    575595        rm add.tmp 
    576596    fi 
     597             
    577598 
    578599    # Compression level (if CompressionLevel is not empty) 
    579600    if [ ! "X${config_UserChoices_CompressionLevel}" = "X" ] ; then 
    580     echo "NetCDF output files compression level is " ${config_UserChoices_CompressionLevel} 
    581     listfile=$(ls file_def*lmdz.xml) 
    582     for file in ${listfile} ; do 
    583         sed -i -e "s/\(compression_level=\"\)[^\"]*\(\"\)/\1${config_UserChoices_CompressionLevel}\2/" ${file} 
    584     done 
    585     fi 
    586  
    587              
     601        echo "NetCDF output files compression level is " ${config_UserChoices_CompressionLevel} 
     602        listfile=$(ls file_def*lmdz.xml) 
     603        for file in ${listfile} ; do 
     604            sed -i -e "s/\(compression_level=\"\)[^\"]*\(\"\)/\1${config_UserChoices_CompressionLevel}\2/" ${file} 
     605        done 
     606    fi 
     607 
     608 
     609    # Set interpolated output grid depending on resoultion, only if ICO component is set in config.card 
     610    if [ ! "X${config_ListOfComponents_ICO}" = "X" ] ; then    
     611        if [ ${RESOL_NBP} == 40  ] ; then 
     612            valuei=144 
     613            valuej=143 
     614        elif [ ${RESOL_NBP} == 80  ] ; then 
     615            valuei=360 
     616            valuej=180 
     617        elif [ ${RESOL_NBP} == 160  ] ; then 
     618            valuei=720 
     619            valuej=360 
     620    elif [ ${RESOL_NBP} == 320  ] ; then 
     621        valuei=1440 
     622        valuej=720 
     623        else 
     624            IGCM_debug_Exit "RESOL_NBP=${RESOL_NBP} is not yet implemented in drivers" 
     625            IGCM_debug_Verif_Exit 
     626        fi 
     627 
     628        IGCM_debug_Print 1 "Modify output grid parameters for current resolution in context_lmdz.xml" 
     629        cp context_lmdz.xml context_lmdz.xml.init 
     630        sed -e "s/ni_glo.*=.*\"144\"/ni_glo=\"${valuei}\"/" \ 
     631            -e "s/nj_glo.*=.*\"143\"/nj_glo=\"${valuej}\"/" \ 
     632            context_lmdz.xml.init > context_lmdz.xml 
     633    fi 
     634 
     635 
    588636    IGCM_debug_PopStack "ATM_Update" 
    589637} 
     
    599647} 
    600648 
     649 
Note: See TracChangeset for help on using the changeset viewer.