diff --git a/src/phyex1d/grids/comble.grid b/src/phyex1d/grids/comble.grid new file mode 100644 index 0000000..c725465 --- /dev/null +++ b/src/phyex1d/grids/comble.grid @@ -0,0 +1,153 @@ +{ + "kind": "hybridH", + "position": "FLUX", + "mean": "linear", + "description": [ + [ + 0.0, + 10.391141011069521, + 24.458757277512234, + 42.15492987190203, + 63.428025073869776, + 88.16001460568532, + 116.27858912298393, + 147.71131294252262, + 182.38563442620148, + 220.2288966079043, + 261.1683368405752, + 305.13110597274533, + 352.0442701407727, + 401.8352871196147, + 454.4315858503136, + 509.7601880605773, + 567.958337447899, + 629.1477519991867, + 693.4339908285651, + 760.9182814030046, + 831.6991970526888, + 905.841169760675, + 983.3934711298114, + 1064.3901758789095, + 1148.8501577096074, + 1236.777093218866, + 1328.1594107282417, + 1422.942072966502, + 1521.072770226975, + 1622.7467427925042, + 1728.1355759289838, + 1837.3872347489637, + 1950.62597117303, + 2067.952445749856, + 2189.44367240564, + 2315.153059684272, + 2445.1104422671233, + 2579.351789639229, + 2718.1722346160386, + 2861.5636961684704, + 3009.495178984821, + 3161.9125385499415, + 3318.731453861872, + 3479.8933201645646, + 3645.3655109927286, + 3815.141761405079, + 3989.242410848239, + 4167.714814625743, + 4350.633711783893, + 4538.101612957139, + 4730.2492655943115, + 4927.23608590146, + 5129.250683157044, + 5336.5113752744, + 5549.266775108939, + 5766.442584786232, + 5988.466998173522, + 6215.780073008116, + 6448.8811877119115, + 6688.328016897507, + 6934.735151790085, + 7188.772854931783, + 7451.165582054694, + 7722.690440628749, + 8004.175547891458, + 8296.498113753587, + 8600.58245378073, + 8915.5661517821, + 9240.99746237728, + 9576.827821975754, + 9923.403650634671 + ], + [ + 1.0, + 0.9997031102568267, + 0.9993011783634996, + 0.9987955734322314, + 0.9981877707121752, + 0.9974811424398374, + 0.9966777545964861, + 0.9957796767730709, + 0.994788981873537, + 0.9937077458112027, + 0.9925380475188408, + 0.9912819684007788, + 0.9899415922816922, + 0.9885189917965825, + 0.9870162404042768, + 0.9854354231982692, + 0.9837726189300601, + 0.9820243499428803, + 0.9801876002620411, + 0.9782594776741999, + 0.9762371657984946, + 0.9741188237211237, + 0.9719030436820053, + 0.9695888521177455, + 0.9671757097797254, + 0.9646635116223181, + 0.9620525882649074, + 0.9593445122009572, + 0.9565407779935151, + 0.9536358073487855, + 0.9506246978306003, + 0.9475032218643152, + 0.9442678293950563, + 0.940915644407147, + 0.9374444665026959, + 0.9338527697233066, + 0.9301397016495108, + 0.9263042345817363, + 0.9223379361538274, + 0.9182410372523294, + 0.9140144234575766, + 0.9096596417557159, + 0.9051791013182322, + 0.9005744765667267, + 0.8958466996859221, + 0.8909959496741405, + 0.886021645404336, + 0.880922433867836, + 0.8756961796633174, + 0.8703399539155103, + 0.8648500209830197, + 0.8592218261171012, + 0.8534499804812273, + 0.8475282464207314, + 0.8414495207111732, + 0.8352444975775362, + 0.828900942909328, + 0.8224062836283396, + 0.8157462517796596, + 0.8089049138029284, + 0.8018647099488547, + 0.7946064898590919, + 0.7871095547984372, + 0.7793517016963214, + 0.7713092700602441, + 0.7629571967498975, + 0.754269072749122, + 0.7452695385205115, + 0.7359715010749349, + 0.7263763479435499, + 0.716474181410438 + ] + ] +} diff --git a/src/phyex1d/grids/isdac.grid b/src/phyex1d/grids/isdac.grid new file mode 100644 index 0000000..92aac09 --- /dev/null +++ b/src/phyex1d/grids/isdac.grid @@ -0,0 +1,115 @@ +{ + "kind": "hybridH", + "position": "FLUX", + "mean": "linear", + "description": [ + [ + 0.0, + 10.391141011069521, + 24.458757277512234, + 42.15492987190203, + 63.428025073869776, + 88.16001460568532, + 116.27858912298393, + 147.71131294252262, + 182.38563442620148, + 220.2288966079043, + 261.1683368405752, + 305.13110597274533, + 352.0442701407727, + 401.8352871196147, + 454.4315858503136, + 509.7601880605773, + 567.958337447899, + 629.1477519991867, + 693.4339908285651, + 760.9182814030046, + 831.6991970526888, + 905.841169760675, + 983.3934711298114, + 1064.3901758789095, + 1148.8501577096074, + 1236.777093218866, + 1328.1594107282417, + 1422.942072966502, + 1521.072770226975, + 1622.7467427925042, + 1728.1355759289838, + 1837.3872347489637, + 1950.62597117303, + 2067.952445749856, + 2189.44367240564, + 2315.153059684272, + 2445.1104422671233, + 2579.351789639229, + 2718.1722346160386, + 2861.5636961684704, + 3009.495178984821, + 3161.9125385499415, + 3318.731453861872, + 3479.8933201645646, + 3645.3655109927286, + 3815.141761405079, + 3989.242410848239, + 4167.714814625743, + 4350.633711783893, + 4538.101612957139, + 4730.2492655943115, + 4927.23608590146 + ], + [ + 1.0, + 0.9997031102568267, + 0.9993011783634996, + 0.9987955734322314, + 0.9981877707121752, + 0.9974811424398374, + 0.9966777545964861, + 0.9957796767730709, + 0.994788981873537, + 0.9937077458112027, + 0.9925380475188408, + 0.9912819684007788, + 0.9899415922816922, + 0.9885189917965825, + 0.9870162404042768, + 0.9854354231982692, + 0.9837726189300601, + 0.9820243499428803, + 0.9801876002620411, + 0.9782594776741999, + 0.9762371657984946, + 0.9741188237211237, + 0.9719030436820053, + 0.9695888521177455, + 0.9671757097797254, + 0.9646635116223181, + 0.9620525882649074, + 0.9593445122009572, + 0.9565407779935151, + 0.9536358073487855, + 0.9506246978306003, + 0.9475032218643152, + 0.9442678293950563, + 0.940915644407147, + 0.9374444665026959, + 0.9338527697233066, + 0.9301397016495108, + 0.9263042345817363, + 0.9223379361538274, + 0.9182410372523294, + 0.9140144234575766, + 0.9096596417557159, + 0.9051791013182322, + 0.9005744765667267, + 0.8958466996859221, + 0.8909959496741405, + 0.886021645404336, + 0.880922433867836, + 0.8756961796633174, + 0.8703399539155103, + 0.8648500209830197, + 0.8592218261171012 + ] + ] +} diff --git a/src/phyex1d/namelists/comble.namel b/src/phyex1d/namelists/comble.namel new file mode 100644 index 0000000..9a43da8 --- /dev/null +++ b/src/phyex1d/namelists/comble.namel @@ -0,0 +1,54 @@ +&PHYEX + SURFACE='WASP' +/ +&NAM_NEBn + LSUBG_COND=.TRUE., +/ +&NAM_TURBn + XTKEMIN=1.E-6, + XLINI=0., +/ +&NAM_PARAM_ICEN + CSUBG_AUCV_RC='PDF' +/ +&radiation +! +! GENERAL +! +iverbose = 1, +iverbosesetup = 1, +directory_name = "data", ! Location of configuration files +do_surface_sw_spectral_flux = false, ! Save surface fluxes in each band? +! +! CLOUDS +! +use_general_cloud_optics = false, +ice_model_name = "Fu-IFS", ! Can be "Fu-IFS" or "Yi" +sw_solver_name = "Tripleclouds", ! "Tripleclouds", "McICA" or "SPARTACUS" +lw_solver_name = "Tripleclouds", ! "Tripleclouds", "McICA" or "SPARTACUS" +overlap_scheme_name = "Exp-Ran", ! McICA also accepts Max-Ran or Exp-Exp +do_lw_cloud_scattering = true, ! Clouds scatter in the longwave? +gas_model_name = "RRTMG-IFS", ! "RRTMG-IFS" or "ECCKD" +! +! AEROSOLS +! +use_aerosols = false, ! Radiation sees aerosols? +use_general_aerosol_optics=false, +do_lw_aerosol_scattering = false, ! Aerosols scatter in the longwave? +! +! 11 IFS aerosol mixing ratios are stored in the ecRad input file: 1-3 +! Sea salt, 4-6 mineral dust, 7 hydrophilic organics, 8 hydrophobic +! organics, 9 hydrophilic black carbon, 10 hydrophobic black carbon, 11 +! ammonium sulfate +n_aerosol_types = 11, ! Number of aerosol types in input file +! +! The aerosol optical properties are in this file: +aerosol_optics_override_file_name = 'aerosol_ifs_rrtm_46R1_with_NI_AM.nc' +! +! For each of the 11 mixing ratios in the input file, we need to map to +! one of the optical properties, where negative numbers index +! hydrophilic aerosol types and positive numbers index hydrophobic +! aerosol types, e.g. 11=black carbon, -5=sulphate. +i_aerosol_type_map = -1, -2, -3, 1, 2, 3, -4, 10, 11, 11, -5, +/ + diff --git a/src/phyex1d/namelists/isdac.namel b/src/phyex1d/namelists/isdac.namel new file mode 100644 index 0000000..0dceeb6 --- /dev/null +++ b/src/phyex1d/namelists/isdac.namel @@ -0,0 +1,58 @@ +&PHYEX + SURFACE='NONE', + RAD='ECRAD', + CSCONV='EDKF', + CMICRO='ICE3', + CTURB='TKEL' +/ +&NAM_NEBn + LSUBG_COND=.FALSE., +/ +&NAM_TURBn + XTKEMIN=1.E-6, + XLINI=0., +/ +&NAM_PARAM_ICEN + CSUBG_AUCV_RC='PDF' +/ +&radiation +! +! GENERAL +! +iverbose = 1, +iverbosesetup = 1, +directory_name = "data", ! Location of configuration files +do_surface_sw_spectral_flux = false, ! Save surface fluxes in each band? +! +! CLOUDS +! +use_general_cloud_optics = false, +ice_model_name = "Fu-IFS", ! Can be "Fu-IFS" or "Yi" +sw_solver_name = "Tripleclouds", ! "Tripleclouds", "McICA" or "SPARTACUS" +lw_solver_name = "Tripleclouds", ! "Tripleclouds", "McICA" or "SPARTACUS" +overlap_scheme_name = "Exp-Ran", ! McICA also accepts Max-Ran or Exp-Exp +do_lw_cloud_scattering = true, ! Clouds scatter in the longwave? +gas_model_name = "RRTMG-IFS", ! "RRTMG-IFS" or "ECCKD" +! +! AEROSOLS +! +use_aerosols = false, ! Radiation sees aerosols? +use_general_aerosol_optics=false, +do_lw_aerosol_scattering = false, ! Aerosols scatter in the longwave? +! +! 11 IFS aerosol mixing ratios are stored in the ecRad input file: 1-3 +! Sea salt, 4-6 mineral dust, 7 hydrophilic organics, 8 hydrophobic +! organics, 9 hydrophilic black carbon, 10 hydrophobic black carbon, 11 +! ammonium sulfate +n_aerosol_types = 11, ! Number of aerosol types in input file +! +! The aerosol optical properties are in this file: +aerosol_optics_override_file_name = 'aerosol_ifs_rrtm_46R1_with_NI_AM.nc' +! +! For each of the 11 mixing ratios in the input file, we need to map to +! one of the optical properties, where negative numbers index +! hydrophilic aerosol types and positive numbers index hydrophobic +! aerosol types, e.g. 11=black carbon, -5=sulphate. +i_aerosol_type_map = -1, -2, -3, 1, 2, 3, -4, 10, 11, 11, -5, +/ + diff --git a/src/phyex1d/physics.py b/src/phyex1d/physics.py index ab983ab..4f0586f 100644 --- a/src/phyex1d/physics.py +++ b/src/phyex1d/physics.py @@ -154,6 +154,11 @@ def set_default(nml): LDCHECK=False, KPRINT=1, LDINIT=False) self.full_phyex_namel = f90nml.read(f'fort.{numnml}') set_default(self.full_phyex_namel) + self.full_phyex_namel['PHYEX']['CMICRO'] = nml['PHYEX']['CMICRO'] + self.full_phyex_namel['PHYEX']['CSCONV'] = nml['PHYEX']['CSCONV'] + self.full_phyex_namel['PHYEX']['CTURB'] = nml['PHYEX']['CTURB'] + self.full_phyex_namel['PHYEX']['RAD'] = nml['PHYEX']['RAD'] + self.full_phyex_namel['PHYEX']['SURFACE'] = nml['PHYEX']['SURFACE'] os.remove(f'fort.{numnml}') if nml['PHYEX']['RAD'] == 'ECRAD' and self.case.radiation == 'on': @@ -306,6 +311,13 @@ def build_init_state(self, init_state): else: logging.warning('%s not found in the netCDF driver!', nc_names[var]) + for var in ('Ts', 'Tskin'): + if var not in init_state: + if 'tskin' in nc.variables: + init_state[var] = nc['tskin'][0] + elif 'ts_forc' in nc.variables: + init_state[var] = nc['ts_forc'][0] + # We perform the interpolation on the natural vertical coordinate if self.grid.kind in ('H', 'hybridH'): input_coord = nc['zh'][0, :] + nc['orog'][0] @@ -327,8 +339,9 @@ def build_init_state(self, init_state): interp = RegularGridInterpolator((input_coord, ), nc[nc_names[var]][0, :], bounds_error=False, fill_value=None) init_state[var] = interp(output_coord) - init_state['tke'] = numpy.maximum(self.full_phyex_namel['NAM_TURBn']['XTKEMIN'], - init_state['tke']) + if self.full_phyex_namel['PHYEX']['CTURB'] == 'TKEL': + init_state['tke'] = numpy.maximum(self.full_phyex_namel['NAM_TURBn']['XTKEMIN'], + init_state['tke']) # Vertical coordinates self.add_vertical_coordinate(init_state) @@ -478,10 +491,16 @@ def get_interpolator(var, nc): # Surface if 'Ts' in state: - interp, nc = get_interpolator('ts_forc', nc) + if 'tskin' in nc.variables: + interp, nc = get_interpolator('tskin', nc) + elif 'ts_forc' in nc.variables: + interp, nc = get_interpolator('ts_forc', nc) state['Ts'] = interp([time])[0] if 'Tskin' in state: - interp, nc = get_interpolator('tskin', nc) + if 'tskin' in nc.variables: + interp, nc = get_interpolator('tskin', nc) + elif 'ts_forc' in nc.variables: + interp, nc = get_interpolator('ts_forc', nc) state['Tskin'] = interp([time])[0] if 'Ps' in state: interp, nc = get_interpolator('ps_forc', nc) @@ -532,7 +551,8 @@ def phyex(self, state, timestep, timestep_number): # Save initial state and control state0 = {k: v.copy() for (k, v) in state.items()} - state['tke'] = numpy.maximum(self.full_phyex_namel['NAM_TURBn']['XTKEMIN'], + if self.full_phyex_namel['PHYEX']['CTURB'] == 'TKEL': + state['tke'] = numpy.maximum(self.full_phyex_namel['NAM_TURBn']['XTKEMIN'], state['tke']) # Preparation: grid and other dimensions @@ -826,6 +846,7 @@ def phyex(self, state, timestep, timestep_number): # SURFACE ################################################################## ################################################################## + self.case.surface_forcing_wind='none' klevgrd = 0 if self.grid.ascending else -1 if self.case.surface_forcing_temp in ('none', 'ts') or \ self.case.surface_forcing_moisture in ('none', 'beta', 'mrsos') or \ @@ -864,10 +885,10 @@ def ustar2fluxes(ustar, u, v): sfu_scheme = None sfv_scheme = None if self.full_phyex_namel['PHYEX']['SURFACE'] == 'NONE': - sshf_scheme = 0. - swf_scheme = 0. - sfu_scheme = 0. - sfv_scheme = 0. + sshf_scheme = numpy.float64(0.) + swf_scheme = numpy.float64(0.) + sfu_scheme = numpy.float64(0.) + sfv_scheme = numpy.float64(0.) elif not need_scheme: pass elif self.full_phyex_namel['PHYEX']['SURFACE'] == 'WASP':