Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jshipton committed Nov 14, 2024
1 parent 507fd49 commit 4bda2e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
19 changes: 13 additions & 6 deletions gusto/equations/shallow_water_equations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
linear_continuity_form
)
from gusto.equations.prognostic_equations import PrognosticEquationSet
from gusto.physics.shallow_water_microphysics import compute_saturation


__all__ = ["ShallowWaterEquations", "LinearShallowWaterEquations",
Expand Down Expand Up @@ -226,14 +225,14 @@ def __init__(self, domain, parameters, equivalent_buoyancy=False,
"""

if equivalent_buoyancy:
b_name = 'b'
self.field_names.append(b_name)
self.space_names[b_name] = 'L2'
else:
b_name = 'b_e'
for new_field in [b_name, 'q_t']:
self.field_names.append(new_field)
self.space_names[new_field] = 'L2'
else:
b_name = 'b'
self.field_names.append(b_name)
self.space_names[b_name] = 'L2'

super().__init__(domain, parameters,
fexpr=fexpr, bexpr=bexpr,
Expand All @@ -249,7 +248,7 @@ def __init__(self, domain, parameters, equivalent_buoyancy=False,

w = self.tests[0]
gamma = self.tests[2]
u, D, b = split(self.X)[0:2]
u, D, b = split(self.X)[0:3]
n = FacetNormal(domain.mesh)
topog = self.prescribed_fields('topography', domain.space('DG')).interpolate(bexpr) if bexpr else None
if equivalent_buoyancy:
Expand Down Expand Up @@ -571,3 +570,11 @@ def __init__(self, domain, parameters, fexpr=None,

# Use the underlying routine to do a first linearisation of the equations
self.linearise_equation_set()


def compute_saturation(q0, nu, H, g, D, b, B=None):
if B is None:
sat_expr = q0*H/(D) * exp(nu*(1-b/g))

Check failure on line 577 in gusto/equations/shallow_water_equations.py

View workflow job for this annotation

GitHub Actions / Run linter

F821

gusto/equations/shallow_water_equations.py:577:31: F821 undefined name 'exp'
else:
sat_expr = q0*H/(D+B) * exp(nu*(1-b/g))

Check failure on line 579 in gusto/equations/shallow_water_equations.py

View workflow job for this annotation

GitHub Actions / Run linter

F821

gusto/equations/shallow_water_equations.py:579:33: F821 undefined name 'exp'
return sat_expr
9 changes: 1 addition & 8 deletions gusto/physics/shallow_water_microphysics.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from types import FunctionType


__all__ = ["InstantRain", "SWSaturationAdjustment", "compute_saturation"]
__all__ = ["InstantRain", "SWSaturationAdjustment"]


class InstantRain(PhysicsParametrisation):
Expand Down Expand Up @@ -363,10 +363,3 @@ def evaluate(self, x_in, dt):
for interpolator in self.source_interpolators:
interpolator.interpolate()

Check failure on line 365 in gusto/physics/shallow_water_microphysics.py

View workflow job for this annotation

GitHub Actions / Run linter

W391

gusto/physics/shallow_water_microphysics.py:365:1: W391 blank line at end of file

def compute_saturation(q0, nu, H, g, D, b, B=None):
if B is None:
sat_expr = q0*H/(D) * exp(nu*(1-b/g))
else:
sat_expr = q0*H/(D+B) * exp(nu*(1-b/g))
return sat_expr

0 comments on commit 4bda2e7

Please sign in to comment.