Contents
Maxwell's Equations
Maxwell's equations are a set of differential equations that describe how electric and magnetic fields are generated by charges and currents. The governing equations with excitation sources are described as follows:
$$
\begin{split}
\nabla\times E&=-\mu \dfrac{\partial H}{\partial t},\
\nabla\times H&=\epsilon \dfrac{\partial E}{\partial t} + \sigma E + J,
\end{split}
$$
where $\epsilon,\mu, \sigma$ are permittivity, permeability and conductivity of the material respectively. $J$ represents a known excitation source function. Common excitation sources include point source, line source and area source. In this tutorial, the soft voltage sources attached on the lines are considered, of which can be expressed as follows:
$$
J(x, y, z, t)=\delta(x - x_0, y - y_0, z - z_0)f(t)
$$
AD-FDTD-Based Solver for the Electromagnetic Forward Problems
Finite-Difference Time-Domain (FDTD) method, which is widely used in solving Maxwell's equations, is equivalent to a recurrent convolution neural network (RCNN). Without loss of generality, the TM-mode 2-D FDTD is taken for example. When using CFS-PML to truncate the solution domain, the updating process at the $n$th time step in the TM-mode 2-D FDTD method is as follows:
Using the differentiable operators in MindSpore, it is quite straightforward to implement an end-to-end automatically differentiable FDTD (AD-FDTD) solver. Because the AD-FDTD is exactly the strict numerical discretization of Maxwell's equations, the accuracy is the same as the traditional FDTD solvers.
Datasets
- Evaluation data: The S parameters of the invert-F antenna and the microstrip low-pass filter extracted from the reference.
Environment Requirements
- Hardware (CPU/GPU)
- Prepare the CPU/GPU to set up the hardware environment.
- Framework
- For more information, see the following resources:
Script Description
Script and Sample Code
└─AD_FDTD
├─README.md
├─docs # schematic diagram of README
├─src
├──constants.py # physical constants
├──antenna.py # class for antenna modeling
├──grid_helper.py # helper class for modeling
├──lumped_element.py # classes for lumped elements
├──full3d.py # 3D AD-FDTD
├──cfs_pml.py # CFS-PML boundary condition
├──waveforms.py # time-domain waveforms
├──utils.py # utility functions
├──polts.py # functions to visualize the results
├──solver.py # ADFDTD-based solver
├─dataset # pre-computed label data
├─solve_invert_f.py # script to compute S11 of the Invert-F antenna
├─solve_microstrip_filter.py # script to compute S11 and S21 of the Microstrip Filter
Script Parameters
The control parameters are set in the solve_invert_f.py
(or solve_microstrip_filter.py
) file as follows:
"device_target": "GPU", # device name
"nt": 3000, # number of time steps
"max_call_depth": 1000, # limitation for maximum call depth
"dataset_dir": "./dataset", # path of dataset directory
"result_dir": "./result", # path to save the results
"cfl_number": 0.9, # CFL number
"fmax": 10e9, # maximum frequency (Hz)
Solving
You can start computing S parameters of the invert-F antenna or the microstrip filter by running solve_invert_f.py
or solve_microstrip_filter.py
as follows:
python solve_invert_f.py --device_target 'GPU'
or
python solve_microstrip_filter.py --device_target 'GPU'
Evaluation
After solving the problem, the script will automatically compare the simulated results with the reference data.
The calculated S11 parameters of the invert-F antenna are shown in the following figure.
The calculated S11 and S21 parameters of the microstrip filter are shown in the following figure.
MindScience Home Page
Visit the official website home page.