Skip to content

Free surface equation

free_surface_equation

This module contains the free surface terms.

All terms implement the UFL residual as it would be on the RHS of the equation:

dq/dt = \sum term

This sign-convention is for compatibility with Thetis's time integrators. In general, however, we like to think about the terms as they are on the LHS. Therefore, in the function below, we assemble in F as it would be on the LHS:

dq/dt + F(q) = 0

and at the very end return -F.

free_surface_term(eq, trial)

Free Surface term: u \dot n

Source code in g-adopt/gadopt/free_surface_equation.py
22
23
24
25
26
27
28
def free_surface_term(
    eq: Equation, trial: fd.Argument | fd.ufl.indexed.Indexed | fd.Function
) -> fd.Form:
    r"""Free Surface term: u \dot n"""
    F = -eq.buoyancy_scale * eq.test * fd.dot(eq.u, eq.n) * eq.ds(eq.boundary_id)

    return -F

mass_term(eq, trial)

Mass term \int test * trial * ds for the free surface time discretisation.

Parameters:

Name Type Description Default
eq Equation

G-ADOPT Equation.

required
trial Argument | Indexed | Function

Firedrake trial function.

required

Returns:

Type Description
Form

The UFL form associated with the mass term of the equation.

Source code in g-adopt/gadopt/free_surface_equation.py
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def mass_term(
    eq: Equation, trial: fd.Argument | fd.ufl.indexed.Indexed | fd.Function
) -> fd.Form:
    r"""Mass term \int test * trial * ds for the free surface time discretisation.

    Args:
        eq:
          G-ADOPT Equation.
        trial:
          Firedrake trial function.

    Returns:
        The UFL form associated with the mass term of the equation.

    """
    return (
        eq.buoyancy_scale
        * fd.dot(eq.test, trial)
        * vertical_component(eq.n)
        * eq.ds(eq.boundary_id)
    )