Giter Site home page Giter Site logo

iamcalvinlau / pbj Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 32.81 MB

PBJ stands for Particles By Julia. Hopefully, this grows into a Julia-based particle simulation suite of functions and subroutines to be used for testing various particle-in-cell methods and techniques.

License: GNU General Public License v3.0

Jupyter Notebook 99.77% Julia 0.23%

pbj's Introduction

PBJ

PBJ stands for Particles By Julia. Hopefully, this grows into a Julia-based particle simulation suite of functions and subroutines to be used for testing various particle-in-cell methods and techniques.

I have a personal list of interesting algorithms to look at

  1. Speed-limited PIC (SLPIC)
  2. Particle-in-Fourier (PIF)
  3. Phase-space remapping
  4. Asynchronous PIC

So far, SLPIC has been explored. Some PBJ benchmark cases are shown.

1. Sheath Formation with Fixed Potential Boundaries

At the moment, it has been used for 1d3v benchmark simulations. The flattening from 3d to 1d is done by ignoring the other dimensions and only calling a 1d gather/scatter function and a 1d Poisson solver.ย 

a. Without speed-limiting effects

This shows the formation of the sheath using protons and electrons injected from the left and being absorbed at the left and right. There is a thermal bath of particles on the left. The potential is held fixed at both ends. Sheath formation using protons and electrons

Electrons and ions are injected and absorbed. To accomodate for this, the particle array size is increased as needed in chunks. At steady-state, this should become roughly constant in number of particles. Tracking electron injection and absorption

Tracking ion injection and absorption

b. With speed-limiting effects

This shows the same formation of the sheath, almost the same as above but uses argon ions and electrons like the SLPIC paper. However, the time-step is 320x larger, and the simulation incorporates speed-limiting effects (see SLPIC paper). SL sheath formation using argon and electrons.

2. Two Stream Instability with Periodic Boundaries

This shows the two stream instability of electrons streaming with drift-velocity into stationary ions (with 100x electron mass). The boundary is periodic. Two-stream instability with mass-ratio=100

The fastest growing mode is when the period of the drift motion is equal to the plasma frequency. In this case, it is dominated by the m=3 (wavelength = 1/3 simulation length) component. The theory is simple for this case and is compared to the simulation results. Comparison of theory and simulation

pbj's People

Contributors

iamcalvinlau avatar

Stargazers

Jack Huang avatar Lucas Morton avatar Xishuo Wei avatar

Watchers

Luke Stagner avatar Oleksandr Koshkarov avatar  avatar

pbj's Issues

Energy conservation

Hi Calvin, thanks for the great code. I added a total energy calculation function (kinetic energy plus the electrostatic). I checked the conservation of energy in the example of two-stream instability and it was not very good for the default dt (dt=1.0/omega_theory*0.01). I reduced the dt to (dt=1.0/omega_theory*0.001) and it was much better. But this means dt=0.01 in terms of 1/omega_pe. It is strange if such a small dt is required to keep the energy conserved, so I thought maybe I am doing something wrong. The total energy is calculated as:

        es_energy=0.5*dx*sum((Fields_struct.ion_density.-Fields_struct.electron_density).*Fields_struct.phi)
        total_energy = electrons.total_kinetic_energy+ions.total_kinetic_energy+es_energy

Have you calculated this before? What can be the issue?

Thank you, Arash

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.