From 3585011c55c615146ce6c6debc064c72924c7b9f Mon Sep 17 00:00:00 2001 From: Marcus Gastaldello <116652649+MarcusGastaldello@users.noreply.github.com> Date: Thu, 25 Jan 2024 14:50:30 +0100 Subject: [PATCH 1/3] Update constants.py Added option for new Yen et al. (1981) specific heat capacity method --- constants.py | 1 + 1 file changed, 1 insertion(+) diff --git a/constants.py b/constants.py index 45340ec7..2e118946 100644 --- a/constants.py +++ b/constants.py @@ -17,6 +17,7 @@ roughness_method = 'Moelg12' # possibilities: 'Moelg12' saturation_water_vapour_method = 'Sonntag90' # possibilities: 'Sonntag90' thermal_conductivity_method = 'bulk' # possibilities: 'bulk', 'empirical' +specific_heat_capacity_method = 'bulk' # possibilities: 'bulk', 'Yen81' sfc_temperature_method = 'SLSQP' # possibilities: 'L-BFGS-B', 'SLSQP'(faster), 'Newton' (Secant, fastest)' # WRF_X_CSPY: for efficiency and consistency From ffd21b7cfacfabf3e6308c3a6b7c30706b30f774 Mon Sep 17 00:00:00 2001 From: Marcus Gastaldello <116652649+MarcusGastaldello@users.noreply.github.com> Date: Thu, 25 Jan 2024 15:22:12 +0100 Subject: [PATCH 2/3] Update node.py Yen (1981) specific heat method added. --- cosipy/cpkernel/node.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cosipy/cpkernel/node.py b/cosipy/cpkernel/node.py index 88a6abce..21059fa8 100644 --- a/cosipy/cpkernel/node.py +++ b/cosipy/cpkernel/node.py @@ -131,7 +131,15 @@ def get_layer_specific_heat(self): cp : float Specific heat [:math:`J~kg^{-1}~K^{-1}`] """ - return self.get_layer_ice_fraction()*spec_heat_ice + self.get_layer_air_porosity()*spec_heat_air + self.get_layer_liquid_water_content()*spec_heat_water + + methods_allowed = ['bulk','Yen81'] + if specific_heat_capacity_method == 'bulk': + cp = self.get_layer_ice_fraction() * spec_heat_ice + self.get_layer_air_porosity() * spec_heat_air + self.get_layer_liquid_water_content() * spec_heat_water + elif specific_heat_capacity_method == 'Yen81': + cp = 152.2 + 7.122 * self.get_layer_temperature() + else: + raise ValueError("Specific heat method = \"{:s}\" is not allowed, must be one of {:s}".format(specific_heat_capacity_method, ", ".join(methods_allowed))) + return cp def get_layer_liquid_water_content(self): """ Returns the liquid water content of the node. From 15bb7076ad5bc5d87e3c175b2baac6ba0e5f1c88 Mon Sep 17 00:00:00 2001 From: Marcus Gastaldello <116652649+MarcusGastaldello@users.noreply.github.com> Date: Thu, 25 Jan 2024 15:24:28 +0100 Subject: [PATCH 3/3] Update node.py --- cosipy/cpkernel/node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cosipy/cpkernel/node.py b/cosipy/cpkernel/node.py index 21059fa8..3bf8576c 100644 --- a/cosipy/cpkernel/node.py +++ b/cosipy/cpkernel/node.py @@ -135,7 +135,7 @@ def get_layer_specific_heat(self): methods_allowed = ['bulk','Yen81'] if specific_heat_capacity_method == 'bulk': cp = self.get_layer_ice_fraction() * spec_heat_ice + self.get_layer_air_porosity() * spec_heat_air + self.get_layer_liquid_water_content() * spec_heat_water - elif specific_heat_capacity_method == 'Yen81': + elif specific_heat_capacity_method == 'Yen81': # empirical parameterisation according to Yen, 1981 cp = 152.2 + 7.122 * self.get_layer_temperature() else: raise ValueError("Specific heat method = \"{:s}\" is not allowed, must be one of {:s}".format(specific_heat_capacity_method, ", ".join(methods_allowed)))