!------------------------------------------------------------------------------
!-- INITIALIZATION PARAMETER NAMELIST
!-- Documentation: https://palm.muk.uni-hannover.de/trac/wiki/doc/app/inipar
!------------------------------------------------------------------------------
 &initialization_parameters

!
!-- model grid
!--------------------------------------
    nx                   = 255,
    ny                   = 255,
    nz                   = 128,

    dx                   = 2.0,
    dy                   = 2.0,
    dz                   = 2.0,

    dz_stretch_level = 102.0,
    dz_stretch_factor = 1.1,
    dz_max = 50.0,
!
!-- pressure solver
!--------------------------------------
    psolver = 'multigrid',
    cycle_mg  = 'w',
    mg_cycles = 2,
    mg_switch_to_pe0_level = -1,
    monotonic_limiter_z = .T., ! recommended by R. Forkel and S. Banzhaf

!
!-- Mode
!------------------------------------------------------------------------------
    humidity             = .T.,
    q_surface = 0.012363,
    q_vertical_gradient = -0.011919, -0.000367, -0.000651, -0.000694, -0.000201, -0.000134, -0.000111, -0.000329, -0.000593, -0.000119,
    q_vertical_gradient_level = 0.0, 24.0, 56.0, 104.0, 200.0, 296.0, 504.0, 1000.0, 1496.0, 1992.0,

!
!-- Initialization
!------------------------------------------------------------------------------
    initializing_actions = 'set_1d-model_profiles',

    pt_surface = 291.152191,
    pt_vertical_gradient = -9.038289, 1.443481, 2.653631, 1.858521, 1.101081, 0.542010, 0.112786, 0.260009, 0.672236, 0.442325,
    pt_vertical_gradient_level = 0.0, 24.0, 56.0, 104.0, 200.0, 296.0, 504.0, 1000.0, 1496.0, 1992.0,

    ug_surface = 0.000000,
    ug_vertical_gradient = -0.215962, -1.868041, -2.474569, -0.551770, 0.262111, 0.746848, 0.113216, -0.420938, -0.120936, 0.037195,
    ug_vertical_gradient_level = 0.0, 24.0, 56.0, 104.0, 200.0, 296.0, 504.0, 1000.0, 1496.0, 1992.0,

    vg_surface = 0.000000,
    vg_vertical_gradient = -0.618074, -3.592877, -2.723543, -0.308035, 0.268270, 0.363451, 0.022977, 0.192038, 0.521942, -0.070880,
    vg_vertical_gradient_level = 0.0, 24.0, 56.0, 104.0, 200.0, 296.0, 504.0, 1000.0, 1496.0, 1992.0,

    origin_date_time     = '2018-07-16 00:00:00 +00',
    constant_flux_layer = .T.,

    rayleigh_damping_height = 2000.0,  ! start damping with grid stretching
                                       ! use default damping factor according to Matthias' experiences

!
!-- Boundary conditions
!------------------------------------------------------------------------------

    bc_lr = 'cyclic',
    bc_ns = 'cyclic',
!
!-- time
!--------------------------------------
    origin_date_time = '2018-07-16 00:00:00 +00',
!
!-- wall/soil spinup
!--------------------------------------
    spinup_time         = 86400.0, ! like VALM02
    spinup_pt_mean      = 296.15, ! 23 °C
    spinup_pt_amplitude = 12.3, ! like VALM02
    dt_spinup           = 3.0, ! like VALM02
    data_output_during_spinup = .F.,
!
!-- building topology
!--------------------------------------
    topography = 'read_from_file',
 /


!
!-- Physics
!------------------------------------------------------------------------------
    longitude            = 13.4048,
    latitude             = 52.4746,

    omega = 0.0,

!-------------------------------------------------------------------------------
!-- RUNTIME PARAMETER NAMELIST
!   Documentation: https://palm.muk.uni-hannover.de/trac/wiki/doc/app/d3par
!-------------------------------------------------------------------------------
 &runtime_parameters

!
!-- Run steering
!------------------------------------------------------------------------------
    end_time              = 108000.0, ! 30 h

    !dt_restart = 3600.0, ! 1 h
    !restart_time = 3600.0, ! 1 h

!
!-- processor topology
!--------------------------------------
    ! npex = 5,
    ! npey = 5,

!
!-- Run-control/timeseries output settings
!------------------------------------------------------------------------------
    dt_run_control        =  0.0,
    dt_dots               =  0.0, ! like VALM02

!
!-- Profile output settings
!------------------------------------------------------------------------------
    skip_time_dopr        =   0.0,
    dt_dopr               = 600.0,
    averaging_interval_pr = 600.0,

    data_output_pr = '#u', 'w"u"', 'w*u*', 'wu', 'u*2',
                     '#v', 'w"v"', 'w*v*', 'wv', 'v*2',
                     'w', 'w*2',
                     'rho', 'hyp', 'p',
                     'e', 'e*',
                     'l',
                     '#theta', 'w"theta"', 'w*theta*','wtheta', 'theta*2',
                     '#q', 'w"q"', 'w*q*','wq', 'q*2',
                     ! '#qv', 'w"qv"', 'w*qv*','wqv',
                     'rh',
                     '#t_soil', '#m_soil',
                     'rad_lw_in', 'rad_lw_out',
                     'rad_sw_in', 'rad_sw_out',                  !quantities of rrtmg

!
!-- 2D/3D output settings
!------------------------------------------------------------------------------
    netcdf_data_format = 5, !parallel netcdf
    do3d_at_begin      = .T.,
    do2d_at_begin      = .T.,

    dt_data_output     = 1800.0,
    dt_do2d_xy         = 300.0,
    dt_do2d_xz         = 300.0,
    dt_do2d_yz         = 300.0,
    dt_domask          = 1800.0,

    dt_data_output_av  = 1800.0,
    averaging_interval = 1800.0,
    dt_averaging_input =  0.0, ! use all time steps as input for averaging

    mask_k_over_surface(1,:) = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,  ! lowest levels (terrain-following)
    section_xy         = 1,2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,60,75,100,125,
    section_xz         = 100,
    section_yz         = 100,

    data_output = 'u_av',
                  'v_av'
                  'w_av',
                  'theta_av',
                  'ta_av',
                  'q_av',
                  ! 'qv_av',
                  'e_av',
                  'ti_av',
                  'p_av',
                  'm_soil_av',
                  't_soil_av',
                  ! 'pcm_transpirationrate_av',
                  ! 'pcm_heatrate_av',
                  ! 'pcm_latentrate_av',

                  'wspeed_10m*_xy_av',
                  'theta_2m*_xy_av',
                  'ta_xy_av',
                  'shf*_xy_av',
                  'ghf*_xy_av',
                  ! 'wq_xy_av',
                  'us*_xy_av',
                  'z0*_xy_av',
                  'ol*_xy_av',
                  'm_liq*_xy_av',
                  'r_s*_xy_av',
                  'r_a*_xy_av',
                  'rad_net*_xy_av',
                  'rad_lw_in*_xy_av',
                  'rad_lw_out*_xy_av',
                  'rad_sw_in*_xy_av',
                  'rad_sw_out*_xy_av',
                  'qsws*_xy_av',
                  'tsurf*_xy_av',
                  'u_xy_av',
                  'v_xy_av',
                  'w_xy_av',
                  'theta_xy_av',
                  'q_xy_av',
                  ! 'qv_xy_av',
                  'ti_xy_av',
                  'bio_pet*_xy_av',
                  'bio_utci*_xy_av',
                  'bio_mrt*_xy_av',

                  'u_xz_av',
                  'v_xz_av',
                  'w_xz_av',
                  'theta_xz_av',
                  'ta_xz_av',
                  'q_xz_av',
                  ! 'qv_xz_av',
                  'ti_xz_av',

                  'u_yz_av',
                  'v_yz_av',
                  'w_yz_av',
                  'theta_yz_av',
                  'ta_yz_av',
                  'q_yz_av',
                  ! 'qv_yz_av',
                  'ti_yz_av',

    data_output_masks(1,:) =  'u', 'v', 'w', 'theta', 'q', 'wspeed', 'wdir', 'ti', 'ta'


 / ! end of d3par namelist

!---------------------------------------------------------------------------------------
!-- SURFACE DATA OUTPUT MODEL PARAMETER NAMELIST
!   Documentation: https://palm.muk.uni-hannover.de/trac/wiki/doc/app/surface_output_par
!---------------------------------------------------------------------------------------
 &surface_data_output_parameters
    data_output_surf        = 'theta_surface_av', 'theta1_av',
                              'shf_av', 'qsws_av', 'ghf_av',
                              'rad_lw_out_av', 'rad_sw_out_av', 'rad_lw_in_av', 'rad_sw_in_av',
                              'rad_net_av', 'rad_lw_dif_av', 'rad_sw_dif_av', 'rad_lw_ref_av', 'rad_sw_ref_av',
                              'albedo_av', 'emissivity_av', 'uvw1_av', 'waste_heat_av',

   skip_time_dosurf        =    0.0,
   dt_dosurf               = 1800.0,

   skip_time_dosurf_av     =    0.0,
   averaging_interval_surf = 1800.0,
   dt_dosurf_av            = 1800.0,

   to_netcdf               = .T.,
 / ! end of surface_output_parameters namelist


!---------------------------------------------------------------------------------------
!-- RADIATION MODEL PARAMETER NAMELIST
!   Documentation: https://palm.muk.uni-hannover.de/trac/wiki/doc/app/radpar
!---------------------------------------------------------------------------------------
 &radiation_parameters
    radiation_scheme = 'rrtmg',
    dt_radiation     = 60.0,

    constant_albedo  = .F.,

    surface_reflections = .T.,

    nrefsteps = 3,

    ! rad_angular_discretization = .T.,
    raytrace_mpi_rma = .T.,

    raytrace_discrete_azims = 64,
    raytrace_discrete_elevs = 32,

    mrt_nlevels = 1,

 / ! end of radiation_parameters namelist


!------------------------------------------------------------------------------
!-- URBAN SURFACE MODEL PARAMETER NAMELIST
!   Documentation: https://palm.muk.uni-hannover.de/trac/wiki/doc/app/usmpar
!------------------------------------------------------------------------------
 &urban_surface_parameters
    wall_inner_temperature   = 299.95,  ! same temperature as inital indoor temperature
    window_inner_temperature = 299.95,  ! (these temperatures are only used if the
    roof_inner_temperature   = 299.95,  ! indoor model is deactivated)
 / ! end of urban_surface_parameters namelist


!------------------------------------------------------------------------------
!-- LAND SURFACE MODEL PARAMETER NAMELIST
!   Documentation: https://palm.muk.uni-hannover.de/trac/wiki/doc/app/lsmpar
!------------------------------------------------------------------------------
 &land_surface_parameters
    root_fraction         =   0.49,    0.26,    0.25,     0.0,      0.0,    0.0,     0.0,     0.0,
    ! @NOTE Values are read from dynamic driver
    ! @WARNING Values must still be given as they are still required within some code parts for allocation
    soil_moisture         =   0.2489232, 0.2494228, 0.2509268, 0.2526697, 0.1843869, 0.2897423, 0.2897409, 0.2897411,
    soil_temperature      = 287.1711,  287.7515,  289.1007,  291.8197,  290.0716,  286.0776,  280.855,   282.1435,
    deep_soil_temperature = 282.1435

    constant_roughness     = .T.,
 / ! end of land_surface_parameters namelist


!------------------------------------------------------------------------------
!-- PLANT CANOPY MODEL PARAMETER NAMELIST
!   Documentation: https://palm.muk.uni-hannover.de/trac/wiki/doc/app/canpar
!------------------------------------------------------------------------------
 &plant_canopy_parameters
    canopy_mode = 'read_from_file',
    canopy_drag_coeff = 0.3,
    plant_canopy_transpiration = .T.,
    switch_off_module = .T.,
 / ! end of plant_canopy_parameters namelist


!------------------------------------------------------------------------------
!-- CHEMISTRY MODEL PARAMETER NAMELIST
!   Documentation: https://palm.muk.uni-hannover.de/trac/wiki/doc/app/chempar
!------------------------------------------------------------------------------
 &chemistry_parameters
!
!-- General settings
    chem_mechanism             = 'phstatp',
    chem_gasphase_on           = .T.,
    call_chem_at_all_substeps  = .F.,
!
!-- Photolysis
    photolysis_scheme          = 'simple',
!
!-- Deposition
    deposition_dry             = .T.,
!
!-- Boundary conditions. De-cycling of chemistry compounds
    ! decycle_chem_lr            = .T., !(only required for cyclic boundaries)
    ! decycle_chem_ns            = .T., !(only required for cyclic boundaries)
    ! decycle_method             = 'neumann','neumann','neumann','neumann',
    bc_cs_l                    = 'neumann',
    bc_cs_r                    = 'neumann',
    bc_cs_s                    = 'neumann',
    bc_cs_n                    = 'neumann',
    bc_cs_b                    = 'neumann',
    bc_cs_t                    = 'neumann',
!
!-- Surface concentration of PM10 in kg m-3, units for gases in ppm
!-- "cs" stands for chemical species
    cs_name                    = 'O3',  'NO',  'NO2', 'PM10',
    cs_surface                 = 0.015, 0.001, 0.010, 10.0e-09,       !units- chem spcs in ppm, and PM10 in ug/m**2; RCHO = 0.001
!
!-- Initial profiles (also for lateral boundaries if 'set_constant_profiles' is chosen)
!-- units for gases in ppm, units for PM in kg m-3
    cs_profile(1,:)            =  0.015, 0.015,  0.05,
    cs_profile(2,:)            =  0.001, 0.000,
    cs_profile(3,:)            =  0.010, 0.002,
    cs_profile(4,:)            =  10.0e-09, 1.0e-09,

    cs_heights(1,:)            =  0.0,  245.0, 495.0,
    cs_heights(2,:)            =  0.0,  495.0,
    cs_heights(3,:)            =  0.0,  495.0,
    cs_heights(4,:)            =  0.0,  495.0,
!
!-- Emission depending on street type from static driver,
!-- surface emission (csflux) of PM10, PM25 in kg m-2 d-1, for gases in umol m-2 d-1 for PARAMETERIZED,
!-- emiss_factor_main*surface_csflux for emission on main streets,
!-- emiss_factor_side*surface_csflux for emission on side streets
    emissions_anthropogenic    = .T.,
    emiss_lod                  = 0,   ! "PARAMETERIZED"
    surface_csflux_name        = 'NO',   'NO2',  'PM10',
    surface_csflux             = 4745.0, 1326.0, 8100e-08,
    emiss_factor_main          = 1.667,  1.667,  1.667,
    emiss_factor_side          = 0.334,  0.334,  0.334,
!
!-- _id is for identifying main/side streets
    main_street_id = 11,
    side_street_id =  8,
    max_street_id  = 19,
!
!-- KPP solver steering.
    icntrl(3)                  = 1,
    icntrl(4)                  = 500,

    rcntrl(3)                  = 0.1,

 / ! end of chemistry_parameters namelist


!---------------------------------------------------------------------------------------
!-- BIOMETEOROLOGY MODEL PARAMETER NAMELIST
!   Documentation: https://palm.muk.uni-hannover.de/trac/wiki/doc/app/biometpar
!---------------------------------------------------------------------------------------
 &biometeorology_parameters
    thermal_comfort = .T.,

    ! clothing = 1, ! summer/spring clothing
    ! consider_obstructions = .T.,

 / ! end of biometeorology_parameters namelist


!---------------------------------------------------------------------------------------
!-- INDOOR MODEL PARAMETER NAMELIST
!   Documentation: https://palm.muk.uni-hannover.de/trac/wiki/doc/app/indoor_parameters
!---------------------------------------------------------------------------------------
 &indoor_parameters
    indoor_during_spinup = .F.,
    initial_indoor_temperature = 299.95,  ! value from DWD's indoor model: 21.9degC at rural area, 26.8degC for urban area
 /
