Giter VIP home page Giter VIP logo

fdtd.py's Introduction

PyPI license PyPI pyversions PyPI version shields.io Build Status DeepSource codecov Documentation Status DOI

FDTD Framework for Electromagnetic Simulations

Installation:

pip install fdtd.py

Example:

"""Voltage source + resistor example."""

from fdtd import Brick, Grid, Material, Resistor, SineWaveform
from fdtd import VoltageSource as VSource
from fdtd import VoltageDetector as VDetector

print("Loading materials...")
Material.load("materials.json")

print("Creating grid...")
grid = Grid(shape=(10, 10, 10), spacing=1e-3, courant_factor=0.9)

print("Creating objects...")
brick1 = Brick(*(4e-3, 2e-3, 8e-3), *(6e-3, 8e-3, 8e-3), "PEC")
brick2 = Brick(*(4e-3, 2e-3, 4e-3), *(6e-3, 8e-3, 4e-3), "PEC")
v_source = VSource(*(4e-3, 2e-3, 4e-3),
                   *(6e-3, 2e-3, 8e-3),
                   waveform=SineWaveform(frequency=1e9),
                   resistance=50)
resistor = Resistor(*(4e-3, 8e-3, 4e-3), *(6e-3, 8e-3, 8e-3), 50)
v_detector = VDetector(*(4e-3, 5e-3, 4e-3),
                             *(6e-3, 5e-3, 8e-3),
                             plot=True)

print("Adding components to grid...")
components = [brick1, brick2, v_source, resistor, v_detector]
for comp in components:
    grid.add(comp)

print("Running simulation...")
grid.run(n_steps=5000)
grid.plot_3d()

References

[1] A. Z. Elsherbeni and V. Demir, The finite-difference time-domain: method for electromagnetics with MATLAB simulations, 2nd Edition. Edison, NJ: SciTech Publishing, an imprint of the IET, 2016.

fdtd.py's People

Contributors

tiagovla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.