Skip to main content

No project description provided

Project description

E-Simulator Package

This is a small library designed to provide a useful tool for simulating the trajectories of a charged particle in an electromagnetic field. The motion of the particles is computed using the 4th-order Runge-Kutta method and relativistic physics, ensuring high accuracy in simulations at both low and high velocities.

Table of Contents

Install

The package can be easily installed using pip.

pip install e-simulator

Usage

For a more detailed explanation of the package and its usage, please refer to the quick-guide.

Below is a simple example. First, we need to import the package.

import e_simulator as es

Then, we create a new Project object.

project = es.Project(
    name = 'Sample Project',
)

Next, we set the project's system by adding boundary, particle, and electromagnetic regions.

# Set polygon boundary
project.set_bounds(
    es.PolygonGeometry.simple_construct(
        tuples = [(0, 0), (0, 100), (100, 100), (100, 0)]
    )
)

# Set particle
project.set_particle(
    es.Particle(
        mass = 1,
        charge = 1,
        init_position = es.Coordinate(1, 1),
        init_velocity = es.Coordinate(2, 2)
    )
)

# Set electromagnetic regions
project.set_em_regions([
    es.EMRegion( 
        em_field = es.StaticEMField(electric=es.Vector(1, 0), magnetic=5),
        geometry = es.PolygonGeometry.simple_construct(
            tuples = [(10, 10), (10, 20), (20, 20), (20, 10)]
        )
    ), 
])

Finally, we can run the simulation and view the result.

# Run simulation
project.simulate(
    max_s = 100,
    max_t = 50,
)

# View the result in a DataFrame
project.simulate_data_to_df()

We also can plot the orbit of the particle.

import matplotlib.pyplot as plt

# Create a visualizer
visualizer = es.Visualizer(project)

fig, ax = plt.subplots()
visualizer.plot_simulation(ax)
plt.show()

Contribute

If you've encountered a bug or want to contribute by helping fix one, your involvement is highly appreciated! You can contact me directly through luongdoan000@gmail.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

e_simulator-0.1.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

e_simulator-0.1.1-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file e_simulator-0.1.1.tar.gz.

File metadata

  • Download URL: e_simulator-0.1.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.11 Windows/10

File hashes

Hashes for e_simulator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7579bce63c6ef9411f57408da4834b602ce6bc85eb74770791875def7ba906ff
MD5 dbb1680c78fc78e4d9679a135c875420
BLAKE2b-256 4476b9985bc94e5725816e1ab62ce0f3d89ea41c85bbf49c8175c22e8b974947

See more details on using hashes here.

File details

Details for the file e_simulator-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: e_simulator-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.11 Windows/10

File hashes

Hashes for e_simulator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3eff27d254d109d1e912a85967c4bee9e5bbbc4745d7bdebcc18a9267539b848
MD5 6e0fe8cdb502e4941735d21805cf5949
BLAKE2b-256 e338472ef5a33ff0319e8930532ca514cac9c0f3cd840c890ffcc44e66e2b126

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page