Simulation Configuration¶
Tip
Reload if LaTeX equations didn't render (check table of contents).
Config file¶
General structure¶
The config.txt file has various sections, denoted by tags. The structure is shown below. The %% is used to denote a comment, although this is not supported in the solver.
Note
It is usually best to leave 2-3 lines between tags.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Title¶
The TITLE section is comprised of two titles lines:
1 2 3 | |
Example
1 2 3 | |
Author¶
The author's name is displayed in the bottom right corner of the screen for the entire animation.
1 2 | |
Example
1 2 | |
Animation settings¶
The SIM section contains one parameter, the animation time. For more animation settings, see the Animation section.
1 2 3 | |
Example
1 2 3 | |
Computation settings¶
General structure¶
The CONFIG section contains information about the numerical simulation.
1 2 3 | |
The simulation type can be:
-
Lorentz Motion, which computes the path of particles in the specified space.
-
\(\vec{B}\) Field, which computes the magnetic vector field in the specified region by logging the field vectors in the space.
-
\(\vec{E}\) Field, which computes the electric vector field in the specified region by logging the field vectors in the space.
Note
The \(\vec{B}\) Field and \(\vec{E}\) Field simulations are still under development and are using very crude patched together experimental code by me, various online sources and AI. This is purely experimental and will be re-written by me once experimentation is complete. All other code is written by me.
Lorentz motion¶
1 2 3 4 5 | |
The numerical method can be either RK4 Euler (recommended), RK4 Hybrid or Euler.
Example
1 2 3 4 5 | |
\(\vec{B}\) Field¶
1 2 3 4 5 | |
Example
1 2 3 4 5 | |
\(\vec{E}\) Field¶
Info
Coming soon.
1 2 3 4 5 | |
Example
1 2 3 4 5 | |
Object definitions¶
There are a number of objects that can be added to a simulation space:
-
Particle (P)
-
Uniform Fields
-
Uniform Magnetic Field (UMF)
-
Uniform Electric Field (UEF)
-
-
Static Point charge (SPC)
-
Sectioned Uniform Fields
-
Sectioned Uniform Magnetic Field (SUMF)
-
Sectioned Uniform Electric Field (SUEF)
-
-
Wire (W)
-
Wire Loop (WL)
-
Magnetic dipole (MD) -- coming soon
Later, more complex premade combinations of objects will be added. For example:
- Tokamak Fusion Reactor
Particle¶
A particle has initial position, initial velocity, charge and mass (all in standard SI units). Hence, it is defined as follows:
1 2 3 4 5 | |
Example
1 2 3 4 5 | |
Uniform fields¶
Uniform Magnetic Field (UMF)¶
1 2 | |
Tip
Ensure to account for magnitude when determining the field vector.
Example
1 2 | |
Uniform Electric Field (UEF)¶
1 2 | |
Tip
Ensure to account for magnitude when determining the field vector.
Example
1 2 | |
Static Point Charge (SPC)¶
Definition of a SPC is similar to a particle, but does not include velocity or mass.
1 2 3 | |
Example
1 2 3 | |
Sectioned Uniform Fields¶
Uniform fields can be restricted to a section in space. These are called sectioned uniform fields.
For the moment, the spaces are computed based on the larges rectangular prism formed by the corners, but this will be updated to work for more complex 3D shapes.
Sectioned Uniform Magnetic Field (SUMF)¶
1 2 3 | |
Example
1 2 3 4 5 6 7 8 9 10 | |
Sectioned Uniform Electric Field (SUEF)¶
Info
Coming soon!
1 2 3 | |
Example
1 2 3 4 5 6 7 8 9 10 | |
Animation¶
Display configurations¶
There exist additional animation settings available in the scene.py file in the ./animation folder. Some familiarity with Manim Community may be useful.
User configuration is found under the # Simulation configuration and settings comment at the top of the plot_particle_path class and other scene classes.
The start of each animation begins with an optional presentation of the objects. The code will read the config file and display the object settings two by two, although this will cause the animation to take longer.
This can be toggled on and off by changing output_ctxt to output_ctxt = True and vice-versa.
When uniform fields are added, field vectors can be shown (blue for magnetic and orange for electric).
This can be toggled on and off my changing show_vecs and the scale of the vectors can be adjusted via vector_scale.
By default, the object presentation is switched off and the vectors are displayed with 0.2 scale.
High-quality rendering¶
For higher quality rendering, consult Manim Community's documentation. You can run the generic command:
1 | |
After running make and updating config.txt, you will need to run the execuatable ./compiled_files/compiled_solver.
Then, if you are running a Lorentz Motion simulation, run the command:
1 | |
For a \(\vec{B}\) Field simulation, run:
1 | |