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

Add a vector wave equation example #1091

Merged
merged 25 commits into from
Jun 16, 2024
Merged

Conversation

lroberts36
Copy link
Collaborator

@lroberts36 lroberts36 commented May 23, 2024

PR Summary

This PR adds a vector wave equation to the fine_field example. That is, we solve the equations

$$\partial_t \vec{C} + \nabla \times \vec{D} = 0$$ $$\partial_t \vec{D} - \nabla \times \vec{C} = 0$$ $$\nabla \cdot \vec{C} = 0$$ $$\nabla \cdot \vec{D} = 0$$

using an upwind constrained transport scheme (currently just using piecewise constant reconstruction). The face centered fields are evolved and prolongation is done using the scheme of Toth & Roe.

TODO:

  • Actually initialize $\vec{C}$ and $\vec{D}$ to something
  • Include Toth & Roe prolongation so that divergence constraint is preserved in AMR

PR Checklist

  • Code passes cpplint
  • New features are documented.
  • Adds a test for any bugs fixed. Adds tests for new features.
  • Code is formatted
  • Changes are summarized in CHANGELOG.md
  • Change is breaking (API, behavior, ...)
    • Change is additionally added to CHANGELOG.md in the breaking section
    • PR is marked as breaking
    • Short summary API changes at the top of the PR (plus optionally with an automated update/fix script)
  • CI has been triggered on Darwin for performance regression tests.
  • Docs build
  • (@lanl.gov employees) Update copyright on changed files

@Yurlungur
Copy link
Collaborator

Include Toth & Roe prolongation so that divergence constraint is preserved in AMR

Is this needed if using edge fields?

@lroberts36
Copy link
Collaborator Author

Include Toth & Roe prolongation so that divergence constraint is preserved in AMR

Is this needed if using edge fields?

@Yurlungur: No, it shouldn't be. I had started writing it using face fields though.

@lroberts36 lroberts36 changed the title WIP: Add a vector wave equation test Add a vector wave equation test Jun 5, 2024
@lroberts36 lroberts36 changed the title Add a vector wave equation test WIP: Add a vector wave equation test Jun 5, 2024
@lroberts36 lroberts36 changed the title WIP: Add a vector wave equation test Add a vector wave equation test Jun 5, 2024
@lroberts36 lroberts36 changed the title Add a vector wave equation test Add a vector wave equation example Jun 5, 2024
Comment on lines +217 to +223
if (ox3 == 0 && ndim > 2) kb.e -= TopologicalOffsetK(te);
if (ox2 == 0 && ndim > 1) jb.e -= TopologicalOffsetJ(te);
if (ox1 == 0) ib.e -= TopologicalOffsetI(te);
const int ks = (ox3 == 0) ? 0 : (kb.e - kb.s + 1 - TopologicalOffsetK(te));
const int js = (ox2 == 0) ? 0 : (jb.e - jb.s + 1 - TopologicalOffsetJ(te));
const int ks =
(ox3 == 0 || ndim < 3) ? 0 : (kb.e - kb.s + 1 - TopologicalOffsetK(te));
const int js =
(ox2 == 0 || ndim < 2) ? 0 : (jb.e - jb.s + 1 - TopologicalOffsetJ(te));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This fixes a bug which caused the z-component of coarsened face fields to be filled with zeros in 2D. I don't think anyone is likely to have run into it yet though (aside from in this example).

Copy link
Collaborator

@pdmullen pdmullen left a comment

Choose a reason for hiding this comment

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

Very happy to see a topological element regression test going in!

example/fine_advection/advection_driver.cpp Show resolved Hide resolved
example/fine_advection/advection_driver.cpp Show resolved Hide resolved
example/fine_advection/advection_package.cpp Show resolved Hide resolved
example/fine_advection/advection_package.hpp Show resolved Hide resolved
example/fine_advection/advection_package.hpp Show resolved Hide resolved
example/fine_advection/stokes.hpp Show resolved Hide resolved
src/prolong_restrict/pr_ops.hpp Show resolved Hide resolved
Copy link
Collaborator

@bprather bprather left a comment

Choose a reason for hiding this comment

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

LGTM, this will be a great extra test!

Copy link
Collaborator

@Yurlungur Yurlungur left a comment

Choose a reason for hiding this comment

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

Very excited to see this modernization and demonstration for how to do constrained transport.

src/prolong_restrict/pr_ops.hpp Show resolved Hide resolved
src/basic_types.hpp Show resolved Hide resolved
example/fine_advection/advection_package.hpp Show resolved Hide resolved
example/fine_advection/advection_package.hpp Show resolved Hide resolved
@lroberts36 lroberts36 changed the base branch from lroberts36/add-fine-variables to develop June 13, 2024 18:11
@lroberts36 lroberts36 enabled auto-merge June 15, 2024 16:19
@lroberts36
Copy link
Collaborator Author

@par-hermes format

@lroberts36 lroberts36 disabled auto-merge June 16, 2024 17:56
@lroberts36 lroberts36 enabled auto-merge June 16, 2024 17:56
@lroberts36 lroberts36 merged commit 4dac0fb into develop Jun 16, 2024
50 checks passed
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