ComputationalRadiationPhysics / picongpu

Performance-Portable Particle-in-Cell Simulations for the Exascale Era :sparkles:
https://picongpu.readthedocs.io
Other
694 stars 218 forks source link

Refactore Plugin `SumCurrents` #783

Open psychocoderHPC opened 9 years ago

psychocoderHPC commented 9 years ago
ax3l commented 9 years ago

What is a SumCurrentChange?

I thought this plugin just adds up J which is a SumCurrentDensity.

psychocoderHPC commented 9 years ago

Might be my suggested name is not good, but is it not the change of J

ax3l commented 9 years ago

Hm, from checking the source on my cell phone, it looks like a simple globsl reduce of fieldJ:

https://github.com/ComputationalRadiationPhysics/picongpu/blob/dev/src/picongpu/include/plugins/SumCurrents.hpp

That means the current name "SumCurrent" (or what I proposed "SumCurrentDensity" to be more precise but dbl check factor for that) is valid ;)

psychocoderHPC commented 9 years ago

You are right but our FieldJ is not the current, it's the change of the current in one time step. Is it right? Maybe I am wrong.

ax3l commented 9 years ago

Close. Our FieldJ (as I documented inline long time ago in it's header file) is a current density which is the change of the charge over time and divided by the area it went through :) (See Ampère's circuital law in the Maxwell's equations.)

That's why I proposed to either call it "SumCurrentDensity" or to multiply it with the cell Volume (if it isn't already) - which makes it a "SumCurrent".

Update: I just opened my laptop and checked the sources. Since the result of the currentDensity-sum of FieldJ is multiplied with the area of the cell plane normal to the component, the current name is absolutely valid. I took the freedom to update your description.

ax3l commented 9 years ago

I think adding a MPI_Reduce is already sufficient, so only rank 0 creates output. Of course, we can also use the libPMacc reduce to reduce the code further.

psychocoderHPC commented 9 years ago

OK that's fine, than there is only the refactor part open. :+1: