Closed Buddhabrot2 closed 4 years ago
I don't understand your setup very well but you must ensure that your field is divergence-free.
Also expect the field generated by the particles to appear in your results. If the particles in your simulation make strong currents able to significantly modify the field, and induce currents in the solenoid, then you might not be using the right tool. I might be misunderstanding your point though.
Thanks for your very quick reply!
About the setup: I would like to model a cloud of thin plasma moving into a solenoid (the plasma is following the central axis of the solenoid). The plasma should be compressed and then reflected or transmitted. I expect single particle trajectories to play a significant role, so i chose a PIC code. Imagine a reverse magnetic nozzle for a thin plasma. I should mention that at this stage i am just playing around with the concept ;) https://en.wikipedia.org/wiki/Magnetic_nozzle
Induction of current in the solenoid can be neglected, since the solenoid current would be kept stationary by external circuitry and the plasma would (probably) be too thin anyway.
I hope to eventually see the field generated by particles in the results, but for now i set the particle density to zero, so i can check the correct application of the external field and so I can get a baseline to compare the eventual result against. The field should be divergence free (exept maybe for numerical errors) since it matches the field of a real world solenoid calculated via the Biot Savart Law.
So what i am looking for is a constant field just superimposed on anything the actual simulation does. Is there any way I can make this happen?
ExternalFields should do what you expect. They are applied as initial fields over the whole box, then continuously applied at the boundaries.
Did you try without particles first ?
Ciao! So I think SMILEI is behaving correctly and that ExternalField (which actually are initial fields, defined at t=0, then evolving according to Maxwell's equations) cannot do what you would like it to do. Indeed, the magnetic field given by the solenoid requires a current to be maintained. The way you are running the code, the magnetic field is here at time t=0, but let to evolve without any current maintaining it. It's like you just turned off the current in the solenoid. Hence, the magnetic field dissipates. We have recently implemented the possibility to add a time-dependent external field. In that case, this external field is prescribed by the user (in the namelist) and does not go through the Maxwell's solver. We will release (soon) a new version of the code with this time-dependent external field in beta-version. This should solve your problem (you just will have to enter a constant-in-time field, but it will be applied to the particles at all times). Note however that @mccoys is right in stating that you have to ensure a divergence-free B-field (which it seems you do within the numerical error) and that should still be the case for the time-dependent B-field. I would also like to stress that one has also to be cautious with the electromagnetic boundary conditions.
Isn't the field supposed to be maintained by the boundary conditions?
@mccoys I checked the field with the number density set to zero, and again with particles_per_cell = 0 for all species, with identical results. I think boundary conditions can only uphold a magnetic field which is not caused by currents within the simulation, since the maxwell solver would just "connect" the open field lines that are created at the boundary. If i place the "solenoid" far outside the simulation region, the field behaves much more sensible, too.
@MickaelGrech This explains the behaviour, of course. From the documentation, i did not realize that the external fields are initial fields. I am looking forward to the new version of the code! For now i will just experiment a bit with the antenna block to maintain a current and combine this with the external field block. Regarding the boundary conditions, i probably still have some reading to do. Could you point me to any good resources on this?
Thanks for your time and have a nice weekend!
What about using Antenna to drive the solenoid current?
@talmiller2 the antenna option was suggested earlier on, but they would require a solenoid to fit in the box
@mccoys I missed that when going over the comments previously. I can see why fitting the solenoid in the simulation would be wasteful, and so would like to join on the request for a time dependent magnetic field boundary condition, or at least an option for a constant background field (to keep enforcing the initial field). I'm also interested in simulating a solenoid background field. Thanks a lot.
The option for additional, time-varying fields is currently being tested. I hope it will be available soon
@MickaelGrech isn't this already available? I thought it was done already
Yes. This will be available pretty soon, just not right now (my fault I'm lagging behind).
@MickaelGrech This is done, right ?
Yes! Since v4.4 the user can define some prescribed fields. Here is the corresponding doc. Note that these fields are not considered by the Maxwell solver, but only to push particles (they appear in the Fields or Probe diagnostics though).
An important fix was made to this feature in v4.5. Please upgrade.
Hello everyone!
I observe some strange behavior when trying to apply a constant magnetic background field.
I am trying to use Smilei to simulate a simple magnetic mirror. To do that i want to apply a static magnetic background field as it would be created by a solenoid.
The solenoid is approximated using the the loopfield module (see https://pypi.org/project/loopfield/), wrapped in a function and given to the ExternalFields block.
For a solenoid directly outside the simulation region, the field is initialized correctly...
... but then shows strange dynamic behavior. (25 steps in)
If the "solenoid" is placed inside the simulation region, the field seems to undergo some kind of reconnection:
Start: 30 Steps in:
From Issue "External field and moving window #59 " I learned, that the external field is only applied on startup, since it was originally intended to study reconnection, but may be made constant by adapting the boundary conditions somehow. How is this done? Would this also work for the second case, where the "solenoid" is inside the simulation region? If not, could you recommend any better way to apply the field? I thought about using the antenna, but this would limit me to solenoids within the simulation region.
Namelist: magnetic_mirror.py.txt
Thanks for any help!