Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log the Courant number #424

Merged
merged 4 commits into from
Aug 24, 2023
Merged

Log the Courant number #424

merged 4 commits into from
Aug 24, 2023

Conversation

tommbendall
Copy link
Contributor

This introduces a system to log the Courant number, which will be done by default.

Main points:

  • a log_courant option is passed to the output configuration
  • the CourantNumber diagnostic is augmented so that it can be evaluated on an expression, and not just the field named "u" (this is used when the transporting velocity isn't exactly the wind field)
  • some plumbing has been added to the IO, so that the Courant number diagnostics are set up if needed. The diagnostics are used to evaluated the maximum value (which is logged)
  • the calls to log the Courant number are added to the time loop. The SemiImplicitQuasiNewton time stepper logs the Courant number every outer loop

@colinjcotter
Copy link
Contributor

The DG0 Courant number based on DG fluxes is a bit more useful for pinpointing exactly which cell things went bad in.

@tommbendall
Copy link
Contributor Author

The DG0 Courant number based on DG fluxes is a bit more useful for pinpointing exactly which cell things went bad in.

Oh interesting, thanks Colin! How would we go about calculating that?

@dham
Copy link
Member

dham commented Aug 24, 2023

The DG0 Courant number based on DG fluxes is a bit more useful for pinpointing exactly which cell things went bad in.

Oh interesting, thanks Colin! How would we go about calculating that?

Looks like your code is already set up to do it. You just set the output space to a DG0 FunctionSpace.

gusto/io.py Outdated
number of. Defaults to 'u'.
expression (:class:`ufl.Expr`, optional): expression of velocity
field to take Courant number of. Defaults to None, in which case

Copy link
Contributor

Choose a reason for hiding this comment

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

unfinished comment...

state_fields (:class:`StateFields`): the model's field container.
name (str, optional): the name of the field to log the Courant
number of. Defaults to 'u'.
message (str, optional): an extra message to be logged. Defaults to
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the option to add a message!

Copy link
Contributor

@jshipton jshipton left a comment

Choose a reason for hiding this comment

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

looks good, and very useful - thanks! Just needs that comment finishing off...

@jshipton jshipton merged commit 17cd83e into main Aug 24, 2023
4 checks passed
@colinjcotter
Copy link
Contributor

colinjcotter commented Aug 24, 2023 via email

@tommbendall tommbendall deleted the log_courant branch September 1, 2023 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants