diff --git a/cases/icon-art-full-chem-LAM/config.yaml b/cases/icon-art-full-chem-LAM/config.yaml new file mode 100644 index 00000000..7a8788d5 --- /dev/null +++ b/cases/icon-art-full-chem-LAM/config.yaml @@ -0,0 +1,78 @@ +# Configuration file for the 'icon-art-full-chem-test' case with ICON + +workflow: icon-art-full-chem-LAM +constraint: mc +run_on: cpu +compute_queue: normal +compute_account: s1298 +ntasks_per_node: 36 +restart_step: PT12H +startdate: 2019-07-13T00:00:00Z +enddate: 2019-07-26T00:00:00Z + +eccodes_dir: /users/icontest/pool/data/ICON/mch/eccodes_definitions +latbc_filename: LBC_.nc +inidata_prefix: IC_ +inidata_nameformat: '%Y%m%d%H' +inidata_filename_suffix: .nc +lbcdata_prefix: LBC_ +lbcdata_nameformat: '%Y%m%d%H' +lbcdata_filename_suffix: .nc +output_filename: icon-full-chem-CH +filename_format: _ +lateral_boundary_grid_order: lateral_boundary +art_input_folder: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/art + +walltime: + prepare_icon: '00:10:00' + prepare_art_full_chem_LAM: '00:15:00' + icon: '01:00:00' + +LAM: + prefix: icon-art-full-chem_EU_ + suffix: .nc + icon_output_nameformat: '%Y%m%dT%H%M%SZ' + inc: 2 + icon_output_dir: '/scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/ICON_output' + +chem: + ini_filename: ART_ICE_iconR3B08-grid_0099.nc + +aero: + ini_filename: ART_IAE_iconR3B08-grid_0099.nc + + +input_files: + radiation_grid_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/icon_R03B07_DOM01.nc + dynamics_grid_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/icon_R03B08_DOM02.nc + map_file_latbc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/map_file.latbc + lateral_boundary_grid: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/lateral_boundary_DOM02.grid.nc + extpar_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/extpar_DOM02.nc + cldopt_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/rad/rrtm_cldopt.nc + lrtm_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/rad/rrtmg_lw.nc + map_file_ana: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/mapping/map_file.ana + meccatracer_xml_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/xml/mecca_tracers.xml + oem_gridded_emissions_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/oem/oem_gridded_emissions_DOM02.nc + oem_vertical_profiles_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/oem/vertical_profiles_DOM02.nc + oem_hourofday_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/oem/hourofday_DOM02.nc + oem_dayofweek_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/oem/dayofweek_DOM02.nc + oem_monthofyear_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/oem/monthofyear_DOM02.nc + aerodyn_tracers: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/aerodyn/tracers_aerosol.xml + aerodyn_modes: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/aerodyn/modes.xml + aerodyn_coag: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/aerodyn/coagulate.xml + aerodyn_emiss: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem-LAM/aerodyn/emiss.xml + + +icon: + binary_file: /scratch/snx3000/ckeller/proc_chain_data/ext/icon-art/bin/icon + runjob_filename: icon_runjob.cfg + LAM_icjob: icon_LAM_ic.sh + LAM_lbcjob: icon_LAM_lbc.sh + compute_queue: normal + walltime: '01:00:00' + np_tot: 10 + np_io: 3 + np_restart: 1 + np_prefetch: 1 + timestep: 60. + diff --git a/cases/icon-art-full-chem-LAM/icon_LAM_ic.sh b/cases/icon-art-full-chem-LAM/icon_LAM_ic.sh new file mode 100755 index 00000000..c2faf33b --- /dev/null +++ b/cases/icon-art-full-chem-LAM/icon_LAM_ic.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +cd {cfg.icon_input_icbc} + +# --------------------------------- +# -- Pre-processing +# --------------------------------- + +rm -f {cfg.icon_input_icbc}/{cfg.inidata_prefix}{cfg.startdate_sim_yyyymmddhh}_tmp{cfg.inidata_filename_suffix} + +# -- Change variable and coordinates names to be consistent with ICON nomenclature +cdo setpartabn,partab_LAM,convert {cfg.LAM_icon_output_dir}/{cfg.LAM_prefix}IC_{date_icon_out_format}{cfg.LAM_suffix} data_in.nc + +# --------------------------------- +# -- Re-mapping +# --------------------------------- + +# -- Retrieve the triangular horizontal grid +cdo -s selgrid,2 {cfg.input_files_scratch_dynamics_grid_filename} triangular-grid.nc + +# -- Create the weights for remapping +echo "creating weights" +cdo gendis,triangular-grid.nc data_in.nc weights.nc + +# -- Remap +cdo -s remap,triangular-grid.nc,weights.nc data_in.nc lam_final.nc +rm data_in.nc triangular-grid.nc + +# --------------------------------- +# -- Post-processing +# --------------------------------- + +ncks lam_final.nc {cfg.icon_input_icbc}/{cfg.inidata_prefix}{cfg.startdate_sim_yyyymmddhh}_tmp{cfg.inidata_filename_suffix} +rm lam_final.nc weights.nc \ No newline at end of file diff --git a/cases/icon-art-full-chem-LAM/icon_LAM_lbc.sh b/cases/icon-art-full-chem-LAM/icon_LAM_lbc.sh new file mode 100755 index 00000000..203bbd89 --- /dev/null +++ b/cases/icon-art-full-chem-LAM/icon_LAM_lbc.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +cd {cfg.icon_input_icbc} + +# -- Loop over file list +i=0 +echo "DATAFILELIST is {datafile_list}" +for datafilename in {datafile_list} ; do + datafile="${{datafilename##*/}}" # get filename without path + outdatafile=${{datafile%.*}} # get filename without suffix + ((i++)) + + # --------------------------------- + # -- Pre-processing + # --------------------------------- + + rm -f {cfg.icon_input_icbc}/${{outdatafile}}_tmp{cfg.lbcdata_filename_suffix} + + # -- Change variable and coordinates names to be consistent with ICON nomenclature + cdo setpartabn,partab_LAM,convert $datafilename data_in.nc + + # --------------------------------- + # -- Re-mapping + # --------------------------------- + + # -- Retrieve the lateral boundary grid + cdo -s selgrid,2 {cfg.input_files_scratch_lateral_boundary_grid} triangular-grid.nc + + # -- Create the weights for remapping CAM-Chem data from latlon grid onto the triangular grid + if [[ $i == "1" ]] ; then + echo "creating weights" + cdo gendis,triangular-grid.nc data_in.nc weights.nc + fi + + # -- Remap + cdo -s remap,triangular-grid.nc,weights.nc data_in.nc chem_final.nc + rm data_in.nc triangular-grid.nc + + # --------------------------------- + # -- Post-processing + # --------------------------------- + + ncks chem_final.nc {cfg.icon_input_icbc}/${{outdatafile}}_tmp{cfg.lbcdata_filename_suffix} + rm chem_final.nc + +done +# -- Clean up +rm weights.nc \ No newline at end of file diff --git a/cases/icon-art-full-chem-LAM/icon_runjob.cfg b/cases/icon-art-full-chem-LAM/icon_runjob.cfg new file mode 100644 index 00000000..7898bdd4 --- /dev/null +++ b/cases/icon-art-full-chem-LAM/icon_runjob.cfg @@ -0,0 +1,376 @@ +#!/usr/bin/env bash +#SBATCH --job-name=icon-full-chem +#SBATCH --account={cfg.compute_account} +#SBATCH --time={cfg.walltime_icon} +#SBATCH --nodes={cfg.icon_np_tot} +#SBATCH --ntasks-per-node={cfg.ntasks_per_node} +#SBATCH --partition={cfg.icon_compute_queue} +#SBATCH --constraint={cfg.constraint} +#SBATCH --hint=nomultithread +#SBATCH --output={cfg.logfile} +#SBATCH --chdir={cfg.icon_work} + +# OpenMP environment variables +# ---------------------------- +export OMP_NUM_THREADS=1 +export ICON_THREADS=1 +export OMP_SCHEDULE=static,12 +export OMP_DYNAMIC="false" +export OMP_STACKSIZE=200M + +set -e -x + +# -- ECCODES path +export ECCODES_DEFINITION_PATH={cfg.eccodes_dir} + +# ---------------------------------------------------------------------------- +# Link radiation input files +# ---------------------------------------------------------------------------- +ln -sf {cfg.art_input_folder}/runctrl_examples/photo_ctrl/* . +ln -sf {cfg.art_input_folder}/runctrl_examples/init_ctrl/* . + +# ---------------------------------------------------------------------------- +# create ICON master namelist +# ---------------------------------------------------------------------------- + +cat > icon_master.namelist << EOF +! master_nml: ---------------------------------------------------------------- +&master_nml + lrestart = {cfg.lrestart} ! .TRUE.=current experiment is resumed + read_restart_namelists = .TRUE. +/ + +! master_time_control_nml: --------------------------------------------------- +&master_time_control_nml + calendar = 'proleptic gregorian' + restartTimeIntval = '{cfg.restart_step}' + checkpointTimeIntval = '{cfg.restart_step}' + experimentStartDate = '{cfg.ini_datetime_string}' + experimentStopDate = '{cfg.end_datetime_string}' +/ + +! master_model_nml: repeated for each model ---------------------------------- +&master_model_nml + model_type = 1 ! identifies which component to run (atmosphere,ocean,...) + model_name = "ATMO" ! character string for naming this component. + model_namelist_filename = "NAMELIST_{cfg.casename}" ! file name containing the model namelists + model_min_rank = 1 ! start MPI rank for this model + model_max_rank = 65536 ! end MPI rank for this model + model_inc_rank = 1 ! stride of MPI ranks +/ +EOF + +# ---------------------------------------------------------------------- +# model namelists +# ---------------------------------------------------------------------- + +cat > NAMELIST_{cfg.casename} << EOF +! parallel_nml: MPI parallelization ------------------------------------------- +¶llel_nml + nproma = 16 ! loop chunk length + p_test_run = .FALSE. ! .TRUE. means verification run for MPI parallelization + num_io_procs = {cfg.icon_np_io} ! number of I/O processors + num_restart_procs = {cfg.icon_np_restart} ! number of restart processors + num_prefetch_proc = {cfg.icon_np_prefetch} ! number of processors for LBC prefetching + iorder_sendrecv = 3 ! sequence of MPI send/receive calls +/ + + +! run_nml: general switches --------------------------------------------------- +&run_nml + ltestcase = .FALSE. ! real case run + num_lev = 60 ! number of full levels (atm.) for each domain + lvert_nest = .FALSE. ! no vertical nesting + dtime = {cfg.icon_timestep} ! timestep in seconds + ldynamics = .TRUE. ! compute adiabatic dynamic tendencies + ltransport = .TRUE. ! compute large-scale tracer transport + ntracer = 6 ! number of advected tracers + iforcing = 3 ! forcing of dynamics and transport by parameterized processes + msg_level = 7 ! detailed report during integration + ltimer = .TRUE. ! timer for monitoring the runtime of specific routines + timers_level = 10 ! performance timer granularity + check_uuid_gracefully = .TRUE. ! give only warnings for non-matching uuids + output = "nml" ! main switch for enabling/disabling components of the model output + lart = .TRUE. ! main switch for ART + debug_check_level = 10 + restart_filename = "{cfg.icon_restart_out}/{cfg.output_filename}_.nc" +/ + +! art_nml: Aerosols and Reactive Trace gases extension------------------------------------------------- +&art_nml + lart_chem = .TRUE. ! enables chemistry + lart_mecca = .TRUE. ! enables MECCA chemistry + lart_aerosol = .TRUE. ! main switch for the treatment of atmospheric aerosol + lart_chemtracer = .FALSE. ! main switch for the treatment of chemical tracer + lart_diag_out = .FALSE. ! If this switch is set to .TRUE., diagnostic + ! ... output elds are available. Set it to + ! ... .FALSE. when facing memory problems. + iart_init_gas = 5 + cart_mecca_xml = '{cfg.input_files_scratch_meccatracer_xml_filename}' ! path to xml file for passive tracers + cart_input_folder = '{cfg.art_input_folder}' ! absolute Path to ART source code + iart_init_aero = 5 + cart_aero_emiss_xml = '{cfg.input_files_scratch_aerodyn_emiss}' + cart_aerosol_xml = '{cfg.input_files_scratch_aerodyn_tracers}' ! Path to XML file for aerosol tracers + cart_modes_xml = '{cfg.input_files_scratch_aerodyn_modes}' ! Path to XML file for modes + cart_coag_xml = '{cfg.input_files_scratch_aerodyn_coag}' ! Path to XML file for coagulation processes + iart_modeshift = 1 ! Shift2larger + iart_aero_washout = 1 ! Washout of aerosols + iart_isorropia = 1 ! Gas-aerosol partitioning +/ + +! oem_nml: online emission module --------------------------------------------- +&oemctrl_nml + gridded_emissions_nc = '{cfg.input_files_scratch_oem_gridded_emissions_nc}' + vertical_profile_nc = '{cfg.input_files_scratch_oem_vertical_profiles_nc}' + hour_of_day_nc = '{cfg.input_files_scratch_oem_hourofday_nc}' + day_of_week_nc = '{cfg.input_files_scratch_oem_dayofweek_nc}' + month_of_year_nc = '{cfg.input_files_scratch_oem_monthofyear_nc}' +/ + +! diffusion_nml: horizontal (numerical) diffusion ---------------------------- +&diffusion_nml + lhdiff_vn = .TRUE. ! diffusion on the horizontal wind field + lhdiff_temp = .TRUE. ! diffusion on the temperature field + lhdiff_w = .TRUE. ! diffusion on the vertical wind field + hdiff_order = 5 ! order of nabla operator for diffusion + itype_vn_diffu = 1 ! reconstruction method used for Smagorinsky diffusion + itype_t_diffu = 2 ! discretization of temperature diffusion + hdiff_efdt_ratio = 24.0 ! ratio of e-folding time to time step + hdiff_smag_fac = 0.025 ! scaling factor for Smagorinsky diffusion +/ + +! dynamics_nml: dynamical core ----------------------------------------------- +&dynamics_nml + iequations = 3 ! type of equations and prognostic variables +! idiv_method = 1 ! method for divergence computation + divavg_cntrwgt = 0.50 ! weight of central cell for divergence averaging + lcoriolis = .TRUE. ! Coriolis force +/ + +! extpar_nml: external data -------------------------------------------------- +&extpar_nml + itopo = 1 ! topography (0:analytical) + extpar_filename = '{cfg.input_files_scratch_extpar_filename}' ! filename of external parameter input file + n_iter_smooth_topo = 1,1 ! iterations of topography smoother + heightdiff_threshold = 3000. ! height difference between neighb. grid points + hgtdiff_max_smooth_topo = 750.,750. ! see Namelist doc + heightdiff_threshold = 2250.,1500. +/ + +! initicon_nml: specify read-in of initial state ------------------------------ +&initicon_nml + init_mode = 7 ! 7: start from DWD fg with subsequent vertical remapping + lread_ana = .FALSE. ! no analysis data will be read + dwdfg_filename = "{inidata_filename}" ! initial data filename + ana_varnames_map_file = "{cfg.input_files_scratch_map_file_ana}" ! dictionary mapping internal names onto GRIB2 shortNames + ltile_coldstart = .TRUE. ! coldstart for surface tiles + ltile_init = .FALSE. ! set it to .TRUE. if FG data originate from run without tiles +/ + +! grid_nml: horizontal grid -------------------------------------------------- +&grid_nml + dynamics_grid_filename = "{cfg.input_files_scratch_dynamics_grid_filename}" ! array of the grid filenames for the dycore + radiation_grid_filename = "{cfg.input_files_scratch_radiation_grid_filename}" ! array of the grid filenames for the radiation model + dynamics_parent_grid_id = 0 ! array of the indexes of the parent grid filenames + lredgrid_phys = .TRUE. ! .true.=radiation is calculated on a reduced grid + lfeedback = .TRUE. ! specifies if feedback to parent grid is performed + l_limited_area = .TRUE. ! .TRUE. performs limited area run + ifeedback_type = 2 ! feedback type (incremental/relaxation-based) + start_time = 0. ! Time when a nested domain starts to be active [s] +/ + +! gridref_nml: grid refinement settings -------------------------------------- +&gridref_nml + denom_diffu_v = 150. ! denominator for lateral boundary diffusion of velocity +/ + +! interpol_nml: settings for internal interpolation methods ------------------ +&interpol_nml + nudge_zone_width = 8 ! width of lateral boundary nudging zone + support_baryctr_intp = .FALSE. ! barycentric interpolation support for output + nudge_max_coeff = 0.07 + nudge_efold_width = 2.0 +/ + +! io_nml: general switches for model I/O ------------------------------------- +&io_nml + itype_pres_msl = 5 ! method for computation of mean sea level pressure + itype_rh = 1 ! method for computation of relative humidity +! lmask_boundary = .TRUE. ! mask out interpolation zone in output +/ + +! limarea_nml: settings for limited area mode --------------------------------- +&limarea_nml + itype_latbc = 1 ! 1: time-dependent lateral boundary conditions + dtime_latbc = 7200. ! time difference between 2 consecutive boundary data + nlev_latbc = 60 ! Number of vertical levels in boundary data + latbc_boundary_grid = "{cfg.input_files_scratch_lateral_boundary_grid}" ! Grid file defining the lateral boundary + latbc_path = "{cfg.icon_input_icbc}" ! Absolute path to boundary data + latbc_varnames_map_file = "{cfg.input_files_scratch_map_file_latbc}" + latbc_filename = "{cfg.latbc_filename}" ! boundary data input filename + init_latbc_from_fg = .FALSE. ! .TRUE.: take lbc for initial time from first guess +/ + +! lnd_nml: land scheme switches ----------------------------------------------- +&lnd_nml + ntiles = 3 ! number of tiles + nlev_snow = 3 ! number of snow layers + lmulti_snow = .FALSE. ! .TRUE. for use of multi-layer snow model + idiag_snowfrac = 20 ! type of snow-fraction diagnosis + lsnowtile = .TRUE. ! .TRUE.=consider snow-covered and snow-free separately + itype_root = 2 ! root density distribution + itype_heatcond = 3 ! type of soil heat conductivity + itype_lndtbl = 4 ! table for associating surface parameters + itype_evsl = 4 ! type of bare soil evaporation + itype_root = 2 ! root density distribution + cwimax_ml = 5.e-4 ! scaling parameter for max. interception storage + c_soil = 1.75 ! surface area density of the evaporative soil surface + c_soil_urb = 0.5 ! same for urban areas + lseaice = .TRUE. ! .TRUE. for use of sea-ice model + llake = .TRUE. ! .TRUE. for use of lake model +/ + +! nonhydrostatic_nml: nonhydrostatic model ----------------------------------- +&nonhydrostatic_nml + iadv_rhotheta = 2 ! advection method for rho and rhotheta + ivctype = 2 ! type of vertical coordinate + itime_scheme = 4 ! time integration scheme + ndyn_substeps = 5 ! number of dynamics steps per fast-physics step + exner_expol = 0.333 ! temporal extrapolation of Exner function + vwind_offctr = 0.2 ! off-centering in vertical wind solver + damp_height = 12500.0 ! height at which Rayleigh damping of vertical wind starts + rayleigh_coeff = 1.5 ! Rayleigh damping coefficient + divdamp_order = 24 ! order of divergence damping + divdamp_type = 3 ! type of divergence damping + divdamp_fac = 0.004 ! scaling factor for divergence damping +! l_open_ubc = .FALSE. ! .TRUE.=use open upper boundary condition + igradp_method = 3 ! discretization of horizontal pressure gradient + l_zdiffu_t = .TRUE. ! specifies computation of Smagorinsky temperature diffusion + thslp_zdiffu = 0.02 ! slope threshold (temperature diffusion) + thhgtd_zdiffu = 125.0 ! threshold of height difference (temperature diffusion) + htop_moist_proc = 22500.0 ! max. height for moist physics + hbot_qvsubstep = 22500.0 ! height above which QV is advected with substepping scheme +/ + +! nwp_phy_nml: switches for the physics schemes ------------------------------ +&nwp_phy_nml + inwp_gscp = 2 ! cloud microphysics and precipitation + inwp_convection = 1 ! convection + lshallowconv_only = .FALSE. ! only shallow convection + inwp_radiation = 1 ! radiation + inwp_cldcover = 1 ! cloud cover scheme for radiation + inwp_turb = 1 ! vertical diffusion and transfer + inwp_satad = 1 ! saturation adjustment + inwp_sso = 1 ! subgrid scale orographic drag + inwp_gwd = 0 ! non-orographic gravity wave drag + inwp_surface = 1 ! surface scheme + latm_above_top = .TRUE. ! take into account atmosphere above model top for radiation computation + ldetrain_conv_prec = .TRUE. + efdt_min_raylfric = 7200. ! minimum e-folding time of Rayleigh friction + itype_z0 = 2 ! type of roughness length data + icapdcycl = 3 ! apply CAPE modification to improve diurnalcycle over tropical land + icpl_aero_conv = 1 ! coupling between autoconversion and Tegen aerosol climatology + icpl_aero_gscp = 1 ! coupling between autoconversion and Tegen aerosol climatology + lrtm_filename = '{cfg.input_files_scratch_lrtm_filename}' ! longwave absorption coefficients for RRTM_LW + cldopt_filename = '{cfg.input_files_scratch_cldopt_filename}' ! RRTM cloud optical properties + dt_rad = 720. ! time step for radiation in s + dt_conv = 120. ! time step for convection in s (domain specific) + dt_sso = 120. ! time step for SSO parameterization + dt_gwd = 360. ! time step for gravity wave drag parameterization +/ + +! nwp_tuning_nml: additional tuning parameters ---------------------------------- +&nwp_tuning_nml + itune_albedo = 1 ! reduced albedo (w.r.t. MODIS data) over Sahara + tune_gkwake = 1.8 + tune_gkdrag = 0.01 + tune_minsnowfrac = 0.3 +/ + +! output_nml: specifies an output stream -------------------------------------- +&output_nml + filetype = 5 ! output format: 2=GRIB2, 4=NETCDFv2 + dom = 1 ! write domain 1 only + output_bounds = 0., 10000000., 3600. ! start, end, increment + steps_per_file = 1 ! number of steps per file + include_last = .TRUE. + remap = 0 + output_filename = '{cfg.output_filename}' + filename_format = '{cfg.icon_output}/{cfg.filename_format}' ! file name base + output_grid = .TRUE. + ml_varlist = 'group:ATMO_ML_VARS' , + 'group:PBL_VARS', + 'group:PRECIP_VARS', + 'group:NH_PROG_VARS', + 'z_mc', 'z_ifc', 'geopot', + 'group:ART_CHEMISTRY', + 'group:ART_AEROSOL', + 'topography_c', + 'pres', 'pres_ifc', 'pres_sfc', + 'tempv', 'temp_ifc' +/ + +! radiation_nml: radiation scheme --------------------------------------------- +&radiation_nml + irad_o3 = 7 ! ozone climatology + irad_aero = 6 ! aerosols + albedo_type = 2 ! type of surface albedo + vmr_co2 = 390.e-06 + vmr_ch4 = 1800.e-09 + vmr_n2o = 322.0e-09 + vmr_o2 = 0.20946 + vmr_cfc11 = 240.e-12 + vmr_cfc12 = 532.e-12 +/ + +! sleve_nml: vertical level specification ------------------------------------- +&sleve_nml + min_lay_thckn = 20.0 ! layer thickness of lowermost layer + top_height = 23000.0 ! height of model top + stretch_fac = 0.65 ! stretching factor to vary distribution of model levels + decay_scale_1 = 4000.0 ! decay scale of large-scale topography component + decay_scale_2 = 2500.0 ! decay scale of small-scale topography component + decay_exp = 1.2 ! exponent of decay function + flat_height = 16000.0 ! height above which the coordinate surfaces are flat +/ + +! transport_nml: tracer transport --------------------------------------------- +&transport_nml + npassive_tracer = 0 ! number of additional passive tracers + ivadv_tracer = 3, 3, 3, 3, 3, 3 ! tracer specific method to compute vertical advection + itype_hlimit = 3, 4, 4, 4, 4, 4 ! type of limiter for horizontal transport + ihadv_tracer = 52, 2, 2, 2, 2, 22 ! tracer specific method to compute horizontal advection + llsq_svd = .TRUE. ! use SV decomposition for least squares design matrix +/ + +! turbdiff_nml: turbulent diffusion ------------------------------------------- +&turbdiff_nml + tkhmin = 0.75 ! scaling factor for minimum vertical diffusion coefficient + tkmmin = 0.75 ! scaling factor for minimum vertical diffusion coefficient + pat_len = 750.0 ! effective length scale of thermal surface patterns + c_diff = 0.2 ! length scale factor for vertical diffusion of TKE + rat_sea = 0.8 ! controls laminar resistance for sea surface + ltkesso = .TRUE. ! consider TKE-production by sub-grid SSO wakes + frcsmot = 0.2 ! these 2 switches together apply vertical smoothing of the TKE source terms + imode_frcsmot = 2 ! in the tropics (only), which reduces the moist bias in the tropical lower troposphere + itype_sher = 3 ! type of shear forcing used in turbulence + ltkeshs = .TRUE. ! include correction term for coarse grids in hor. shear production term + a_hshr = 2.0 ! length scale factor for separated horizontal shear mode + icldm_turb = 1 ! mode of cloud water representation in turbulence + ldiff_qi = .TRUE. +/ + +EOF + +# ---------------------------------------------------------------------- +# run the model! +# ---------------------------------------------------------------------- +handle_error(){{ + # Check for invalid pointer error at the end of icon-art + if grep -q "free(): invalid pointer" {cfg.logfile} && grep -q "clean-up finished" {cfg.logfile}; then + exit 0 + else + exit 1 + fi +}} +srun ./{cfg.icon_execname} || handle_error diff --git a/cases/icon-art-full-chem-LAM/partab_LAM b/cases/icon-art-full-chem-LAM/partab_LAM new file mode 100644 index 00000000..04129b22 --- /dev/null +++ b/cases/icon-art-full-chem-LAM/partab_LAM @@ -0,0 +1,210 @@ +¶meter +name = ua +out_name = u +standard_name = eastward_wind +long_name = "Zonal wind" +units = "m s-1" +/ +¶meter +name = va +out_name = v +standard_name = northward_wind +long_name = "Meridional wind" +units = "m s-1" +/ +¶meter +name = wa +out_name = w +standard_name = upward_air_velocity +long_name = "Vertical velocity" +units = "m s-1" +/ +¶meter +name = pres +out_name = P +long_name = "Pressure" +units = "Pa" +/ +¶meter +name = temp +out_name = T +long_name = "Temperature" +units = "K" +/ +¶meter +name = hus +out_name = qv +long_name = "Specific humidity" +units = "kg kg-1" +/ +¶meter +name = clw +out_name = qc +long_name = "specific cloud water content" +units = "kg kg-1" +/ +¶meter +name = cli +out_name = qi +long_name = "specific cloud ice content" +units = "kg kg-1" +/ +¶meter +name = qr +out_name = qr +long_name = "specific rain content" +units = "kg kg-1" +/ +¶meter +name = qs +out_name = qs +long_name = "specific snow content" +units = "kg kg-1" +/ +¶meter +name = z_ifc +out_name = hhl +standard_name = geometric_height_at_half_level_center +long_name = "geometric height at half level center" +units = "m" +/ +¶meter +name = tke +out_name = tke +standard_name = specific_kinetic_energy_of_air +long_name = "turbulent kinetic energy" +units = "m2 s-2" +/ +¶meter +name = ts +out_name = t_g +long_name = "weighted surface temperature" +units = "K" +/ +¶meter +name = t_ice +out_name = t_ice +long_name = "sea/lake-ice temperature" +units = "K" +/ +¶meter +name = h_ice +out_name = h_ice +long_name = "sea/lake-ice depth" +units = "m" +/ +¶meter +name = t_mnw_lk +out_name = t_mnw_lk +long_name = "mean temperature of the water column" +units = "K" +/ +¶meter +name = t_wml_lk +out_name = t_wml_lk +long_name = "mixed-layer temperature" +units = "K" +/ +¶meter +name = h_ml_lk +out_name = h_ml_lk +long_name = "mixed-layer thickness" +units = "m" +/ +¶meter +name = t_bot_lk +out_name = t_bot_lk +long_name = "temperature at the water-bottom sediment interface" +units = "K" +/ +¶meter +name = c_t_lk +out_name = c_t_lk +long_name = "shape factor (temp. profile in lake thermocline)" +units = "-" +/ +¶meter +name = qv_s +out_name = qv_s +long_name = "specific humidity at the surface" +units = "kg kg-1" +/ +¶meter +name = w_i +out_name = w_i +long_name = "weighted water content of interception water" +units = "kg m-2" +/ +¶meter +name = t_so +out_name = t_so +long_name = "weighted soil temperature (main level)" +units = "K" +/ +¶meter +name = gz0 +out_name = z0 +long_name = "roughness length" +units = "m" +/ +¶meter +name = alb_si +out_name = ALB_SEAICE +long_name = "sea ice albedo (diffuse)" +units = "%" +/ +¶meter +name = smi +out_name = smi +long_name = "soil moisture index" +units = "-" +/ +¶meter +name = w_so_ice +out_name = w_so_ice +long_name = "ice content" +units = "kg m-2" +/ +¶meter +name = t_snow +out_name = t_snow +long_name = "weighted temperature of the snow-surface" +units = "K" +/ +¶meter +name = w_snow +out_name = w_snow +long_name = "weighted water equivalent of snow" +units = "kg m-2" +/ +¶meter +name = rho_snow +out_name = rho_snow +long_name = "weighted snow density" +units = "kg m-3" +/ +¶meter +name = h_snow +out_name = h_snow +long_name = "weighted snow depth" +units = "m" +/ +¶meter +name = freshsnow +out_name = FRESHSNW +long_name = "weighted indicator for age of snow in top of snow layer" +units = "1" +/ +¶meter +name = fr_seaice +out_name = FR_ICE +long_name = "fraction of sea ice" +units = "1" +/ +¶meter +name = fr_land +out_name = fr_land +standard_name = land_area_fraction +long_name = "Fraction land" +units = "1" +/ \ No newline at end of file diff --git a/jobs/prepare_art_full_chem_LAM.py b/jobs/prepare_art_full_chem_LAM.py new file mode 100644 index 00000000..8f4b0e89 --- /dev/null +++ b/jobs/prepare_art_full_chem_LAM.py @@ -0,0 +1,378 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import logging +import xarray as xr +from . import tools, prepare_icon +import shutil +import subprocess + +BASIC_PYTHON_JOB = True + +def main(cfg): + """ + Prepare ICON-ART simulations with full chemistry. + + Parameters + ---------- + cfg : Config + Object holding all user-configuration parameters as attributes. + """ + prepare_icon.set_cfg_variables(cfg) + tools.change_logfile(cfg.logfile) + logging.info("Prepare ICON-ART for full chemistry LAM simulation.") + + ## ---------------------------------- + ## -- Remapping from EU to CH grid -- + ## ---------------------------------- + + # -- Copy partab_LAM in workdir + shutil.copy( + os.path.join(cfg.case_path, 'partab_LAM'), + os.path.join(cfg.icon_input_icbc, 'partab_LAM')) + + # -- Create initial conditions on ICON grid + if cfg.lrestart == '.FALSE.': + + # -- startdate in ICON output format + date_icon_out_format = cfg.startdate_sim.strftime(cfg.LAM_icon_output_nameformat) + + # -- Copy IC remapping script in workdir + with open( + os.path.join(cfg.case_path, 'icon_LAM_ic.sh') + ) as inf: + to_write = inf.read() + output_file = os.path.join(cfg.icon_input_icbc, 'icon_LAM_ic.sh') + with open(output_file, "w") as outf: + outf.write(to_write.format(cfg=cfg, + date_icon_out_format = date_icon_out_format)) + + # -- Run IC remapping script + process = subprocess.Popen([ + "bash", + os.path.join(cfg.icon_input_icbc, 'icon_LAM_ic.sh') + ], + stdout=subprocess.PIPE) + process.communicate() + + # -- Create lateral boundary conditions on ICON grid + + # -- Collect file list + datafile_list = [] + for time in tools.iter_hours(cfg.startdate_sim, cfg.enddate_sim, + cfg.LAM_inc): + icon_output_file = os.path.join(cfg.LAM_icon_output_dir, + cfg.LAM_prefix + + "LBC_" + + time.strftime(cfg.LAM_icon_output_nameformat)) + datafile_list.append(str(icon_output_file) + cfg.LAM_suffix) + datafile_list = ' '.join([str(v) for v in datafile_list]) + + # -- Copy LBC remapping script in workdir + with open( + os.path.join(cfg.case_path, 'icon_LAM_lbc.sh') + ) as inf: + to_write = inf.read() + output_file = os.path.join(cfg.icon_input_icbc, 'icon_LAM_lbc.sh') + with open(output_file, "w") as outf: + outf.write(to_write.format(cfg=cfg, + datafile_list = datafile_list)) + + # -- Run LBC remapping script + process = subprocess.Popen([ + "bash", + os.path.join(cfg.icon_input_icbc, 'icon_LAM_lbc.sh') + ], + stdout=subprocess.PIPE) + process.communicate() + + # -- Rename LBC files + for time in tools.iter_hours(cfg.startdate_sim, cfg.enddate_sim, + cfg.LAM_inc): + old_name = os.path.join(cfg.icon_input_icbc, + cfg.LAM_prefix + + "LBC_" + + time.strftime(cfg.LAM_icon_output_nameformat) + + '_tmp' + + cfg.lbcdata_filename_suffix + ) + new_name = os.path.join(cfg.icon_input_icbc, + cfg.lbcdata_prefix + + time.strftime(cfg.lbcdata_nameformat) + + '_tmp' + + cfg.lbcdata_filename_suffix + ) + tools.rename_file(old_name, new_name) + + ## ------------------------------ + ## -- Chemistry and Aerosol IC -- + ## ------------------------------ + + substr_chem = ["_full"] + substr_aero = ["_insol", "_sol", "_mixed", "_giant"] + var_list = ['clon','clon_bnds','clat','clat_bnds','height','height_bnds','time'] + + if cfg.lrestart == '.FALSE.': + in_file = os.path.join( + cfg.icon_input_icbc, + cfg.inidata_prefix + + cfg.startdate_sim_yyyymmddhh + + '_tmp' + + cfg.inidata_filename_suffix + ) + out_meteo = os.path.join( + cfg.icon_input_icbc, + cfg.inidata_prefix + + cfg.startdate_sim_yyyymmddhh + + cfg.inidata_filename_suffix + ) + out_chem = os.path.join( + cfg.art_input_folder, + cfg.chem_ini_filename + ) + out_aero = os.path.join( + cfg.art_input_folder, + cfg.aero_ini_filename + ) + + # -- Create datasets and copy global attributes + ds_in = xr.open_dataset(in_file) + ds_meteo = xr.Dataset(attrs=ds_in.attrs) + ds_chem = xr.Dataset(attrs=ds_in.attrs) + ds_aero = xr.Dataset(attrs=ds_in.attrs) + + # -- Write variables to IC files + for var_name, var in ds_in.variables.items(): + var_to_copy = var.copy(deep=True) + if var_name in var_list: + ds_chem[var_name] = var_to_copy + ds_aero[var_name] = var_to_copy + ds_meteo[var_name] = var_to_copy + + else: + # -- Copy gas phase variables + if any(substring in var_name for substring in substr_chem): + ds_chem[var_name] = var_to_copy + + # -- Copy aerosol variables + elif any(substring in var_name for substring in substr_aero): + ds_aero[var_name] = var_to_copy + + # -- Copy meteo variables + else: + ds_meteo[var_name] = var_to_copy + + + # -- Write datasets to file + ds_meteo.to_netcdf(out_meteo) + ds_chem.to_netcdf(out_chem) + ds_aero.to_netcdf(out_aero) + + # -- Close the datasets + ds_in.close() + ds_meteo.close() + ds_chem.close() + ds_aero.close() + + # -- Remove temp file + tools.remove_file(in_file) + + logging.info( + "Created IC files {} and {}".format(out_chem, out_aero)) + + # -- CK: The following is because of memory issues, try to resolve in a different way! + ## ---------------------------------------- + ## -- Reduce number of variables for LBC -- + ## ---------------------------------------- + + lbc_list = ['ALKNO3_full', + 'BENZENE_full', + 'C5H6O2_full', + 'BIGALD1_full', + 'BIGALD2_full', + 'BIGALD3_full', + 'BIGALD4_full', + 'C5H12_full', + 'C4H8_full', + 'C2H2_full', + 'C2H4_full', + 'C2H5OH_full', + 'C2H6_full', + 'C3H6_full', + 'C3H8_full', + 'HCHO_full', + 'CH3CHO_full', + 'CH3COCH3_full', + 'MGLYOX_full', + 'CH3CO2H_full', + 'CH3OH_full', + 'CH3OOH_full', + 'CH4_full', + 'CO_full', + 'CRESOL_full', + 'DMS_full', + 'GLYOX_full', + 'H2O_full', + 'H2O2_full', + 'HCOOH_full', + 'HNO3_full', + 'HO2_full', + 'HNO4_full', + 'LHONITR_full', + 'ACETOL_full', + 'C5H8_full', + 'LISOPBDNO3_full', + 'LISOPACNO3_full', + 'MACR_full', + 'MEK_full', + 'MPAN_full', + 'MVK_full', + 'N2O_full', + 'N2O5_full', + 'NH3_full', + 'NO_full', + 'NO2_full', + 'NO3_full', + 'NOA_full', + 'O3_full', + 'OH_full', + 'LONITR_full', + 'PAN_full', + 'PBZNIT_full', + 'PHENOL_full', + 'SO2_full', + 'BPINANO3_full', + 'TOLUENE_full', + 'LXYL_full', + 'APINENE_full', + 'BPINENE_full', + 'MYRC_full', + 'LIMON_full', + 'BCARY_full', + 'MBO_full', + 'nmb_sol_ait', + 'nmb_sol_acc', + 'nmb_sol_coa', + 'nmb_insol_ait', + 'nmb_insol_acc', + 'nmb_insol_coa', + 'nmb_mixed_ait', + 'nmb_mixed_acc', + 'nmb_mixed_coa', + 'nmb_giant', + 'dust_insol_acc', + 'dust_insol_coa', + 'dust_mixed_acc', + 'dust_mixed_coa', + 'dust_giant', + 'seas_giant', + 'na_sol_ait', + 'na_sol_acc', + 'na_sol_coa', + 'na_mixed_ait', + 'na_mixed_acc', + 'na_mixed_coa', + 'cl_sol_ait', + 'cl_sol_acc', + 'cl_sol_coa', + 'cl_mixed_ait', + 'cl_mixed_acc', + 'cl_mixed_coa', + 'soot_insol_ait', + 'soot_mixed_ait', + 'soot_insol_acc', + 'soot_mixed_acc', + 'soot_insol_coa', + 'soot_mixed_coa', + 'poa_insol_ait', + 'poa_mixed_ait', + 'poa_insol_acc', + 'poa_mixed_acc', + 'poa_insol_coa', + 'poa_mixed_coa', + 'pm_insol_ait', + 'pm_mixed_ait', + 'pm_insol_acc', + 'pm_mixed_acc', + 'pm_insol_coa', + 'pm_mixed_coa', + 'so4_sol_ait', + 'so4_sol_acc', + 'so4_sol_coa', + 'so4_mixed_ait', + 'so4_mixed_acc', + 'so4_mixed_coa', + 'nh4_sol_ait', + 'nh4_sol_acc', + 'nh4_sol_coa', + 'nh4_mixed_ait', + 'nh4_mixed_acc', + 'nh4_mixed_coa', + 'no3_sol_ait', + 'no3_sol_acc', + 'no3_sol_coa', + 'no3_mixed_ait', + 'no3_mixed_acc', + 'no3_mixed_coa', + 'u','v','w', + 'P','T', + 'qv','qc','qi','qr','qs', + 'hhl', + 'clat','clat_bnds', + 'clon','clon_bnds', + 'depth', + 'depth_2','depth_2_bnds', + 'height','height_bnds', + 'height_2', + 'height_3','height_3_bnds', + 'height_4', + 'height_5', + 'height_6','height_6_bnds', + 'time'] + + for time in tools.iter_hours(cfg.startdate_sim, cfg.enddate_sim, + cfg.LAM_inc): + in_file = os.path.join(cfg.icon_input_icbc, + cfg.lbcdata_prefix + + time.strftime(cfg.lbcdata_nameformat) + + '_tmp' + + cfg.lbcdata_filename_suffix + ) + out_file = os.path.join(cfg.icon_input_icbc, + cfg.lbcdata_prefix + + time.strftime(cfg.lbcdata_nameformat) + + cfg.lbcdata_filename_suffix + ) + + ds_in = xr.open_dataset(in_file) + + all_vars = list(ds_in.variables) + + # -- Select LBC variables + lbc_vars = [var for var in all_vars if var in lbc_list] + + # -- Create dataset and copy global attributes + ds_out = xr.Dataset(attrs=ds_in.attrs) + + # -- Copy variables + for var_name in lbc_vars: + lbc_var = ds_in[var_name] + lbc_var_to_copy = lbc_var.copy(deep=True) + + ds_out[var_name] = lbc_var_to_copy + + # -- Write dataset to NetCDF file + ds_out.to_netcdf(out_file) + + # -- Close datasets + ds_in.close() + ds_out.close() + + # -- Remove temp file + tools.remove_file(in_file) + + + # -- Create symbolic link to LBC file at experiment start + if cfg.lrestart == '.TRUE.': + tools.symlink_file(cfg.ini_LBC_file, cfg.ini_LBC_file_scratch) \ No newline at end of file