美文网首页模式
wrf-chem运行批处理

wrf-chem运行批处理

作者: 锦鼠观天 | 来源:发表于2018-09-10 10:37 被阅读205次

    runWRFlist的编辑.py

    #!/usr/bin/python
    # -*- coding: UTF-8 -*-
    import time
    import datetime
    
    #interval = input('本次的时间间隔(hh):') #e.g. 06
    interval ='06'
    cycle = input('以上面的时间间隔转几轮:') #e.g. 50
    startTime = input('本次的开始时间yyyymmddhh:') #e.g.  2014120100
    
    for c in range(int(cycle)):
        time1 = datetime.datetime.strptime(str(startTime), "%Y%m%d%H")
        time2 = (time1+datetime.timedelta(hours=int(interval))).strftime("%Y%m%d%H")
        startTime = time2
        print('bash runWRF.sh '+time1.strftime("%Y%m%d%H")+time2+str(interval))
    
    

    runWRFlist.sh

    bash runWRF.sh 2014112200201411230024
    bash runWRF.sh 2014112300201411230606
    

    runWRF.sh

    emrealDIR=/home/bai/HQ/model/wrf3.5.1mpialtifort/WRFV3/test/em_real
    backupDIR=/home/bai/HQ/backup/newCase
    
    rundate=$1
    YYYY=$(echo $rundate |cut -c1-4)
    MM=$(echo $rundate |cut -c5-6)
    DD=$(echo $rundate |cut -c7-8)
    HH=$(echo $rundate |cut -c9-10)
    EYYYY=$(echo $rundate |cut -c11-14)
    EMM=$(echo $rundate |cut -c15-16)
    EDD=$(echo $rundate |cut -c17-18)
    EHH=$(echo $rundate |cut -c19-20)
    TP=$(echo $rundate |cut -c21-22)
    
    cat >namelist.input<<EOF
    &time_control
     run_days                            = 0,
     run_hours                           = $TP,
     run_minutes                         = 0,
     run_seconds                         = 0,
     start_year                          = $YYYY, $YYYY, $YYYY,
     start_month                         = $MM,   $MM,   $MM,
     start_day                           = $DD,   $DD,   $DD,
     start_hour                          = $HH,   $HH,   $HH,
     start_minute                        = 00,   00,   00,
     start_second                        = 00,   00,   00,
     end_year                            = $EYYYY, $EYYYY, $EYYYY,
     end_month                           = $EMM,   $EMM,   $EMM,
     end_day                             = $EDD,   $EDD,   $EDD,
     end_hour                            = $EHH,   $EHH,   $EHH,
     end_minute                          = 00,   00,   00,
     end_second                          = 00,   00,   00,
     interval_seconds                    = 21600,
     input_from_file                     = .true.,.true.,.true.,
     history_interval                    = 60,   60,   60,   
     frames_per_outfile                  = 1,    1,    1,
     restart                             = .false.,
     restart_interval                    = 5000,
     io_form_history                     = 2,
     io_form_restart                     = 2,
     io_form_input                       = 2,
     io_form_boundary                    = 2,
     auxinput1_inname                    = "met_em.d<domain>.<date>"
     io_form_auxinput5                   = 2
     io_form_auxinput12                  = 2
     auxinput12_inname                   ="wrf_chem_input"
     auxinput5_interval_m                = 60,
     debug_level                         = 00,
    /
    
    &domains
     time_step                           = 180,
     time_step_fract_num                 = 0,
     time_step_fract_den                 = 1,
     max_dom                             = 1
     s_we                                = 1,  1,   1,  
     e_we                                = 92, 97, 130,
     s_sn                                = 1,  1,   1,
     e_sn                                = 84, 85, 136,
     s_vert                              = 1,  1,   1,
     e_vert                              = 31, 31,  31,
     eta_levels                          = 1.000, 0.998, 0.995, 0.990, 0.985, 0.980,
                                           0.970, 0.960, 0.940, 0.920, 0.900,
                                           0.880, 0.850, 0.820, 0.790, 0.750,
                                           0.700, 0.650, 0.600, 0.550, 0.500,
                                           0.450, 0.400, 0.350, 0.300, 0.250,
                                           0.200, 0.150, 0.100, 0.050, 0.000,
     num_metgrid_levels                  = 27,
     dx                                  = 45000, 15000, 5000, 
     dy                                  = 45000, 15000, 5000,
     grid_id                             = 1, 2,  3,
     parent_id                           = 0, 1,  2,
     i_parent_start                      = 1, 41, 31,
     j_parent_start                      = 1, 36, 20,
     parent_grid_ratio                   = 1, 3,  3, 
     parent_time_step_ratio              = 1, 3,  3,
     feedback                            = 1,
     smooth_option                       = 0
     p_top_requested                     = 5000
     zap_close_levels                    = 50
     interp_type                         = 1
     t_extrap_type                       = 2
     force_sfc_in_vinterp                = 0
     use_levels_below_ground             = .true.
     use_surface                         = .true.
     lagrange_order                      = 1
     sfcp_to_sfcp                        = .true.,
    /
    
    &physics
     mp_physics                          = 6,  6,  6,
     progn                               = 0,  0,  0,
     ra_lw_physics                       = 4,  4,  4,
     ra_sw_physics                       = 4,  4,  4,
     radt                                = 30, 30, 30,
     sf_sfclay_physics                   = 1,  1,  1,
     sf_surface_physics                  = 2,  2,  2,
     bl_pbl_physics                      = 1,  1,  1,
     bldt                                = 1,  1,  1,
     cu_physics                          = 5,  5,  5,
     cu_diag                             = 1,  1,  1,
     cudt                                = 0,  0,  0,
     ishallow                            = 0,
     isfflx                              = 1,
     ifsnow                              = 0,
     icloud                              = 0,
     surface_input_source                = 1,
     num_soil_layers                     = 4,
     sf_urban_physics                    = 0,
     mp_zero_out                         = 2,
     mp_zero_out_thresh                  = 1.e-8,
     maxiens                             = 1,
     maxens                              = 3,
     maxens2                             = 3,
     maxens3                             = 16,
     ensdim                              = 144,
     cu_rad_feedback                     = .true.,
    /
    
    
    &fdda
    /
    
    &dfi_control
    /
    
    &dynamics
     rk_ord                              = 3,
     w_damping                           = 1,
     diff_opt                            = 1,
     km_opt                              = 4,
     base_temp                           = 290.
     damp_opt                            = 0,
     zdamp                               = 5000.,  5000.,  5000.,
     dampcoef                            = 0.2,   0.2,   0.2,
     diff_6th_opt                        = 0,      0,      0,
     diff_6th_factor                     = 0.12,   0.12,   0.12,
     khdif                               = 0,      0,      0,
     kvdif                               = 0,      0,      0,
     non_hydrostatic                     = .true., .true., .true.,
     moist_adv_opt                       = 2,   2,   2,
     scalar_adv_opt                      = 2,   2,   2,
     chem_adv_opt                        = 2,   2,   2,
     tke_adv_opt                         = 2,   2,   2,
     time_step_sound                     = 4,   4,   4,
     h_mom_adv_order                     = 5,   5,   5,
     v_mom_adv_order                     = 3,   3,   3,
     h_sca_adv_order                     = 5,   5,   5,
     v_sca_adv_order                     = 3,   3,   3,
    /
    
    
    &bdy_control
     spec_bdy_width                      = 5,
     spec_zone                           = 1,
     relax_zone                          = 4,
     specified                           = .true., .false., .false.,
     nested                              = .false., .true., .true.,
    /
    
    &grib2
    /
    
    &namelist_quilt
     nio_tasks_per_group                  = 0,
     nio_groups                           = 1,
    /
    
    &chem
     kemit                                = 11,
     chem_opt                             = 7,   7,   7,
     bioemdt                              = 30,  30,  30,
     photdt                               = 30,  30,  30,
     chemdt                               = 30,  30,  30,
     io_style_emissions                   = 1,
     emiss_inpt_opt                       = 101, 101, 101,
     emiss_opt                            = 3,   3,   3,
     chem_in_opt                          = 1,   1,   1,
     phot_opt                             = 2,   2,   2,
     gas_drydep_opt                       = 1,   1,   1,
     aer_drydep_opt                       = 1,   1,   1,
     bio_emiss_opt                        = 1,   1,   1,
     dust_opt                             = 0,
     dmsemis_opt                          = 0,
     seas_opt                             = 0,
     gas_bc_opt                           = 1,   1,   1,
     gas_ic_opt                           = 1,   1,   1,
     aer_bc_opt                           = 1,   1,   1,
     aer_ic_opt                           = 1,   1,   1,
     gaschem_onoff                        = 1,   1,   1,
     aerchem_onoff                        = 1,   1,   1,
     wetscav_onoff                        = 0,   0,   0,
     cldchem_onoff                        = 0,   0,   0,
     vertmix_onoff                        = 1,   1,   1,
     chem_conv_tr                         = 0,   0,   0,
     biomass_burn_opt                     = 0,   0,   0,
     plumerisefire_frq                    = 30,  30,  30,
     have_bcs_chem                        = .false., .false., .false.,
     aer_ra_feedback                      = 0,   0,   0,
     aer_op_opt                           = 1,
     opt_pars_out                         = 1,
     diagnostic_chem                      = 0,
    /
    EOF
    
    ln -sf ${emrealDIR}/wrfout_d01_${YYYY}-${MM}-${DD}_${HH}:00:00 ${emrealDIR}/wrf_chem_input_d01
    
    ./real.exe
    mpiexec -n 50 ./wrf.exe
    
    mkdir ${backupDIR}/$YYYY$MM$DD$HH
    
    mv -- wrfout_d0* ${backupDIR}/$YYYY$MM$DD$HH
    echo "移动到主文件夹"
    cp ${backupDIR}/$YYYY$MM$DD$HH/wrfout_d01_${EYYYY}-${EMM}-${EDD}_${EHH}:00:00 ${emrealDIR}
    echo "复制回来了"
    

    相关文章

      网友评论

        本文标题:wrf-chem运行批处理

        本文链接:https://www.haomeiwen.com/subject/ccojgftx.html