Computational Electromagnetics Package with Dielectic, Magnetic, Anisotropic, Lossy Materials and Gravity
Project description
Glimy
FDTD Simulator
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
pip install glimy
GPU-only
Make sure that Nvidia drivers and CUDA is successfully installed. Then proceed with installing cupy.
See
pip install cupy # See https://docs.cupy.dev/en/stable/install.html#installing-cupy for more information pip install glimy
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
:
Tree
|----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)
Documentation
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. Lenght of time steps is given by ds/c/(√dim) ; where ds is grid spacing, c is speed of light and dim is number of dimensions of the grid. All units are SI.
- backend : It sets the backend. For CPU-only version, use backend="numpy". IF GPU is enabled, then use backend=cupy. Make sure that the Continuum instance was built with gpu_flag=1 for accessing GPU acceleration.
- observers : Determines whether time dependent logging will be the case. If it is set to
None
, time dependent observation is not the case. However, it is a tuple or list of points e.g[ (0,0), (2,2) ]
then it returns E-field amplitude of each given point. Returned array's order is the same as implicit order of the fed list/tuple.
DotSource(location,presence,amplitude,frequency,phase=0)
Creates a point source on a given place on grid, through given time interval with given amplitude, frequency and phase.
- location : It is location of dot source. It may take a list or tuple.
- presence : It is a tuple or list in the form of:( start, stop ). It defines in which time step dot source emits electromagnetic wave.
- amplitude : Amplitude of the wave. It may take int or float.
- frequency : Frequency of the wave. It may take int or float.
- phase : Phase of the wave. It may take int or float. It is default 0.
Boundaries(subject_grid_dim, all_bound="ABC")
The Boundaries class allows users to define boundary conditions for the grid in 2D or 3D space. There are two supported boundary types: PEC (Perfect Electric Conductor): Reflects all waves perfectly ABC (Absorbing Boundary Conditions): Absorbs all waves
- L(self, boundary_type="ABC"): Sets the left boundary condition.
- R(self, boundary_type="ABC"): Sets the right boundary condition.
- B(self, boundary_type="ABC"): Sets the backward boundary condition.
- F(self, boundary_type="ABC"): Sets the forward boundary condition.
- D(self, boundary_type="ABC"): Sets the down boundary condition (for 3D grids only).
- U(self, boundary_type="ABC"): Sets the up boundary condition (for 3D grids only). A short example:
boundaries = Boundaries(3) # Creates a 3D grid with default ABC boundaries
boundaries.L("PEC") # Sets the left boundary to PEC
boundaries.R("PEC") # Sets the right boundary to PEC
geo.SingularCelestial(location, mass):
Creates a point mass.
- location : Sets the location of point mass. Unit is meters. It may take tuple, list or np.array. It must bu in form of N-tuple. It may be outside of the grid.
- mass : Stest the mass of the object. Unit is kg. It may take float ot int.
geo.MassiveCluster(objects,volatile=False)
Creates cluster of massive objects. It is used to integrate so many heavy objects.
- objects : geo.Singular object or tuple/list/set of them
- volatile : If it is set
False
, any new object can't be added. If it isTrue
, new objects can be added.
add(arg)
Adds a new geo.Singular object or tuple/list/set of them. If MassiveCluster is volatile, anything can't be added.
- arg : geo.Singular object or tuple/list/set of them.
geo.PointCloud(points,layer=0,e=1,mu=1,sigma=0,sigma_m=0,time=None)
Creates a point cloud object in 2D or 3D. It infills inside the points. It is compatible with convex hull. Draw miscallenious objects(i.e. hexagon,star, hearth) with it.
- points : Points that defines convex full. It is a list, tuple or array of 2D or 3D points. Coordinates indicates # of cell in the grid. Like [(1,2), (2,3), (3,4)]. I needs at least 3 points in 2D, 4 points in 3D.
- layer : Priority of the object. It is an integer. The less layer value, the more prior the object. It is useful where you want to design object are overlapping like open access cavity dielectric waveguides.
- e : Relative permittivity of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally, for researching Cherenkov Radiation, metamaterials etc.
- mu : Relative permeability of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally.
- sigma : Conductivity of the object. It may take float or int.
- sigma_m : Magnetic conductivity of the object. It may take float or int.
- time : It determines in which time the object is seen and dissappear. If the object is eternal,
time=None
; otherwisetime=(start, stop)
, it is a list/tuple of start and stop durations
geo.Rectangle(A, B, layer, e=1, mu=1, sigma=0,sigma_m=0, time=None)
Creates a rectangle in 2D.
- A: One of non-connected vertex of the Rectangle. It may take an integer. All units are # of grid cells.
- B: One of non-connected vertex of the Rectangle. It may take an integer. All units are # of grid cells.
- layer : Priority of the object. It is an integer and maximum can take 1000. The less layer value, the more prior the object. It is useful where you want to design object are overlapping like open access cavity dielectric waveguides.
- e : Relative permittivity of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally, for researching Cherenkov Radiation, metamaterials etc.
- mu : Relative permeability of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally.
- sigma : Conductivity of the object. It may take float or int.
- sigma_m : Magnetic conductivity of the object. It may take float or int.
- time : It determines in which time the object is seen and dissappear. If the object is eternal,
time=None
; otherwisetime=(start, stop)
, it is a list/tuple of start and stop durations
geo.Circle(A,r,layer,e=1,mu=1,sigma=0,sigma_m=0, time=None)
Creates a circle in 2D.
- A : Coordinates of center of the Circle. It may take a tuple or list. All units are # of grid cells.
- r : Radius of the circle. It may take an integer. All units are # of grid cells.
- layer : Priority of the object. It is an integer and maximum can take 1000. The less layer value, the more prior the object. It is useful where you want to design object are overlapping like open access cavity dielectric waveguides.
- e : Relative permittivity of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally, for researching Cherenkov Radiation, metamaterials etc.
- mu : Relative permeability of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally.
- sigma : Conductivity of the object. It may take float or int.
- sigma_m : Magnetic conductivity of the object. It may take float or int.
- time : It determines in which time the object is seen and dissappear. If the object is eternal,
time=None
; otherwisetime=(start, stop)
, it is a list/tuple of start and stop durations
geo.RectPrism(A, B, layer, e=1, mu=1,sigma=0,sigma_m=0, time=None)
Creates a rectangular prism in 3D.
- A: One of non-connected vertex of the RectPrism. It may take an integer. All units are # of grid cells.
- B: One of non-connected vertex of the RectPrism. It may take an integer. All units are # of grid cells.
- layer : Priority of the object. It is an integer and maximum can take 1000. The less layer value, the more prior the object. It is useful where you want to design object are overlapping like open access cavity dielectric waveguides.
- e : Relative permittivity of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally, for researching Cherenkov Radiation, metamaterials etc.
- mu : Relative permeability of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally.
- sigma : Conductivity of the object. It may take float or int.
- sigma_m : Magnetic conductivity of the object. It may take float or int.
- time : It determines in which time the object is seen and dissappear. If the object is eternal,
time=None
; otherwisetime=(start, stop)
, it is a list/tuple of start and stop durations
geo.Sphere(C,r,layer=0,e=1,mu=1,sigma=0,sigma_m=0, time=None)
Creates a sphere in 3D.
- C : Coordinates of center of the Sphere. It may take a tuple or list. All units are # of grid cells.
- r : Radius of the sphere. It may take an integer. All units are # of grid cells.
- layer : Priority of the object. It is an integer and maximum can take 1000. The less layer value, the more prior the object. It is useful where you want to design object are overlapping like open access cavity dielectric waveguides.
- e : Relative permittivity of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally, for researching Cherenkov Radiation, metamaterials etc.
- mu : Relative permeability of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally.
- sigma : Conductivity of the object. It may take float or int.
- sigma_m : Magnetic conductivity of the object. It may take float or int.
- time : It determines in which time the object is seen and dissappear. If the object is eternal,
time=None
; otherwisetime=(start, stop)
, it is a list/tuple of start and stop durations
geo.Cylinder(C,r,h,layer=0,e=1,mu=1,sigma=0,sigma_m=0, time=None)
Creates a cylinder in 3D. Its planes are parallel to xy-plane
- C : Coordinates of center of the Cylinder. It may take a tuple or list. All units are # of grid cells. Height signifies elongation though z axis.
- r : Radius of the Cylinder. It may take an integer. All units are # of grid cells.
- h : Height of the Cylinder. It may take an integer. All units are # of grid cells.
- layer : Priority of the object. It is an integer and maximum can take 1000. The less layer value, the more prior the object. It is useful where you want to design object are overlapping like open access cavity dielectric waveguides.
- e : Relative permittivity of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally, for researching Cherenkov Radiation, metamaterials etc.
- mu : Relative permeability of the object. It may take float ot int for isotropic materials, 3×3 array/list/tuple for anisotropic materials. It is not restricted to be less than 1 intentionally.
- sigma : Conductivity of the object. It may take float or int.
- sigma_m : Magnetic conductivity of the object. It may take float or int.
- time : It determines in which time the object is seen and dissappear. If the object is eternal,
time=None
; otherwisetime=(start, stop)
, it is a list/tuple of start and stop durations.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file glimy-5.0.1.tar.gz
.
File metadata
- Download URL: glimy-5.0.1.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c4d1e08786341c4f299f63ff7201e32d7706585b8fed11ae267acf5b0b21ec4 |
|
MD5 | 287500e7a5739d12305082c8cffffa74 |
|
BLAKE2b-256 | a6a490cf6df58d894e3fa50721321c22789c919213e29e234cb11b586c950eb0 |
File details
Details for the file glimy-5.0.1-py3-none-any.whl
.
File metadata
- Download URL: glimy-5.0.1-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9017786677b6d43a6968f99999850b0e773c627c93be0c6ea1e18013d63ee8ba |
|
MD5 | ed534367db65f4208079496f65697bea |
|
BLAKE2b-256 | ee3d66752382b2679cc27c0436074115709d631bf63e68d164611bedc6089fbf |