gusto.initialisation package

Submodules

gusto.initialisation.hydrostatic_initialisation module

Tools for computing hydrostatically balanced initial conditions.

gusto.initialisation.hydrostatic_initialisation.boussinesq_hydrostatic_balance(equation, b0, p0, top=False, params=None)[source]

Gives a pressure field in hydrostatic-balance for the Boussinesq eqns.

Generates the hydrostatically-balanced pressure field for the Boussinesq equations, given some buoyancy field and a boundary condition. This is solved as a mixed problem for the vertical velocity and the pressure with zero flow enforced at one of the boundaries.

Parameters:
  • equation (PrognosticEquation) – the model’s equation object.

  • b0 (ufl.Expr) – the input buoyancy field.

  • p0 (Function) – the pressure to be returned.

  • top (bool, optional) – whether the no-flow boundary condition is enforced on the top boundary or the bottom. True denotes the top. Defaults to False.

  • params (dict, optional) – dictionary of parameters to be passed to the solver. Defaults to None.

gusto.initialisation.hydrostatic_initialisation.compressible_hydrostatic_balance(equation, theta0, rho0, exner0=None, top=False, exner_boundary=Constant([1.], name='constant_0', count=0), mr_t=None, solve_for_rho=False, params=None)[source]

Computes hydrostatic balance for the compressible Euler equations.

Compute a hydrostatically balanced density or pressure given a potential temperature profile. This solves a mixed finite element problem for the pressure and the vertical velocity, with an option to subsequently solve for the density. By default, this uses a vertically-oriented hybridization procedure for solving the resulting discrete systems.

Parameters:
  • equation (PrognosticEquation) – the model’s equation object.

  • theta0 (ufl.Expr) – the input (dry) potential temperature field.

  • rho0 (Function) – the hydrostatically-balanced density to be found.

  • exner0 (Function, optional) – the hydrostatically-balanced Exner pressure field. If provided, then the Exner pressure computed as part of this routine will be stored in this function. Defaults to None.

  • top (bool, optional) – whether the pressure boundary condition is defined on the top boundary or the bottom. True denotes the top. Defaults to False.

  • exner_boundary (ufl.Expr, optional) – the Exner pressure field on the boundary defining the boundary condition. Defaults to Constant(1.0).

  • mr_t (ufl.Expr, optional) – the total water mixing ratio field. Defaults to None.

  • solve_for_rho (bool, optional) – whether to perform a final solve for the density field. If false, interpolate rho from the Exner pressure using the equation of state. Defaults to False.

  • params (dict, optional) – dictionary of parameters to be passed to the solver. Defaults to None.

gusto.initialisation.hydrostatic_initialisation.remove_initial_w(u)[source]

Removes the vertical component of a velocity field.

Parameters:

u (Function) – the velocity field to be altered.

gusto.initialisation.hydrostatic_initialisation.saturated_hydrostatic_balance(equation, state_fields, theta_e, mr_t, exner0=None, top=False, exner_boundary=Constant([1.], name='constant_1', count=1), max_outer_solve_count=40, max_theta_solve_count=5, max_inner_solve_count=3)[source]

Computes hydrostatic balance for a moist saturated, compressible atmosphere.

Given a wet equivalent potential temperature, theta_e, and the total moisture content, mr_t, compute a hydrostatically balanced virtual dry potential temperature, dry density and water vapour profile.

The general strategy is to split up the solving into two steps:

  1. finding rho to balance the theta profile

2) finding theta_vd and r_v to get back theta_e and saturation, using a fixed point iteration.

We iteratively solve these steps until we (hopefully) converge to a solution.

Parameters:
  • equation (PrognosticEquation) – the model’s equation object.

  • state_fields (StateFields) – the model’s field container.

  • theta_e (ufl.Expr) – expression for the desired wet equivalent potential temperature field.

  • mr_t (ufl.Expr) – expression for the total moisture content.

  • exner0 (Function, optional) – the hydrostatically-balanced Exner pressure field. If provided, then the Exner pressure computed as part of this routine will be stored in this function. Defaults to None.

  • top (bool, optional) – whether the pressure boundary condition is defined on the top boundary or the bottom. True denotes the top. Defaults to False.

  • exner_boundary (ufl.Expr, optional) – the Exner pressure field on the boundary defining the boundary condition. Defaults to Constant(1.0).

  • max_outer_solve_count (int, optional) – maximum number of outer solves to perform. Defaults to 40.

  • max_theta_solve_count (int, optional) – maximum number of solves for the theta_vd field, per outer loop. Defaults to 5.

  • max_inner_solve_count (int, optional) – maximum number of inner solves, for the moisture fields, per theta solve. Defaults to 3.

Raises:

RuntimeError – if the prognostic fields have not converged to give the specified profile to the desired tolerance, within the maximum number of iterations.

gusto.initialisation.hydrostatic_initialisation.unsaturated_hydrostatic_balance(equation, state_fields, theta_d, H, exner0=None, top=False, exner_boundary=Constant([1.], name='constant_2', count=2), max_outer_solve_count=40, max_inner_solve_count=20)[source]

Computes hydrostatic bal. for a moist unsaturated, compressible atmosphere.

Given vertical profiles for dry potential temperature and relative humidity, computes hydrostatically balanced virtual dry potential temperature, dry density and water vapour profiles.

The general strategy is to split up the solving into two steps:

  1. finding rho to balance the theta profile

2) finding theta_v and r_v to get back theta_d and H, using a fixed-point iteration.

These steps are iterated until we (hopefully) converge to a solution.

Parameters:
  • equation (PrognosticEquation) – the model’s equation object.

  • state_fields (StateFields) – the model’s field container.

  • theta_d (ufl.Expr) – the specified dry potential temperature field.

  • H (ufl.Expr) – the specified relative humidity field.

  • exner0 (Function, optional) – the hydrostatically-balanced Exner pressure field. If provided, then the Exner pressure computed as part of this routine will be stored in this function. Defaults to None.

  • top (bool, optional) – whether the pressure boundary condition is defined on the top boundary or the bottom. True denotes the top. Defaults to False.

  • exner_boundary (ufl.Expr, optional) – the Exner pressure field on the boundary defining the boundary condition. Defaults to Constant(1.0).

  • max_outer_solve_count (int, optional) – maximum number of outer solves to perform. Defaults to 40.

  • max_inner_solve_count (int, optional) – maximum number of inner solves, for the moisture fields, per outer solve. Defaults to 20.

Raises:

RuntimeError – if the prognostic fields have not converged to give the specified profile to the desired tolerance, within the maximum number of iterations.

gusto.initialisation.numerical_integrator module

class gusto.initialisation.numerical_integrator.NumericalIntegral(lower_bound, upper_bound, num_points=500)[source]

Bases: object

A class for numerically evaluating and tabulating some 1D integral. :param lower_bound: lower bound of integral :type lower_bound: float :param upper_bound: upper bound of integral :type upper_bound: float :param num_points: number of points to tabulate integral at :type num_points: float

evaluate_at(points)[source]

Evaluates the integral at some point using linear interpolation. :param points: evaluate the integral at. :type points: float or iter

Returns:

returns the numerical approximation of the integral from lower bound to point(s)

tabulate(expression)[source]

Tabulate some integral expression using Simpson’s rule. :param expression: a function representing the integrand to be

evaluated. should take a numpy array as an argument.

Module contents