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

Moist thermal sw #390

Closed
wants to merge 50 commits into from
Closed

Moist thermal sw #390

wants to merge 50 commits into from

Conversation

nhartney
Copy link
Contributor

@nhartney nhartney commented Jul 24, 2023

This PR adds the capability for the moist thermal shallow water equations. It:

  • Adds a new physics class, SWSaturationAdjustment, to do condensation and evaporation between two moist species in the shallow water equations. This class takes saturation_curve as an argument, and where the water vapour exceeds the saturation curve a specified fraction of the excess vapour is converted to cloud. Conversely, in a sub-saturated atmosphere where cloud is present, a specified fraction of the cloud will evaporate. If thermal_feedback is true then these processes affect the buoyancy equation - evaporation should cause an increase in buoyancy and condensation a decrease.
  • Includes an integration test for SWSaturationAdjustment which tests both the evaporation and condensation ability by running two different scenarios.
  • Adds a moist_thermal_williamson5 example to the shallow_water directory. This is based on test 2 in Zerroukat and Allen (2015), which is a version of test 5 from Williamson et al (flow over a mountain) with additional thermodynamic variables.
  • Renames the gamma parameter in InstantRain to beta1 to make clearer the distinction between convective feedback (beta1) and thermal feedback (beta2). Adds a gamma_r parameter to InstantRain to allow the conversion of a specified fraction of vapour above the saturation threshold to rain.
  • Corrects a mistake in the specification of the initial conditions for the thermal Williamson 2 example.

…lePhysics class so that it works with a time-varying saturation curve. Also adding the option for convective feedback to the ReversiblePhysics class.
… fraction of the moist species is converted. Take absolute value in theta initial condition.
…step oscillations) with a fraction that can be time-varying
Copy link
Contributor

@tommbendall tommbendall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this! Very exciting to have this on main.

In terms of which examples to have, I think it would be lovely to have just a moist_thermal_williamson_5.py to ensure that we have the moist-thermal combination tested somewhere

Copy link
Contributor

@tommbendall tommbendall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks really good, thanks so much for adding this!

gusto/physics.py Outdated
dependent on a prognostic field.
time_varying_saturation (bool, optional): set this to True if the
saturation curve is changing in time. Defaults to False.
L (float, optional): The air expansion factor multiplied by the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call this L_v instead of L?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that makes more sense.

L (float, optional): The air expansion factor multiplied by the
latent heat due to phase change divided by the specific heat
capacity. For the atmosphere we take L to be 10, following A.2
in Zerroukat and Allen (2015). Defaults to None but must be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to check, should this be (2015) or (2020) as the comment above is their paper from (2020)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be 2015 - thanks!

Defaults to None, in which case the timestep dt is used.
parameters (:class:`Configuration`, optional): parameters containing
the values of constants. Defaults to None, in which case the
parameters are obtained from the equation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very nicely commented, thanks!

water_t_T = total[-1]

assert abs(water_t_0 - water_t_T) / water_t_0 < 1e-12, \
f'Total amount of water should be conserved by {process}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test looks really good! My only question is if we should called it test_sw_saturation_adjustment.py instead? (And also rename test_condensation.py as test_saturation_adjustment.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that's a better name. I've changed the name of both tests.

Copy link
Contributor

@tommbendall tommbendall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant, thanks Nell!

@nhartney nhartney closed this Jul 28, 2023
@tommbendall tommbendall mentioned this pull request Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants