Skip to content

routine to generate balanced initial fields for SWE - #759

Open
jshipton wants to merge 2 commits into
mainfrom
balanced_sw_init
Open

routine to generate balanced initial fields for SWE#759
jshipton wants to merge 2 commits into
mainfrom
balanced_sw_init

Conversation

@jshipton

@jshipton jshipton commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Routine to initialise shallow water flows from a given vorticity field such that the initial flow is non divergent and has div(u_t)=0. The steps are:

  1. Compute the streamfunction from the vorticity.
  2. Compute the velocity from the streamfunction.
  3. Solve a mixed Poisson equation for (v, depth) where v=u_t and the right hand side comes from the vector invariant form of the velocity equation and setting div(v)=0.
  4. Adjust the depth to have the correct mean.

def nondivergent_flow(equation, zeta0, u0, D0):
"""
Returns u0 and D0, balanced velocity and depth fields, given a
vorticity field zeta0. Balance is defined as

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a missing comment here!

_, D = w.subfunctions
D0.assign(D)

# adjust depth to have initial mean of H as set in the parameters

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any situations where we might want to set this differently? e.g. the min/max, or specifying some mean that isn't H? If so we could specify that through the argument list


Args:
equation (:class:`PrognosticEquation`): the model's equation object.
zeta0 (:class:`ufl.Expr`): the input vorticity field.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it always the relative vorticity? Could that be mentioned in the comment?

@tommbendall tommbendall added the enhancement Involves adding a new capability label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Involves adding a new capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants