SkillAgentSearch skills...

Glimy

Computational Electromagnetics Framework

Install / Use

/learn @alihakimtaskiran/Glimy

README

Glimy

FDTD Simulator

<img src="https://github.com/alihakimtaskiran/Glimy-FDTD/raw/main/src/logo.png" width="200"></img>

The electromagnetic field.. Interacts with our reality and the reason that we continue to live. We can live beter, if we know time evolution of electromagnetic field. Moreover, Glimy can simulate behaviour of light near massive objects(i.e neutron stars, blackholes). It utilizes VSL Theory of Mach-Einstein-Dicke. Glimy can simulate photonic devices with varying refractive index through time.

CPU-only

<pre> pip install glimy </pre>

GPU-enabled

Make sure that Nvidia drivers and CUDA are successfully installed. Then proceed with installing cupy.

See GPU usage example

<pre> pip install cupy # See https://docs.cupy.dev/en/stable/install.html#installing-cupy for more information pip install glimy </pre>

Capabilities

  • GPU Support(install cupy to access GPU resources)
  • Electromagnetic waves in dielectric and magnetic materials.
  • Gravitational effect on electromagnetism
  • Anisotropic materials
  • Lossy medium and conductive materials(both electric and magnetic)
  • Objects can be inserted and omitted through the time
  • Can be integrated into GPT-4

Strong Gravitational Potential

Waveguide Example:

<hr/>

Anisotropic Medium

<img src="https://github.com/alihakimtaskiran/Glimy-FDTD/raw/main/src/7.png" width="400"> <img src="https://github.com/alihakimtaskiran/Glimy-FDTD/raw/main/src/8.png" width="600">

Conductive Medium

<img src="https://github.com/alihakimtaskiran/Glimy-FDTD/raw/main/src/10.png" width="300"> <img src="https://github.com/alihakimtaskiran/Glimy-FDTD/raw/main/src/11.png" width="300"> <img src="https://github.com/alihakimtaskiran/Glimy-FDTD/raw/main/src/12.png" width="300">

<hr>

Tree

<pre> |----Continuum(object)----| | |---__init__(grid_size,ds) | |---add(arg) | |---export_grid() | |---export_field() | |---build(verbose=1,gpu_flag=False) | |---impose_grid(e,mu,sigma=False,sigma_m=False,anisotropy=(False,False)) | |---view_(field="t",*args,colorbar=True) | |---view_structure(field="e",*args,colorbar=True) | |---view_field(field="E",*args,colorbar=True) | |---Render(time_steps,backend="numpy",observers=None) | | |----DotSource(object)----| | |---__init__(location,presence,amplitude,frequency,phase=0) | |---__repr__() | |---inf() | | |----Boundaries(object)----| | |---__init__(subject_grid_dim, all_bound="ABC") | |---L(boundary_type="ABC") | |---R(boundary_type="ABC") | |---B(boundary_type="ABC") | |---F(boundary_type="ABC") | |---D(boundary_type="ABC") | |---U(boundary_type="ABC") | | | |----geo(module)--------| |----SingularCelestial(object)----| | |---__init__(location,mass) | |---export() | |---dimensionality() | |---__repr__() | | |----MassiveCluster(object)-------| | |---__init__(objects,volatile=False) | |---add(arg) | |---content() | |---dimensionality() | |---__repr__() | | |----PointCloud(object)-----------| | |---__init__(points,layer=0,e=1,mu=1,sigma=0,sigma_m=0,time=None) | | |----Rectangle(PointCloud)--------| | |---__init__(A,B,layer=0,e=1,mu=1,sigma=0,sigma_m=0,time=None) | | |----RectPrism(PointCloud)--------| | |---__init__(A,B,layer=0,e=1,mu=1,sigma=0,sigma_m=0,time=None) | | |----Circle(object)---------------| | |---__init__(A,r,layer=0,e=1,mu=1,sigma=0,sigma_m=0,time=None) | | |----Sphere(object)---------------| | |---__init__(A,r,layer=0,e=1,mu=1,sigma=0,sigma_m=0,time=None) | | |----Cylinder(object)-------------| |---__init__(A,r,h,layer=0,e=1,mu=1,sigma=0,sigma_m=0,time=None) </pre>

Documentation

<hr/>

Continuum(grid_size,ds)

Creates electromagnetic field with given dimensions and grid size. Grid spacing is introduced with ds.

  • grid_size : Defines grid cell count per axis. It may take a tuple or list. It's 2D or 3D.
  • ds : Length of a edge of a grid cell. It may take a float or integer. All units are SI.

add(arg)

Adds either new geometries, celestial objects and sources into the Continuum.

  • arg : It adds new objects into the grid. It can take either defined object or list/tuple of them(recursively). It can take tuple, list, set, everything in geo(geo.*) and DotSource. As long as dimensionality of object and Continuum is the same, it is added.

build(verbose=1, gpu_flag=False)

Builds the dielectric, magnetic and geometrodynamic structure.

  • verbose: Determines whether info is displayed. If 0, nothing displayed. If 1, render time is displayed.
  • gpu_flag: Determines whether the grid is compiled for GPU.

export_field()

Get Electric and Magnetic Field arrays. It returns a tuple (E, H).

export_grid()

Get permittivity and permeability arrays. It returns a tuple (e, mu).

impose_grid(e,mu,sigma=False,sigma_m=False,anisotropy=(False,False))

Embed the electromagnetic grid - generated by other sources -. It is useful for fetching electromagnetic material structure from any optimization algorithm and examining it's electromagnetic properties with glimy.

  • e: Epsilon of each point of the grid. Shape of the array is (Nx, Ny,...) in isotropic media; (3,Nx,Ny,Nz) in anisotopic media.
  • mu: Mu of each point of the grid. Shape of the array is (Nx, Ny,...) in isotropic media; (3,Nx,Ny,Nz) in anisotopic media.
  • sigma: Sigma of each point of the grid. Shape of the array is (Nx, Ny,...). If there is no conductivity, it is False
  • sigma_m: Sigma_m of each point of the grid. Shape of the array is (Nx, Ny,...). If there is no magnetic conductivity, it is False
  • anisotropy: Specifies anisotropy of e and mu respectively.e.g (True, False).

view_structure(field="e",*args,colorbar=True)

You can view the grid structure

  • field : It takes "e" for permittivity array, "mu" for permeability array, "sigma" for conductivity array, "sigma_m" for magnetic conductivity array and "Z" for impedance of the grid.
  • *args : Only used in 3D. It used specify axis of view. Plane and and index number can be inserted. For example "z", 10 corresponds z=10 plane in the 3D array. "x","y","z" can be inserted. Also "yz", "xz", "xy" are synonym respectively.
  • colorbar: If is is set to True, colorbar is displayed.

view_field(field="E",*args,colorbar=True)

You can get graph of Electric or Magnetic Field.

  • field : It takes "E" for electric field, "H" or magnetic field and "J" for current density field.
  • *args : Only used in 3D. It used specify axis of view. Plane and and index number can be inserted. For example "z", 10 corresponds z=10 plane in the 3D array. "x","y","z" can be inserted. Also "yz", "xz", "xy" are synonym respectively.
  • colorbar: If is is set to True, colorbar is displayed.

view_metric(field="t",*args,colorbar=True)

You can view geometrodynamic curvature due to the massive objects in the grid.

  • field : It takes "t" for curvatures in time. No other grids are not compatible yet.
  • *args : Only used in 3D. It used specify axis of view. Plane and and index number can be inserted. For example "z", 10 corresponds z=10 plane in the 3D array. "x","y","z" can be inserted. Also "yz", "xz", "xy" are synonym respectively.
  • colorbar: If is is set to True, colorbar is displayed.

Render(time_steps,backend="numpy",observers=None)

Executes FDTD calculations on a Continuum object.

  • time_steps : It is number of time steps that field will evolve. It may take an integer. Len
View on GitHub
GitHub Stars16
CategoryDevelopment
Updated5mo ago
Forks2

Languages

Python

Security Score

92/100

Audited on Oct 14, 2025

No findings