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 non-conservative form for convection operator #45

Closed
wants to merge 3 commits into from

Conversation

qiauil
Copy link
Contributor

@qiauil qiauil commented Oct 14, 2024

Modifications:

  • Add non-conservative form of convection operator: $\mathbf{u}\cdot \nabla \mathbf{u}$.
  • rename the _multi_channel_eval func to _multi_channel_conservative_eval and remove the 0.5 coefficient.
  • Support shifting from conservative form and non-conservative form when initializing the operator.
  • Changing the docstring.

@qiauil qiauil requested a review from Ceyron October 14, 2024 19:14
@Ceyron Ceyron changed the base branch from main to dev October 15, 2024 05:38
Copy link
Owner

@Ceyron Ceyron left a comment

Choose a reason for hiding this comment

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

Hi Qiang,
thanks for the PR. 👍
I left some comments in the code.

)
u_hat_dealiased = self.dealias(u_hat)
u = self.ifft(u_hat_dealiased)
conv_u=sum(
Copy link
Owner

Choose a reason for hiding this comment

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

Could you use a broadcasted version for the contraction for efficiency.

Copy link
Owner

Choose a reason for hiding this comment

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

For readability, I could imagine that it's better to have a separate line in which you compute the velocity gradient in Fourier space.

exponax/nonlin_fun/_convection.py Show resolved Hide resolved
for 1D and

```
𝒩(u) = b₁ ∇ ⋅ (u ⊗ u)
Copy link
Owner

Choose a reason for hiding this comment

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

Could you tell me what the reason was for removing the 1/2? Now, I think that the conservative and nonconservative no longer match with each other.

@Ceyron
Copy link
Owner

Ceyron commented Oct 15, 2024

Two more general points:

  1. Could you forward the options to the steppers. This should be:
    1. Burgers
    2. Korteweg-de Vries
    3. KS conservative
    4. General Convection Stepper
    5. Normalized Convection Stepper
    6. Difficulty Convection Stepper
  2. I changed the base branch to dev. Could you resolve the merge conflicts.

@qiauil
Copy link
Contributor Author

qiauil commented Oct 15, 2024

Hi, Felix,

I have uploaded the code and modified the steppers. Please let me know if you have any further comments.
We can keep the discussion on the 0.5 coefficient of the conservative form and modify it later.

Cheers,
Qiang

@qiauil qiauil requested a review from Ceyron October 15, 2024 18:19
Copy link
Owner

@Ceyron Ceyron left a comment

Choose a reason for hiding this comment

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

Hi Qiang,

Thanks a lot for the updates 👍.
I left some comments in the review.
Let's further discuss the 1/2 issue in #43,

):
"""
Performs a pseudo-spectral evaluation of the nonlinear convection, e.g.,
found in the Burgers equation. In 1d and state space, this reads

```
𝒩(u) = - b₁ 1/2 (u²)ₓ
𝒩(u) = b₁ u (u)ₓ
Copy link
Owner

Choose a reason for hiding this comment

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

Hi Qiang,
I think we should keep the minus here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! That was my mistake... all the minus should be kept here.

Copy link
Owner

Choose a reason for hiding this comment

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

Great 👍
Could you add them again in the PR?

exponax/nonlin_fun/_convection.py Show resolved Hide resolved
exponax/nonlin_fun/_convection.py Show resolved Hide resolved
@qiauil qiauil requested a review from Ceyron October 18, 2024 13:35
@Ceyron
Copy link
Owner

Ceyron commented Oct 21, 2024

Hi Qiang,

The docstring is still without the minus. Did you forget to push your changes?

@qiauil
Copy link
Contributor Author

qiauil commented Oct 21, 2024

Hi, Felix

I think it should be a GitHub issue as it shows "Checking for the ability to merge automatically…Hang in there while we check the branch’s status." from my side since I pushed the commit. Can you see my other changes, e.g., adding codes for single-channel non-conservative convection?

Sorry to hear you were sick; get well soon :)

@qiauil
Copy link
Contributor Author

qiauil commented Oct 21, 2024

Hi, Felix,

I just pushed a new commit with a minor change, but it still shows "processing updates" here.
image
Considering it was exactly the same on Friday, I am not sure whether it will finally work out. You may check my fork to see the updates and to see whether we can find some solutions.

@Ceyron
Copy link
Owner

Ceyron commented Oct 21, 2024

I think it could be related to the fact that I made the repo public on Friday.
You could try making your fork public and see if that resolves the problem

@qiauil
Copy link
Contributor Author

qiauil commented Oct 21, 2024

Hi, Felix,

Good point! I just changed the visibility and pushed again. But it seems not working. I just have a search, and it seems to be a common issue; see https://github.com/orgs/community/discussions/78775, and we might need to add a new pull request if it is still not working later...

@Ceyron
Copy link
Owner

Ceyron commented Oct 21, 2024

Hmmm, yes, recreating the PR seems to be the easiest solution.

@qiauil qiauil closed this Oct 21, 2024
@Ceyron
Copy link
Owner

Ceyron commented Oct 21, 2024

New PR is #46

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