/EM-Scattering-1

2D FDTD Scattering of EM waves on dielectric objects.

Primary LanguagePythonMIT LicenseMIT

Scattering from Dielectric Objects with FDTD

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

Finite-Difference Time-Domain (FDTD) is a numerical analysis technique to approximate the solutions of Maxwell's differential equations at discrete points in space in the time domain.

This repository contains an implementation of this technique in a 2D PEC bounded enclosure through which the scattering of EM waves from dielectric objects can be investigated.

Discretrization

Given the above situation, the discretized update equations are given by:

image-20210201124523331

Where E describes the electric field, H the magnetic field and I the current strength of a point source in the enclosure. These equations are implemented in the FDTD function in space.py.

The work results from a collaborative project by Paul De Smul, Thijs Paelman and Flor Sanders in the context of the Applied Electromagnetism course at Ghent University.

Built With

This section should list any major frameworks that you built your project using. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.

Getting Started

Prerequisites

Installation of the Python libraries used in the project.

  • Pip

    pip3 install numpy scipy matplotlib
  • Conda

    conda install numpy scipy matplotlib

Installation

  1. Clone the repo
    git clone https://github.com/FlorSanders/EM_Scattering.git
  2. Change directory into the project folder
    cd EM_Scattering

Usage

The code can be used in two ways. The method for starting a simulation in either case is described in the subsections below. At the start of the simulation, a visualization of the space and its parameters is given.

halfspace_viz

When this figure is closed, the computation starts. If this option is enabled, the script will sporadically give a visualization of the field amplitudes.

Amplitude_H-t_2e-09_s$

When the computations are finished, plots will be generated of the field values at the different measurement points.

![E_zTransmitted field](README.assets/E_zTransmitted field.png)

![H_xyTransmitted field](README.assets/H_xyTransmitted field.png)

All the figures generated during simulation are automatically saved in the plots folder.

Command Line Interface

The command line interface allows you to quickly run a simulation with a configuration of your choice. The usage is as follows:

  1. Launch python3 main.py.

  2. Enter the dimensions of the simulation domain: width, height and duration.

  3. Enter the parameters of the dielectrics in the domain, according to the convention below.

    image-20210201140856097

  4. Indicate whether the dielectric constant should be aliased or not.

  5. Pick the position and current profile (Gaussian pulse / Gaussian modulated sinusoidal RF pulse).

  6. Choose the space discretization size. A recommended range is offered as indication.

  7. Choose the time step size. As an indication, the Courant limit (upper boundary) is given.

  8. Set the locations for the points for which plots have to be made of the field values.

  9. Indicate whether visualizations have to be made while the script is running.

Python Script

For more repeatable experiments or more complex setups, a Python script can be written through which the desired configurations can be described. For your convenience, some examples are included in the project files.

  • test_simple.py: Simple situation with a half-space filled with a dielectric and the other left vacuum, as visualized at the top of the usage section.
  • test_time.py: Time the duration of computation for different values of the speedup factor.
  • test_T_coefficients: Investigate the influence of the dielectric contrast between two materials on transmission of the waves. E_z_t_eps_r
  • test_pec.py: Runs the simulation for a duration that shows the reflected waves as a consequence of the boundaries being made of perfect electrically conducting (PEC) materials. PEC_E_z
  • test_hankel.py: Compares the results from the simulation to the spectrum theoretically obtained from a line source: the Hankel function. em_abs_hankel
  • test_courant.py: Runs the simulation with a time step size larger than the Courant limit, showing the system becomes unstable when doing so. courant_lin

For more details, please refer to the project report.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Flor Sanders - @FlorPSanders - me@florsanders.be Thijs Paelman Paul De Smul

Project Link: https://github.com/FlorSanders/EM_Scattering