Skip to content

Commit

Permalink
PR #456: from firedrakeproject/JDBetteridge/purge_fml
Browse files Browse the repository at this point in the history
Purge FML (and pick up FML from Firedrake instead)
  • Loading branch information
tommbendall authored Oct 30, 2023
2 parents 01cb56d + 98897fa commit 2f9b04a
Show file tree
Hide file tree
Showing 27 changed files with 84 additions and 1,819 deletions.
1 change: 0 additions & 1 deletion gusto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from gusto.diagnostics import * # noqa
from gusto.diffusion_methods import * # noqa
from gusto.equations import * # noqa
from gusto.fml import * # noqa
from gusto.forcing import * # noqa
from gusto.initialisation_tools import * # noqa
from gusto.io import * # noqa
Expand Down
45 changes: 26 additions & 19 deletions gusto/equations.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
"""Objects describing geophysical fluid equations to be solved in weak form."""

from abc import ABCMeta
from firedrake import (TestFunction, Function, sin, pi, inner, dx, div, cross,
FunctionSpace, MixedFunctionSpace, TestFunctions,
TrialFunction, FacetNormal, jump, avg, dS_v, dS,
DirichletBC, conditional, SpatialCoordinate,
split, Constant, action)
from firedrake import (
TestFunction, Function, sin, pi, inner, dx, div, cross,
FunctionSpace, MixedFunctionSpace, TestFunctions, TrialFunction,
FacetNormal, jump, avg, dS_v, dS, DirichletBC, conditional,
SpatialCoordinate, split, Constant, action
)
from firedrake.fml import (
Term, all_terms, keep, drop, Label, subject, name_label,
replace_subject, replace_trial_function
)
from gusto.fields import PrescribedFields
from gusto.fml import (Term, all_terms, keep, drop, Label, subject, name,
replace_subject, replace_trial_function)
from gusto.labels import (time_derivative, transport, prognostic, hydrostatic,
linearisation, pressure_gradient, coriolis)
from gusto.labels import (
time_derivative, transport, prognostic, hydrostatic, linearisation,
pressure_gradient, coriolis
)
from gusto.thermodynamics import exner_pressure
from gusto.common_forms import (advection_form, continuity_form,
vector_invariant_form, kinetic_energy_form,
advection_equation_circulation_form,
diffusion_form, linear_continuity_form,
linear_advection_form)
from gusto.common_forms import (
advection_form, continuity_form, vector_invariant_form,
kinetic_energy_form, advection_equation_circulation_form,
diffusion_form, linear_continuity_form, linear_advection_form
)
from gusto.active_tracers import ActiveTracer, Phases, TracerVariableType
from gusto.configuration import TransportEquationType
import ufl
Expand Down Expand Up @@ -972,7 +977,7 @@ def __init__(self, domain, parameters, Omega=None, sponge=None,
raise NotImplementedError('Only mixing ratio tracers are implemented')
theta_v = theta / (Constant(1.0) + tracer_mr_total)

pressure_gradient_form = name(subject(prognostic(
pressure_gradient_form = name_label(subject(prognostic(
cp*(-div(theta_v*w)*exner*dx
+ jump(theta_v*w, n)*avg(exner)*dS_v), 'u'), self.X), "pressure_gradient")

Expand Down Expand Up @@ -1039,7 +1044,7 @@ def __init__(self, domain, parameters, Omega=None, sponge=None,
mubar*sin((pi/2.)*(z-zc)/(H-zc))**2)
self.mu = self.prescribed_fields("sponge", W_DG).interpolate(muexpr)

residual += name(subject(prognostic(
residual += name_label(subject(prognostic(
self.mu*inner(w, domain.k)*inner(u, domain.k)*dx, 'u'), self.X), "sponge")

if diffusion_options is not None:
Expand Down Expand Up @@ -1144,7 +1149,7 @@ def __init__(self, domain, parameters, Omega=None, sponge=None,

k = self.domain.k
u = split(self.X)[0]
self.residual += name(
self.residual += name_label(
subject(
prognostic(
-inner(k, self.tests[0]) * inner(k, u) * dx, "u"),
Expand Down Expand Up @@ -1309,8 +1314,10 @@ def __init__(self, domain, parameters, Omega=None,
# The p features here so that the div(u) evaluated in the "forcing" step
# replaces the whole pressure field, rather than merely providing an
# increment to it.
divergence_form = name(subject(prognostic(phi*(p-div(u))*dx, 'p'), self.X),
"incompressibility")
divergence_form = name_label(
subject(prognostic(phi*(p-div(u))*dx, 'p'), self.X),
"incompressibility"
)

residual = (mass_form + adv_form + divergence_form
+ pressure_gradient_form + gravity_form)
Expand Down
2 changes: 0 additions & 2 deletions gusto/fml/__init__.py

This file was deleted.

Loading

0 comments on commit 2f9b04a

Please sign in to comment.