forked from ECP-WarpX/WarpX
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from RevathiJambunathan/HSdevmerge_240304
HSdevmerge 240304
- Loading branch information
Showing
84 changed files
with
1,083 additions
and
663 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
41 changes: 41 additions & 0 deletions
41
Examples/Tests/embedded_boundary_diffraction/analysis_fields.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
This test checks the implementation of the embedded boundary in cylindrical geometry, | ||
by checking the diffraction of a laser by an embedded boundary here. | ||
We then check that the first minimum of the diffracted intensity pattern | ||
occurs along the angle given by the theoretical Airy pattern, i.e. | ||
theta_diffraction = 1.22 * lambda / d | ||
""" | ||
import os | ||
import sys | ||
|
||
import numpy as np | ||
from openpmd_viewer import OpenPMDTimeSeries | ||
from scipy.ndimage import gaussian_filter1d | ||
|
||
sys.path.insert(1, '../../../../warpx/Regression/Checksum/') | ||
import checksumAPI | ||
|
||
ts = OpenPMDTimeSeries('./EmbeddedBoundaryDiffraction_plt/') | ||
|
||
# Extract the intensity as a function of r and z | ||
Ex, info = ts.get_field('E', 'x', iteration=300) | ||
I = gaussian_filter1d(Ex**2, sigma=5, axis=0) # Extract intensity by averaging E^2 over wavelength | ||
irmax = np.argmax( I, axis=-1) | ||
|
||
# Find the radius of the first minimum, as a function of z | ||
def r_first_minimum(iz): | ||
ir = len(info.r)//2 | ||
while I[iz, ir+1] < I[iz, ir]: | ||
ir += 1 | ||
return info.r[ir] | ||
r = np.array([ r_first_minimum(iz) for iz in range(len(info.z)) ]) | ||
|
||
# Check that this corresponds to the prediction from the Airy pattern | ||
theta_diffraction = np.arcsin(1.22*0.1/0.4)/2 | ||
assert np.all( abs(r[50:] - theta_diffraction*info.z[50:]) < 0.03 ) | ||
|
||
# Open the right plot file | ||
filename = sys.argv[1] | ||
test_name = os.path.split(os.getcwd())[1] | ||
checksumAPI.evaluate_checksum(test_name, filename, output_format='openpmd') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# This script tests the diffraction of a laser by | ||
# a cylindrical object, represented by an embedded boundary here | ||
|
||
max_step = 300 | ||
amr.n_cell = 128 256 | ||
amr.max_grid_size = 256 | ||
amr.max_level = 0 | ||
|
||
geometry.dims = RZ | ||
geometry.prob_lo = 0. -0.2 | ||
geometry.prob_hi = 2 1.4 | ||
warpx.cfl = 0.99 | ||
algo.particle_shape = 1 | ||
|
||
boundary.field_lo = none absorbing_silver_mueller | ||
boundary.field_hi = pec absorbing_silver_mueller | ||
|
||
# Make the cylindrical object that the laser will diffract on | ||
my_constants.aperture_l = 0.01 | ||
my_constants.aperture_r = 0.2 | ||
warpx.eb_implicit_function = "if( (abs(z)<0.5*aperture_l) and (x<aperture_r), 1, -1 )" | ||
|
||
warpx.n_rz_azimuthal_modes = 2 | ||
|
||
# Laser | ||
lasers.names = laser1 | ||
laser1.profile = Gaussian | ||
laser1.position = 0. 0. -0.1 | ||
laser1.direction = 0. 0. 1. | ||
laser1.polarization = 1. 0. 0. | ||
laser1.profile_waist = 1. | ||
laser1.profile_duration = 100 | ||
laser1.profile_t_peak = 0 | ||
laser1.profile_focal_distance = 0 | ||
laser1.e_max = 1. | ||
laser1.wavelength = 0.1 | ||
|
||
diagnostics.diags_names = diag1 | ||
diag1.intervals = 100 | ||
diag1.diag_type = Full | ||
diag1.fields_to_plot = Er Et Ez Br Bt Bz | ||
diag1.format = openpmd |
Oops, something went wrong.