Skip to content

Commit

Permalink
I think this works with the new definition of the transport forms
Browse files Browse the repository at this point in the history
  • Loading branch information
jshipton committed Aug 25, 2023
1 parent 389bde7 commit dc238c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/shallow_water/mm_ot_sw_galewsky_jet.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Omega = parameters.Omega
x = SpatialCoordinate(domain.mesh)
fexpr = 2*Omega*x[2]/R
eqns = ShallowWaterEquations(domain, parameters, fexpr=fexpr, u_transport_option="circulation_form")
eqns = ShallowWaterEquations(domain, parameters, fexpr=fexpr, u_transport_option="vector_invariant_form")

# I/O
perturb = True
Expand Down
8 changes: 4 additions & 4 deletions gusto/equations.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,23 +674,23 @@ def __init__(self, domain, parameters, fexpr=None, bexpr=None,
# Mesh movement requires the circulation form, and an
# additional modification
if domain.move_mesh:
assert u_transport_option == "circulation_form"
assert u_transport_option == "vector_invariant_form"

# Velocity transport term -- depends on formulation
if u_transport_option == "vector_invariant_form":
u_adv = prognostic(vector_invariant_form(domain, w, u, u), 'u')
elif u_transport_option == "vector_advection_form":
u_adv = prognostic(advection_form(w, u, u), 'u')
elif u_transport_option == "circulation_form":
ke_form = prognostic(kinetic_energy_form(w, u, u), "u")
if domain.move_mesh:
ke_form = transport.remove(ke_form)

Check failure on line 685 in gusto/equations.py

View workflow job for this annotation

GitHub Actions / Run linter

F821

gusto/equations.py:685:44: F821 undefined name 'ke_form'
ke_form = ke_form.label_map(
lambda t: t.has_label(transporting_velocity),
lambda t: Term(ufl.replace(
t.form, {t.get(transporting_velocity): u}), t.labels))
ke_form = transporting_velocity.remove(ke_form)
ke_form *= -1
u_adv -= ke_form
elif u_transport_option == "circulation_form":
ke_form = prognostic(kinetic_energy_form(w, u, u), "u")
u_adv = prognostic(advection_equation_circulation_form(domain, w, u, u), "u") + ke_form
else:
raise ValueError("Invalid u_transport_option: %s" % u_transport_option)
Expand Down

0 comments on commit dc238c8

Please sign in to comment.