aboutsummaryrefslogtreecommitdiff
path: root/Examples/Modules/embedded_boundary_cube/analysis_fields_2d.py
diff options
context:
space:
mode:
authorGravatar Edoardo Zoni <59625522+EZoni@users.noreply.github.com> 2022-12-02 20:20:17 -0800
committerGravatar GitHub <noreply@github.com> 2022-12-02 20:20:17 -0800
commit2857ca08a97b3a8f82d902480816acac0b9614d6 (patch)
tree5999a62464445e491eeb81a96444f48c0fa41125 /Examples/Modules/embedded_boundary_cube/analysis_fields_2d.py
parent3b6a467d1b7dd79ce90b02048dd1c6a0db7b138d (diff)
downloadWarpX-2857ca08a97b3a8f82d902480816acac0b9614d6.tar.gz
WarpX-2857ca08a97b3a8f82d902480816acac0b9614d6.tar.zst
WarpX-2857ca08a97b3a8f82d902480816acac0b9614d6.zip
Clean up examples folders (#3545)
* Clean up examples folders * Use `snake_case` names * Rename `nci_corrector` as `nci_fdtd_stability`
Diffstat (limited to 'Examples/Modules/embedded_boundary_cube/analysis_fields_2d.py')
-rwxr-xr-xExamples/Modules/embedded_boundary_cube/analysis_fields_2d.py64
1 files changed, 0 insertions, 64 deletions
diff --git a/Examples/Modules/embedded_boundary_cube/analysis_fields_2d.py b/Examples/Modules/embedded_boundary_cube/analysis_fields_2d.py
deleted file mode 100755
index 67e893b19..000000000
--- a/Examples/Modules/embedded_boundary_cube/analysis_fields_2d.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python3
-
-import os
-import sys
-
-import numpy as np
-from scipy.constants import c, mu_0, pi
-import yt
-
-sys.path.insert(1, '../../../../warpx/Regression/Checksum/')
-import checksumAPI
-
-# This is a script that analyses the simulation results from
-# the script `inputs_3d`. This simulates a TMmnp mode in a PEC cubic resonator.
-# The magnetic field in the simulation is given (in theory) by:
-# $$ B_y = \mu \cos(k_x x)\cos(k_z z)\cos( \omega_p t)$$
-# with
-# $$ k_x = \frac{m\pi}{L}$$
-# $$ k_y = \frac{n\pi}{L}$$
-# $$ k_z = \frac{p\pi}{L}$$
-
-hi = [0.8, 0.8]
-lo = [-0.8, -0.8]
-ncells = [32, 32, 1]
-dx = (hi[0] - lo[0]) / ncells[0]
-dz = (hi[1] - lo[1]) / ncells[1]
-m = 0
-n = 1
-Lx = 1
-Lz = 1
-
-# Open the right plot file
-filename = sys.argv[1]
-ds = yt.load(filename)
-data = ds.covering_grid(level=0, left_edge=ds.domain_left_edge, dims=ds.domain_dimensions)
-
-t = ds.current_time.to_value()
-
-# Compute the analytic solution
-By_th = np.zeros(ncells)
-for i in range(ncells[0]):
- for j in range(ncells[1]):
- x = (i+0.5) * dx + lo[0]
- z = (j+0.5) * dz + lo[1]
-
- By_th[i, j, 0] = mu_0 * (np.cos(m * pi / Lx * (x - Lx / 2)) *
- np.cos(n * pi / Lz * (z - Lz / 2)) *
- (-Lx / 2 <= x < Lx / 2) *
- (-Lz / 2 <= z < Lz / 2) *
- np.cos(np.pi / Lx * c * t))
-rel_tol_err = 1e-3
-
-# Compute relative l^2 error on By
-By_sim = data['By'].to_ndarray()
-rel_err_y = np.sqrt(np.sum(np.square(By_sim - By_th)) / np.sum(np.square(By_th)))
-assert (rel_err_y < rel_tol_err)
-
-# Compute relative l^2 error on Ey
-Ey_sim = data['Ey'].to_ndarray()
-rel_err_y = np.sqrt(np.sum(np.square(Ey_sim/c - By_th)) / np.sum(np.square(By_th)))
-
-test_name = os.path.split(os.getcwd())[1]
-
-checksumAPI.evaluate_checksum(test_name, filename)