Skip to content

Conversation

@ChunYen-Chen
Copy link
Collaborator

Currently, if MINMOD_MAX_ITER is enabled to reduce the minmod coefficient in each patch, the output of the magnetic field may become inconsistent due to variations in the minmod coefficient across nearby patches.

To address this issue, enabling OPT__SAME_INTERFACE_B enforces consistency of the magnetic field at patch interfaces. However, in the current implementation, the magnetic energy at the interface is not updated.

This PR ensures that magnetic energy is updated when OPT__SAME_INTERFACE_B is enabled.

@hyschive hyschive requested a review from hfhsieh April 13, 2025 13:36
@hyschive hyschive added accuracy Accuracy issues and improvement mhd Magnetohydrodynamics labels Apr 13, 2025
Copy link
Contributor

@hfhsieh hfhsieh left a comment

Choose a reason for hiding this comment

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

@ChunYen-Chen @hyschive
Before looking into the details, I would like to ask something:

  • Since it's only during initialization that we do not need to update the magnetic energy in MHD_SameInterfaceB(), I think we can always perform the update, as it should not impact performance.
  • Should we update the wiki documentation to note this behavior under MINMOD_MAX_ITER, or consider automatically enabling OPT__SAME_INTERFACE_B when MINMOD_MAX_ITER > 0 in MHD simulations?

@ChunYen-Chen
Copy link
Collaborator Author

@hfhsieh

Since it's only during initialization that we do not need to update the magnetic energy in MHD_SameInterfaceB(), I think we can always perform the update, as it should not impact performance.

Agreed. I’ll let you know once I’ve updated the code.

Should we update the wiki documentation to note this behavior under MINMOD_MAX_ITER, or consider automatically enabling OPT__SAME_INTERFACE_B when MINMOD_MAX_ITER > 0 in MHD simulations?

I will update the wiki document.
@hyschive Would you like to automatically enabling OPT__SAME_INTERFACE_B when MINMOD_MAX_ITER > 0 in MHD simulations?

@hyschive
Copy link
Contributor

I will update the wiki document. @hyschive Would you like to automatically enabling OPT__SAME_INTERFACE_B when MINMOD_MAX_ITER > 0 in MHD simulations?

Agree. How about declaring OPT__SAME_INTERFACE_B as int instead of bool, setting its value to -1 in all Input__Parameter, and resetting it to either 0 or 1 (if its value is still -1) in Init_ResetParameter.cpp depending on the value of MINMOD_MAX_ITER?

You can also define a corresponding typedef in Typedef.h for OPT__SAME_INTERFACE_B.

Also, remember to raise a warning message in Aux_Check_Parameter.cpp when enabling MINMOD_MAX_ITER for MHD.

@ChunYen-Chen ChunYen-Chen force-pushed the sameB branch 2 times, most recently from ad5338b to aa83e3b Compare April 15, 2025 10:43
@ChunYen-Chen
Copy link
Collaborator Author

@hfhsieh I’ve updated the PR. Please take a look when you have time—thank you in advance!

Copy link
Contributor

@hfhsieh hfhsieh left a comment

Choose a reason for hiding this comment

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

Looks good to me. I have added some comments.

@ChunYen-Chen
Copy link
Collaborator Author

@hfhsieh Thanks for the review. I have addressed the comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accuracy Accuracy issues and improvement mhd Magnetohydrodynamics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants