Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of Yen (1981) Specific Heat Capacity #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion cosipy/cpkernel/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': # 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)))
return cp

def get_layer_liquid_water_content(self):
""" Returns the liquid water content of the node.
Expand Down