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

Increment form for implicit RK added and tested #566

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

atb1995
Copy link
Collaborator

@atb1995 atb1995 commented Oct 24, 2024

Non-increment form for Implicit RK does not yet exist. This is likely required for running implicit RK with compressible Euler equations, so this capability has been added (as in explicit rk)

@atb1995 atb1995 self-assigned this Oct 24, 2024
@atb1995 atb1995 linked an issue Oct 24, 2024 that may be closed by this pull request
@tommbendall tommbendall added the enhancement Pull requests or issues relating to adding a new capability label Oct 27, 2024
Copy link
Contributor

@tommbendall tommbendall left a comment

Choose a reason for hiding this comment

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

A few suggested changes, but otherwise the tests convince me that the formulae are probably correct

@@ -56,6 +57,7 @@ class ImplicitRungeKutta(TimeDiscretisation):
# ---------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth us making the predictor and increment forms clear in the docstrings?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've made it a bit more clear, describing what we are solving for

else:
raise NotImplementedError(
'Runge-Kutta formulation is not implemented'
)

def lhs(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know we don't set up the lhs and rhs variables? If these are inherited from the base TimeDiscretisation class, are they wrong? They don't appear to be used anywhere either. I wonder if we should either:

  • use them
  • set their values to be None
  • remove them and stop them being an @abstractproperty

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have removed lhs & rhs and stopped them being an abstract property

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Instead they are now just a property

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for making this change. @jshipton are you happy with this?

gusto/time_discretisation/implicit_runge_kutta.py Outdated Show resolved Hide resolved
map_if_false=replace_subject(self.xnph, self.idx),
)
def res(self, stage):
"""Set up the discretisation's residual for a given stage."""
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make clear that this is only for the predictor formulation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@property
def final_res(self):
"""Set up the discretisation's final residual."""
# Add time derivative terms y^{n+1} - y^n
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make clear that this is only for the predictor formulation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@tommbendall tommbendall left a comment

Choose a reason for hiding this comment

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

Two minor suggestions from me. I'm happy but think it would also be helpful for @jshipton have a look

gusto/time_discretisation/implicit_runge_kutta.py Outdated Show resolved Hide resolved

@cached_property
def final_solver(self):
"""Set up a solver for the final solve for the predictor formulation to evaluate time level n+1."""
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you split this comment over multiple lines?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Pull requests or issues relating to adding a new capability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-increment form for implicit runge-kutta
2 participants