Skip to content

Diagnostics

diagnostics

This module provides a class to simplify computing of diagnostics typically encountered in geodynamical simulations. Users instantiate the class by providing relevant parameters and call individual class methods to compute associated diagnostics.

GeodynamicalDiagnostics(z, T, bottom_id, top_id, quad_degree=4)

Typical simulation diagnostics used in geodynamical simulations.

Parameters:

Name Type Description Default
z Function

Firedrake function for mixed Stokes function space (velocity, pressure)

required
T Function

Firedrake function for temperature

required
bottom_id int

Bottom boundary identifier

required
top_id int

Top boundary identifier

required
quad_degree int

Degree of polynomial quadrature approximation

4
Note

All diagnostics are returned as floats.

Methods:

Name Description
u_rms

Root-mean squared velocity

u_rms_top

Root-mean squared velocity along the top boundary

Nu_top

Nusselt number at the top boundary

Nu_bottom

Nusselt number at the bottom boundary

T_avg

Average temperature in the domain

T_min

Minimum temperature in domain

T_max

Maximum temperature in domain

ux_max

Maximum velocity (optionally over a given boundary)

Source code in g-adopt/gadopt/diagnostics.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
def __init__(
    self,
    z: Function,
    T: Function,
    bottom_id: int,
    top_id: int,
    quad_degree: int = 4,
):
    mesh = extract_unique_domain(z)

    self.u, self.p, *_ = z.subfunctions
    self.T = T

    self.dx = dx(domain=mesh, degree=quad_degree)
    self.ds = (
        CombinedSurfaceMeasure(mesh, quad_degree)
        if T.function_space().extruded
        else ds(mesh)
    )
    self.ds_t = self.ds(top_id)
    self.ds_b = self.ds(bottom_id)

    self.n = FacetNormal(mesh)

    self.domain_volume = assemble(Constant(1) * self.dx)
    self.top_surface = assemble(Constant(1) * self.ds_t)
    self.bottom_surface = assemble(Constant(1) * self.ds_b)