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

Update spacecraft charging test #4792

Merged
merged 8 commits into from
Mar 21, 2024

Conversation

RemiLehe
Copy link
Member

The spacecraft charging test was not properly correctly the electric field in the simulation with callback functions.

The purpose of the callback functions here is to correct the electric field, so that the charge on the spacecraft computed using Gauss law (from the electric field) matches the actual charge (calculated from collecting particles on the embedded boundary).

However, the current script corrects a copy of the electric field. The actual electric field in the simulation was not corrected. This can be seen from the print statements when the code is running. (The print statements print the charge from Gauss law and the actual charge, and they did not match with the current version of the script.)

@RemiLehe RemiLehe requested a review from dpgrote March 20, 2024 17:07
Er[...] = Er[...]+(q - q_v)*self.normalized_Er[...]
Ez = EzWrapper(include_ghosts=True)[:,:]
Er = ExWrapper(include_ghosts=True)
Er[...] += (q - q_v)*self.normalized_Er[...]
Copy link
Member

Choose a reason for hiding this comment

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

This could be cleaned up a bit more. Since self.normalized_Er is an already a numpy array, the [...] is not needed. And the same for Ez and phi below.

Copy link
Member

@dpgrote dpgrote 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 good.

I would comment for the record that using MFIter type loops would be better here (since it would avoid global copies and would run on GPU), if there is ever time to update this example.

@RemiLehe
Copy link
Member Author

Yes, agreed.
I think I could do a follow-up PR in the next week or so, using pyamrex to do the above.

@RemiLehe RemiLehe enabled auto-merge (squash) March 21, 2024 12:51
@RemiLehe RemiLehe merged commit daa8b3b into ECP-WarpX:development Mar 21, 2024
45 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