Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track electrons through argon with space charge at different pressures? #4

Open
robnagler opened this issue May 29, 2018 · 12 comments
Open

Comments

@robnagler
Copy link
Member

A user writes:

I would like to use the software rswarp for the following issue:
Simulating an electron beam (CW) of several keV and Ampere, which is tracked through an argon gas. Then analyzing the space charge compensation rate and potentials for different gas pressures (10^-8 to 10^-4 mbar).
Would this be possible to simulate with rswarp and which libraries do I need?

@cchall
Copy link
Member

cchall commented May 31, 2018

This should be doable with Warp and optionally with rswarp to extend ionization capabilities.

The main reason to want to use rswarp to handle the ionization is to provide functional forms for the cross section and ionization product's energies and angular distribution. Warp currently only supports static values for these items and does not support any setting of a product's vector. If the user has some function for any of these items then rswarp could be of use.

@bruhwiler
Copy link
Member

I think some of these rswarp capabilities have been recently merged into the Warp base code, although I'm not sure exactly what or when.

We should verify which version of Warp is being used.

@bruhwiler
Copy link
Member

@cchall and I verified that the rswarp extensions for ionization physics have not yet been added to the Warp base code.

It seems that helping the user implies offering some advice or even providing a Warp Python script.
@cchall will commit a beta quality example script to the repository and post the location here.

@ohinrichs
Copy link

ohinrichs commented Jun 1, 2018

@bruhwiler a sample script for my issue would of course be very helpful. I am new to warp/rswarp, but I already worked with TraceWin and G4Beamline.

@ohinrichs
Copy link

I have an additional question:
With the ionization module I am able to produce the electron and ion pairs of the residual gas. But to get into an equilibrium state after some time the ions must leave the ion gas. The rate of loss will then depend upon the ion gas density at the wall and the average normal velocity component there. The density will be controlled by the Boltzmann law.

Is this effect considered in the code?

@ohinrichs
Copy link

1.1699548.pdf
Here is a paper describing the processes I want to simulate.

@bruhwiler
Copy link
Member

Hello @ohinrichs

Thanks for the interesting paper.

I think the ion macroparticles are created with zero velocity. We are planning to add the option for them to be created with a random velocity, based on the specified temperature of the neutral gas.

If you are interested to look in the code, then we can assist. RadiaSoft is in the process of hiring, and we may have someone who can begin working on this in 4 to 6 weeks.

For the system described in the paper, there may be complications if the gas temperature varies with position. If the gas temperature is uniform, and is equal to the wall temperature, then Warp should be able to model the problem, after the finite temperature ion capability is implemented.

@ohinrichs
Copy link

Oh I see. I thought giving the added macroparticles an emitted energy would also create a velocity.
As a first try I would assume a uniform gas temperature equal to the wall temperature. So I am looking forward to the implementation.

@cchall
Copy link
Member

cchall commented Jun 4, 2018

@ohinrichs @bruhwiler
There is now an example magnetized_cooler.py in examples/ionization/ as of 7bc5c32. This example comes from simulations of 3 MeV electrons ionizing H2 gas, but hopefully is a reasonable starting point. There is a corresponding IPython notebook in the same folder that briefly discusses some of the experiment that the simulation is based on, it also contains some possibly helpful examples of loading and plotting data. Please let me know if you encounter errors or have questions.

We do currently create the ions with zero initial velocity

emitted_energy0=[0, h2crosssections.ejectedEnergy], # Energy of each emitted species, can be float or function
emitted_energy_sigma=[0, 0], # Energy spread of emitted species (gives width of gaussian distribution)

However, any callable function could be dropped in and used to set the ion velocities depending on what your model requires. If there is a varying ion temperature it should be possible to register multiple Ionization instances, each in a different volume. If the temperature does not change very rapidly this could be a reasonable solution. It shouldn't be too hard to implement a more elegant solution if necessary though.

@cchall
Copy link
Member

cchall commented Jun 18, 2018

An update on this issue, there is now builtin functionality, as of da49b9c, for creating ion products with a thermal velocity distribution.
See the example magnetized_cooler.py for an example of adding this to a simulation.

@ohinrichs
Copy link

Thank you for the update!
The simulation time is scaling strongly with the beam_current.
So for the 15 A it takes a long time. Is there a way to accelerate/prevent that?
Is it right that the emitted ions are destroyed when they reach the pipe wall as a result of the thermal movement?

@cchall
Copy link
Member

cchall commented Jul 9, 2018

@ohinrichs

The simulation time is scaling strongly with the beam_current.

You may be able to improve the time scaling by adjusting particle weights for the beam/ionization products. In magnetized_cooler.py the beam weight is set automatically by Warp based on the number of macroparticles injected eache step ptcl_per_step and the current beam.ibeam. The weight is directly set for the ionization products by the weight parameter:

h2plus = wp.Species(type=wp.Dihydrogen, charge_state=+1, name='H2+', weight=2)
emittedelec = wp.Species(type=wp.Electron, name='emitted e-', weight=2)

Once a species object is instantiated the weight may be adjusted by setting the sw attribute.

Is it right that the emitted ions are destroyed when they reach the pipe wall as a result of the thermal movement?

This is the intended behavior for the magnetized_cooler example. If you would like to set reflection this can be done by changing the pbound attributes in top from absorb to reflect:

# Set particle boundary conditions
wp.top.pbound0 = wp.absorb
wp.top.pboundnz = wp.absorb

Note that wp.top.pboundxy is not explicitly set here but it can also be set to reflect. The second step if you want reflection is to no longer set any conductors to be scrapers. Comment out or remove appropriate conductors from the list in:
# Conductors set as scrapers will remove impacting macroparticles from the simulation
scraper = wp.ParticleScraper(conductors)

Conductors that are not scrapers will still be used appropriate in the field solve but particles will pass through them.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants