Warwick-Plasma / epoch

Particle-in-cell code for plasma physics simulations
https://epochpic.github.io
GNU General Public License v3.0
182 stars 58 forks source link

Moving window #91

Open keithbennett opened 3 years ago

keithbennett commented 3 years ago

In GitLab by Naveen Kumar on 21 Sep 2020, 15:33 (GitLab issue GL#2252)

I have a question regarding the boundary conditions with moving window in EPOCH. Does bc_x_min_after_move accept reflect as a boundary condition for particles?

keithbennett commented 3 years ago

In GitLab by Thomas Goffrey (@TomGoffrey) on 21 Sep 2020, 16:01

I don't see why not. What happens if you try it?

keithbennett commented 3 years ago

In GitLab by Naveen Kumar on 21 Sep 2020, 16:28

No, I haven't tried it yet. Thought to ask about it first to see if that makes sense at all to try. I'll try it today.

keithbennett commented 3 years ago

In GitLab by Thomas Goffrey (@TomGoffrey) on 21 Sep 2020, 18:08

Well, I can't speak for how sensible it is, I'm afraid that's up to the user, but I don't immediately see a reason why it wouldn't be possible.

keithbennett commented 3 years ago

In GitLab by Naveen Kumar on 23 Sep 2020, 13:27

I meant since moving window usually removes particles from the left, so I was a bit apprehensive if it would reflect the particles from the left boundary. Anyway, I ran a simulation and I choose reflect boundary condition on the left and the _heatbath on the right. I ran it for long time (~24 hours) but I don't see any reflection from the left side. Please have a look and suggest if I can tweak to make it work in this way.

input.deckElecDens

keithbennett commented 3 years ago

In GitLab by Thomas Goffrey (@TomGoffrey) on 01 Oct 2020, 11:55

I'm not really sure what that's a plot of (n_{up} as a function of x and T?) but it looks uniform to me, so I'm not sure what you'd expect to see reflecting?

keithbennett commented 3 years ago

In GitLab by Naveen Kumar on 02 Oct 2020, 10:04

Well if the left boundary of the moving window reflect any particles then the density should pile up after sometime. But as you can see that the density remains uniform, which means reflect as the left boundary condition in a moving window doesn't work. This was my original question.

keithbennett commented 3 years ago

In GitLab by Thomas Goffrey (@TomGoffrey) on 02 Oct 2020, 10:39

OK, I understand the question now, I think there is some confusion as to how the window works.

The basic structure is something like:

DO ! Main loop
  ! Lots of code
  CALL particle_push
  ! More code
  CALL moving_window
END DO

Within the particle push your boundary condition will be applied. The moving window is applied later. During this step, the domain window is moved along a given distance, and any particles which have fallen out of the domain are removed. This happens independent of bc_x_min_after_move, so there's no piling up of particles at the boundary. Essentially I think your expectation was that window+reflecting would act like a piston, but that's not the case.

As I said, it's up to you to decide what boundary conditions are sensible for your problem, but I can't think of a case where window+reflect makes sense as currently implemented.

keithbennett commented 3 years ago

In GitLab by Naveen Kumar on 02 Oct 2020, 11:16

Yes, my expectation was that window+reflect should act like a piston. However, I still have one question, as you can see in my input.deck, I had also chosen _bc_x_minparticle = reflect in the boundaries block. Of course the plasma in my case doesn't have a drift but it still has temperature. So I could have expected some thermal plasma particles to hit the left wall and get reflected due to the reflect boundary condition and then remain in the simulation box. Though in my case moving window has higher velocity then the thermal particles, so I may still loose particles.

keithbennett commented 3 years ago

In GitLab by Zhongwei on 02 Oct 2020, 14:53

Hi, Naveen. I guess that you want a piston moving window: the position and velocity of the pushed particle j who have been crossed the left boundary will be xj(t+dt) = 2x_left_boundary(t+dt) - xj(t) and vxj(t+dt) = 2v_left_boundary -vxj(t).

However, as discussed by developers above. The moving window is more like a moving "field of view" (FOV). The window is moved after the pusher. So there is no pile up if the window moves faster than the vx component of reflected particles at the boundary.

Am I correct? May be we could ask for a feature request? @tom

keithbennett commented 3 years ago

In GitLab by Thomas Goffrey (@TomGoffrey) on 02 Oct 2020, 17:43

@naveenyadav I think your explanation is correct - any boundary effects you see in this plasma will be sufficiently localised that the they are removed by the moving window faster than they form.

Hope this has been helpful.