Defining a 3D Plane Source
See original GitHub issueI’m trying to define a plane source such that it outputs a plane wave, but I’m getting some odd-looking outputs. The following code seems to produce some pretty heavy fringes of some sort. Any thoughts? Ideally it would produce a smooth plane wave.
Thanks!
import matplotlib.pyplot as plt
import fdtd
import fdtd.backend as bd
import numpy as np
import torch
import torch.autograd
import torch.nn
fdtd.set_backend("torch.cuda")
WAVELENGTH = 1550e-9
SPEED_LIGHT: float = 299_792_458.0 # [m/s] speed of light
grid = fdtd.Grid(
(2.5e-5, 2.5e-5, 1.5e-5),
# (161,161,97),
grid_spacing=0.1 * WAVELENGTH,
permittivity=1.0,
permeability=1.0,
# courant_number=0.3
)
grid[0, :, :] = fdtd.PeriodicBoundary(name="xbounds")
# grid[0:10, :, :] = fdtd.PML(name="pml_xlow")
# grid[-10:, :, :] = fdtd.PML(name="pml_xhigh")
grid[:, :, 0:10] = fdtd.PML(name="pml_zlow")
grid[:, :, -10:] = fdtd.PML(name="pml_zhigh")
grid[:, 0, :] = fdtd.PeriodicBoundary(name="ybounds")
grid[2:160,2:160,30:31] = fdtd.PlaneSource(
period=WAVELENGTH / SPEED_LIGHT, name="linesource"
)
grid.run(300)
grid.visualize(z=80,show=True)
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
3D Coordinate Geometry - Equation of a Plane - Brilliant
A plane in 3D coordinate space is determined by a point and a vector that is perpendicular to the plane. This wiki page...
Read more >Plane Equation - Song Ho Ahn
The equation of a plane in 3D space is defined with normal vector (perpendicular to the plane) and a known point on the...
Read more >1.4: Equations of Planes in 3d - Mathematics LibreTexts
Specifying one point (x0,y0,z0) on a plane and a vector d parallel to the plane does not uniquely determine the plane, because it...
Read more >Equations of Planes in 3d
Section 1.4 Equations of Planes in 3d. Specifying one point \((x_0,y_0,z_0)\) on a plane and a vector \(\vd\) parallel to the plane does...
Read more >Lines & Planes in 3D-Space: Definition, Formula & Examples
Lines and planes both exist in three-dimensional spaces calculated using vector equations. Explore several examples of how these two ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Figured it out. A plane source at z=N outputs the wrong polarization, which doesn’t propagate. Changing it to something transverse solves the problem. Also there should probably be GaussianPlaneSource and UniformPlaneSource methods to reduce ambiguity. For line sources as well. I’ll see if I can knock together a PR. 😃
@CharlesDove , If you have the time, would you be willing to create a PR with your fix?