Code Monkey home page Code Monkey logo

Comments (21)

mccoys avatar mccoys commented on September 27, 2024

Just a precision: the magnetic field is shifted by half a timestep compared to its value from Field diagnostics. Right? Is this what you meant?

from smilei.

egelfer avatar egelfer commented on September 27, 2024

Not exactly. It is shifted by half a timestep and half a spatial step. In particular, if particle moves along x direction inside the plane wave, which is propagating in -x direction, then the vector of the transverse magnetic field (B_y,B_z) in TrackParticles/ParticleBinning diagnotics is rotated by the angle phi=timestep*(1+v_x)/2

from smilei.

mccoys avatar mccoys commented on September 27, 2024

I don't understand how there could be a spatial shift. Is it due because of the wave displacement during that half timestep?

from smilei.

egelfer avatar egelfer commented on September 27, 2024

I think it is due to the particle displacement during the half timestep, since there is the term timestep*v_x/2

from smilei.

mccoys avatar mccoys commented on September 27, 2024

But what do you compare it with? The field diagnostic? If yes, i believe those are not properly aligned (by half a cell) in happi

from smilei.

egelfer avatar egelfer commented on September 27, 2024

No, actually I calculate the longitudinal component of the Lorentz force ([v x B]_x, for circular polarization it is also the ponderomotive force), and I know that (at least for rare plasma) the integral over time of it should be equal to zero. It is zero ideed after the rotation I described above.

from smilei.

mccoys avatar mccoys commented on September 27, 2024

@egelfer Could you try your test using the option keep_interpolated_fields? It probably changes the results as the interpolated fields are calculated at the correct time with this option.

from smilei.

egelfer avatar egelfer commented on September 27, 2024

Actually I used the option keep_interpolated_fields=["Ex","Ey","Ez","Bx","By","Bz"]. Do you want me to run the test without it?

from smilei.

mccoys avatar mccoys commented on September 27, 2024

yes that would be good.

Now your result is puzzling. Those fields are supposed to be exactly those calculated for pushing particles

from smilei.

egelfer avatar egelfer commented on September 27, 2024

Yes, I also assumed it and was very much surprized :)

from smilei.

mccoys avatar mccoys commented on September 27, 2024

Ah well in fact I forgot that the magnetic field is interpolated at integer timesteps while the velocity is known at half-integer timesteps

image

Thus the shift?

from smilei.

egelfer avatar egelfer commented on September 27, 2024

Yes, I suppose that might be the source of the shift

from smilei.

mccoys avatar mccoys commented on September 27, 2024

Did you manage to test without keep_interpolated_fields?

from smilei.

mccoys avatar mccoys commented on September 27, 2024

Did you test without keep_interpolated_fields?

from smilei.

mccoys avatar mccoys commented on September 27, 2024

I made some changes in the documentation in branch develop. Please reopen if necessary

from smilei.

egelfer avatar egelfer commented on September 27, 2024

Did you test without keep_interpolated_fields?

Sorry, I forgot to answer. In this case the simulation crushes.

I also wanted to ask, is it possible to output the magnetic field in a way similar to when the force acting on a field is calculated (https://smileipic.github.io/Smilei/Understand/algorithms.html#the-pic-loop), i.e. (B_p^{(n+1/2)}+B_p^{(n-1/2)})/2 ? Unfortunately my method to recover the correct field is valid only for a plane wave, and it is not always the case.

from smilei.

mccoys avatar mccoys commented on September 27, 2024

keep_interpolated_fields exactly retain the value of the fields that were obtained during interpolation. So you should have the force exactly.

from smilei.

egelfer avatar egelfer commented on September 27, 2024

That's what I assumed! :) But it is not, what I've got. Here is the plot of average longitudinal momentum (darkred, obtained from the ParticleBinning diag) in the collision of electron-positron bunch with a pulse plane wave. Magenta curve corresponds to the integral of the (averaged over the particles) force F_x= [v x B]_x+E_x with the E and B fields obtained from TrackParticles diag. Orange curve corresponds to the integral of F_x'= [v x B']_x+E_x, where B' is B shifted by a half step. However, as I wrote above, it works only for a plane wave field.

image

from smilei.

mccoys avatar mccoys commented on September 27, 2024

Are you using the velocity from tracked particles as well? As the fields and velocities differ by half a timestep that might be the problem

from smilei.

egelfer avatar egelfer commented on September 27, 2024

Yes, the velocities are taken from TrackParticles diag as well

from smilei.

mccoys avatar mccoys commented on September 27, 2024

Well then there you have it. It is not the fields that are out of phase. It's the velocities

from smilei.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.