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

address rotation source in spherical 2d coordinate #2967

Merged
merged 22 commits into from
Dec 20, 2024

Conversation

zhichen3
Copy link
Collaborator

PR summary

This addresses #2927 regarding the rotation bit.
I mainly separated get_omega() to return magnitude of the angular frequency,
then made get_omega_vec() to depend on j, since $\Omega \hat{z} = \Omega[\cos(\theta) \hat{r} - \sin(\theta) \hat{\theta})]$.
To deal with the problem of position vector, I just made sure r is (r,0,0) before the cross_product call.
I also made computing dt_omega_matrix into a separate function since omega vector now varies.

PR motivation

PR checklist

  • test suite needs to be run on this PR
  • this PR will change answers in the test suite to more than roundoff level
  • all newly-added functions have docstrings as per the coding conventions
  • the CHANGES file has been updated, if appropriate
  • if appropriate, this change is described in the docs

@zingale zingale mentioned this pull request Sep 26, 2024
14 tasks
@zhichen3 zhichen3 marked this pull request as ready for review December 8, 2024 00:40

Array2D<Real, 0, 2, 0, 2> dt_omega_matrix = {};

if (implicit_rotation_update == 1) {
Copy link
Member

Choose a reason for hiding this comment

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

what happened to this check on implicit_rotation_update ?

Copy link
Member

Choose a reason for hiding this comment

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

I think it is missing in fill_dt_omega_matrix

Copy link
Collaborator Author

@zhichen3 zhichen3 Dec 18, 2024

Choose a reason for hiding this comment

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

fill_dt_omega_matrix is only called within if (implicit_rotation_update == 1) I think.

Copy link
Member

Choose a reason for hiding this comment

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

yes, you are right.

@zingale
Copy link
Member

zingale commented Dec 19, 2024

GpuArray<Real, 3> omega_cross_v;
cross_product(omega, v, omega_cross_v);

if (c1) {
// For Spherical coordinate, the physical position vector is just r rhat,
// but the input r will be in the format of (r,theta,0). So change it to (r,0,0)
Copy link
Member

Choose a reason for hiding this comment

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

why can we do this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

in spherical coord, the position vector is just $r \hat{r}$, so theta should be zeroed out when we do the cross products I think.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, this is because it is the position vector from the origin?

@zingale
Copy link
Member

zingale commented Dec 19, 2024

okay, everything looks good.

can you also update the docs?
https://amrex-astro.github.io/Castro/docs/rotation.html

@zhichen3
Copy link
Collaborator Author

okay, everything looks good.

can you also update the docs? https://amrex-astro.github.io/Castro/docs/rotation.html

done

@zingale zingale merged commit 34d2b9a into AMReX-Astro:development Dec 20, 2024
25 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.

2 participants