Skip to content

Commit

Permalink
Remove remove_initial_w (#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
tommbendall authored Nov 22, 2024
1 parent 6268004 commit e138b5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
5 changes: 2 additions & 3 deletions examples/compressible_euler/mountain_hydrostatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
TrapeziumRule, SUPGOptions, ZComponent, Perturbation,
CompressibleParameters, HydrostaticCompressibleEulerEquations,
CompressibleSolver, compressible_hydrostatic_balance, HydrostaticImbalance,
SpongeLayerParameters, MinKernel, MaxKernel, remove_initial_w, logger
SpongeLayerParameters, MinKernel, MaxKernel, logger
)

mountain_hydrostatic_defaults = {
Expand Down Expand Up @@ -243,8 +243,7 @@ def mountain_hydrostatic(

theta0.assign(theta_b)
rho0.assign(rho_b)
u0.project(as_vector([initial_wind, 0.0]))
remove_initial_w(u0)
u0.project(as_vector([initial_wind, 0.0]), bcs=eqns.bcs['u'])

stepper.set_reference_profiles([('rho', rho_b), ('theta', theta_b)])

Expand Down
24 changes: 4 additions & 20 deletions gusto/initialisation/hydrostatic_initialisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
from gusto.recovery import Recoverer, BoundaryMethod


__all__ = ["boussinesq_hydrostatic_balance",
"compressible_hydrostatic_balance", "remove_initial_w",
"saturated_hydrostatic_balance", "unsaturated_hydrostatic_balance"]
__all__ = [
"boussinesq_hydrostatic_balance", "compressible_hydrostatic_balance",
"saturated_hydrostatic_balance", "unsaturated_hydrostatic_balance"
]


def boussinesq_hydrostatic_balance(equation, b0, p0, top=False, params=None):
Expand Down Expand Up @@ -219,23 +220,6 @@ def compressible_hydrostatic_balance(equation, theta0, rho0, exner0=None,
rho0.interpolate(thermodynamics.rho(parameters, theta0, exner))


def remove_initial_w(u):
"""
Removes the vertical component of a velocity field.
Args:
u (:class:`Function`): the velocity field to be altered.
"""
Vu = u.function_space()
Vv = FunctionSpace(Vu._ufl_domain, Vu.ufl_element()._elements[-1])
bc = DirichletBC(Vu[0], 0.0, "bottom")
bc.apply(u)
uv = Function(Vv).project(u)
ustar = Function(u.function_space()).project(uv)
uin = Function(u.function_space()).assign(u - ustar)
u.assign(uin)


def saturated_hydrostatic_balance(equation, state_fields, theta_e, mr_t,
exner0=None, top=False,
exner_boundary=Constant(1.0),
Expand Down

0 comments on commit e138b5e

Please sign in to comment.