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

Spectral Deferred Correction #497

Merged
merged 21 commits into from
Jul 24, 2024
Merged

Spectral Deferred Correction #497

merged 21 commits into from
Jul 24, 2024

Conversation

atb1995
Copy link
Collaborator

@atb1995 atb1995 commented Mar 27, 2024

Pull request to push SDC code to main. Code is in sdc.py and uses external dependency qmat to generate nodes, Q matrices, Qdelta matrices and final update weights. The code has one unified algorithm for Implicit, Explicit and IMEX SDC variants, with labelling of terms defined by the user. Both zero-to-node and node-to-node formulations available, defined when creating the time discretisation. These formulations are:

Node-to-node:
y_m^(k+1) = y_(m-1)^(k+1) + dtau_m*(F(y_(m)^(k+1)) - F(y_(m)^k)) + sum(j=1,M) s_mj*F(y_(m-1)^k)
where s_mj = q_mj - q_(m-1)j for entires q_ik in Q.

Zero-to-node:
y_m^(k+1) = y_n + sum(j=1,M) q'mj*(F(y_j^(k+1)) - F(y_j^k))+ sum(j=1,M) q_mj*F(y(m-1)^k)
for entires q_mj in Q and q'_mj in Q_delta.

The code is tested in integration-tests/model/test_sdc.py.

@atb1995
Copy link
Collaborator Author

atb1995 commented Jul 23, 2024

w1_D_ex_sdc_comp_pull_ref4_conv
w1_D_imex_sdc_comp_pull_ref4_conv
w1_D_im_sdc_comp_pull_ref4_conv

@atb1995 atb1995 marked this pull request as ready for review July 23, 2024 14:53
@atb1995 atb1995 requested a review from tommbendall July 23, 2024 14:53
@atb1995 atb1995 added the enhancement Involves adding a new capability label Jul 23, 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.

This looks great! It's well documented and clear. I have only one tiny comment about docstrings.

If you think we will never use SDC with limiters or wrappers, feel free to remove all of that code.

gusto/time_discretisation/sdc.py Outdated Show resolved Hide resolved
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.

This looks great, thanks Alex! Only a couple of tiny quibbles about comments...

integration-tests/model/test_sdc.py Show resolved Hide resolved
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.

Awesome - we're good to go!

@jshipton jshipton merged commit 3832773 into main Jul 24, 2024
4 checks passed
@atb1995 atb1995 deleted the SDC_to_push branch July 25, 2024 09:31
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.

4 participants