New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GSoC 2023] Implementing a discrete plane wave source #373
Open
AdittyaPal
wants to merge
18
commits into
gprMax:devel
Choose a base branch
from
AdittyaPal:devel
base: devel
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Renamed the conda environment.
Changed the scripts to fit in as much as possible into the standard gprMax framework. It should work save a few glitches here and there.
AdittyaPal
commented
Aug 28, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look sufficient to introduce multiple plane waves in the TF region with minimal leakage in the SF region. I hope it does not break some existing feature of gprMax.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Figure: Waterfall plots of the six auxiliary one-dimensional arrays for the discrete plane wave.
Problem Description
The objective of the project was to implement a discrete plane wave source in gprMax as described in T. Tan and M. Potter, FDTD Discrete Planewave (FDTD-DPW) Formulation for a Perfectly Matched Source in TFSF Simulations, in IEEE Transactions on Antennas and Propagation, vol. 58, no. 8, pp. 2641-2648, Aug. 2010, doi: 10.1109/TAP.2010.2050446. Plane wave sources are a useful tool in multiple different scenarios of electromagnetic simulations, especially when the wave is emitted by a source that is quite far away from the target or maybe even multiple targets. Such a source was not formulated in the current version of gprMax used. This pull request is the work done to implement the idea, that has been shown to work in a MATLAB script, and place it in a much larger environment of gprMax, in Python, blending it seamlessly with the other sources available in gprMax.
Deliverables
Implementation Structure
The plane wave source can be added in the Python API with the creation of an object of the class DiscretePlaneWave() as
plWave = gprMax.DiscretePlaneWave(p1 = (0.010, 0.010, 0.010), p2=(0.040, 0.040, 0.040), psi = 90.0, phi = 63.4, delta_phi = 2.0, theta = 36.7, delta_theta = 1.0, waveform_id = "mypulse")
The parameters p1 and p2 specify the start vertex and the end vertex of the TFSF box, while \psi specifies the polarization, and \phi, \theta specify the orientation of the wave in the TFSF box (in polar coordinates). The waveform_id must match one of the ids of the waveforms initialized. delta_phi, delta_theta are optional parameters to determine how close to the requested phi and theta values the user would like to approximate the rational angles to. There are additional optional parameters, start and stop to control when the place wave source is added and removed from the TFSF box. Lastly, there is a material_id to specify the background medium in the TFSF box where the plane wave propagates. Or alternatively a hash command might be specified
#discrete_plane_wave: 0.010 0.010 0.010 0.040 0.040 0.040 90.0 63.4 36.7 mypulse
with the order of the parameters p1, p2, psi, phi, theta, waveform_id.
Additionally options might be specified in update_magnetic_sources() whether to use the cythonized version of the code or the python version, and whether to precompute the fields values for the sources or compute them on the fly. The workflow roughly follows the scheme:
The appropriate fields from these auxiliary one-dimensional arrays are placed in on the interface of the total field/scattered field region of the regular three-dimensional FDTD grids in the same iteration of the time stepping loop.
Type of change
Checklist:
Future Scope
Currently there is the provision of introducing the plane wave from the direction of the origin only, if the Total field/scattered field box is considered to be present in the first octant (the region in the coordinate space determined by the positive x-axis, positive y-axis and positive z-axis). The implementation should ideally be able to handle the introduction of the plane wave from any direction but currently it supports 0 <= phi <= 90 degrees and 0 <= theta <= 90 degrees only. It might be able to generalize the souring angle in future improvements of the feature.
ATTACH SCREEN-SHOTS
Figure: Progression of the electric fields with time for the discrete plane wave (the fields are plotted in the order E_x, E_y, E_z, constant x section, constant y section, constant z section).