ECP-WarpX / WarpX

WarpX is an advanced electromagnetic & electrostatic Particle-In-Cell code.
https://ecp-warpx.github.io
Other
291 stars 185 forks source link

The Discrepancy Issue Between Different Diagnostic Data in WarpX #5212

Open jinze-liu opened 1 week ago

jinze-liu commented 1 week ago

I am currently using WarpX to diagnose the electric field using both the reduce and field diagnostics, but I noticed that the data obtained from these two diagnostics differ significantly in magnitude. Specifically, when visualizing the data obtained from FieldDiagnostic with VisIt, the results are consistent in magnitude with the theoretical calculations. However, the data obtained using the ReducedDiagnostic (FieldProbe) shows a much larger discrepancy. I noticed that the unit for the electric field in the ReducedDiagnostic is V·s/m (volt-seconds per meter). I tried dividing the data by time (s) to correct the unit, but the magnitude still doesn't match. Below are my diagnostic scripts and generated images. I am unsure where the issue might be.

inputs.py.txt image

Additionally, I am using a new cluster (unrecorded), so I followed the installation method for HPC3 (UCI). I found that if I choose the HDF5 format for diagnostics, an error occurs, similar to what is described in case #3952. Since this is a new cluster environment, reinstalling software might involve significant risks. Therefore, I would like to ask if continuing to use yt and VisIt to read and visualize plotfile format data is feasible?

Furthermore, when using yt to read data from the FieldDiagnostic, the extracted electric field's spatial variation does not match the theoretical prediction at all, and it also disagrees with the spatial variation of the electric field obtained from the ReducedDiagnostic. I am quite puzzled by these results and would like to understand where the problem might lie. Below is my Python analysis script using yt. analysis.py.txt

I would appreciate any suggestions or help. Thank you!

RemiLehe commented 1 week ago

Thanks for raising this issue @jinze-liu.

Regarding the reduced diagnostics discrepancy: could you set integrate=0 instead of integrate=1 when creating the ReducedDiagnostic object? I think that the reason why you get data in V.s/m instead of V/m is because the electric field data has been integrated in time. Setting integrate=0 will turn this off.

Regarding your question on yt and Visit: of course, you can continue using the plotfile output format of WarpX and then use yt or Visit. There should be no issue with this.

Regarding the issue when extracting the data with yt: please follow the instructions here and in particular please use the function covering_grid. Let us know if the issue persists even with these instructions.

jinze-liu commented 1 week ago

Hi! @RemiLehe .

I took your advice and changed integrate=1 to integrate=0, and it perfectly solved my problem! This is fantastic, thank you so much!

Based on your suggestion, I believe the issue with the FieldDiagnostic not matching the theory was due to a problem in my code for extracting data using yt. I'm currently studying the yt project, especially the covering_grid. If I encounter any further issues, I will let you know. Thanks again!