Warwick-Plasma / epoch

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

how to define density as any function #513

Closed amarsarari closed 1 year ago

amarsarari commented 1 year ago

How to define density in term of exponential function like ne=den_H exp((x - 70.0micron) / (5*micron)) i am unable to it in input deck can u help me

Status-Mirror commented 1 year ago

Hey @amarsarari

You cant write equations in the input deck, using syntax which can be read by the maths parser.

In your example, you could define an exponential density in the species block using commands like this:

begin:species
   name = Electron
   charge = -1.0
   mass = 1.0
   frac = 0.5
   density = 1.0e20 * exp((x - 70.0e-6) / 5.0e-6)
   density = if(x gt 70.0e-6, 1.0e20, density(Electron))
end:species

In this example, the electron number density rises from $1.0\times 10^{20}m^{-3}\exp((x_{min}-70.0e-6)/5.0e-6)$ on the x_min boundary, to $1.0\times 10^{20} m^{-3}$ for $x>70\mu m$.

Hope this helps, Stuart

amarsarari commented 1 year ago

Thank you sir

On Fri, 23 Jun 2023, 13:22 Stuart Morris, @.***> wrote:

Hey @amarsarari https://github.com/amarsarari

You cant write equations in the input deck, using syntax which can be read by the maths parser https://epochpic.github.io/documentation/code_details/maths_parser.html.

In your example, you could define an exponential density in the species block https://epochpic.github.io/documentation/input_deck/input_deck_species.html using commands like this:

begin:species name = Electron charge = -1.0 mass = 1.0 frac = 0.5 density = 1.0e20 * exp((x - 70.0e-6) / 5.0e-6) density = if(x gt 70.0e-6, 1.0e20, density(Electron)) end:species

In this example, the electron number density rises from $1.0\times 10^{20}m^{-3}\exp((x_{min}-70.0e-6)/5.0e-6)$ on the x_min boundary, to $1.0\times 10^{20} m^{-3}$ for $x>70\mu m$.

Hope this helps, Stuart

— Reply to this email directly, view it on GitHub https://github.com/Warwick-Plasma/epoch/issues/513#issuecomment-1603876984, or unsubscribe https://github.com/notifications/unsubscribe-auth/BARPWKPBJXYEELW2ERJTTPTXMVDM3ANCNFSM6AAAAAAZPXBGSY . You are receiving this because you were mentioned.Message ID: @.***>

amarsarari commented 1 year ago

Hi sir i want 1.0e20 exp((x - 10.0e-6) / 2.0e-6) from 0 to 10 micron then 1.0e20 from 10 to 5 micron then rising from 1.0e20 exp((15.0e-6-x) / 5.0e-6) from 15 to 25 micron how I can do plz help me