aboutsummaryrefslogtreecommitdiff
path: root/Examples/Modules
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2022-03-03 14:29:21 -0800
committerGravatar GitHub <noreply@github.com> 2022-03-03 22:29:21 +0000
commitdec136d2277b5592d9beb904c7aa104c97bee994 (patch)
tree6dd1a3eda6c95382b5af6052176fa2100806ffeb /Examples/Modules
parente992ddf136d7b88a5f2b25c961fbe25b677159a1 (diff)
downloadWarpX-dec136d2277b5592d9beb904c7aa104c97bee994.tar.gz
WarpX-dec136d2277b5592d9beb904c7aa104c97bee994.tar.zst
WarpX-dec136d2277b5592d9beb904c7aa104c97bee994.zip
Macroscopic Maxwell solver: do not update fields in EB (stair-case approximation) (#2899)
* Macroscopic Maxwell solver: do not update fields in EB * Correct unused variable * Add test with macroscopic solver * Add automated test
Diffstat (limited to 'Examples/Modules')
-rwxr-xr-xExamples/Modules/embedded_boundary_cube/analysis_fields.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/Examples/Modules/embedded_boundary_cube/analysis_fields.py b/Examples/Modules/embedded_boundary_cube/analysis_fields.py
index b81f72d9d..13bd32d73 100755
--- a/Examples/Modules/embedded_boundary_cube/analysis_fields.py
+++ b/Examples/Modules/embedded_boundary_cube/analysis_fields.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import os
+import re
import sys
import numpy as np
@@ -41,6 +42,16 @@ filename = sys.argv[1]
ds = yt.load(filename)
data = ds.covering_grid(level=0, left_edge=ds.domain_left_edge, dims=ds.domain_dimensions)
+# Parse test name and check whether this use the macroscopic solver
+# (i.e. solving the equation in a dielectric)
+macroscopic = True if re.search( 'macroscopic', filename ) else False
+
+# Calculate frequency of the mode oscillation
+omega = np.sqrt( h_2 ) * c
+if macroscopic:
+ # Relative permittivity used in this test: epsilon_r = 1.5
+ omega *= 1./np.sqrt(1.5)
+
t = ds.current_time.to_value()
# Compute the analytic solution
@@ -60,8 +71,7 @@ for i in range(ncells[0]):
(-Lx/2 <= x < Lx/2) *
(-Ly/2 <= y < Ly/2) *
(-Lz/2 <= z < Lz/2) *
- np.cos(np.sqrt(2) *
- np.pi / Lx * c * t))
+ np.cos(omega * t))
x = i*dx + lo[0]
y = j*dy + lo[1]
@@ -72,7 +82,7 @@ for i in range(ncells[0]):
(-Lx/2 <= x < Lx/2) *
(-Ly/2 <= y < Ly/2) *
(-Lz/2 <= z < Lz/2) *
- np.cos(np.sqrt(2) * np.pi / Lx * c * t))
+ np.cos(omega * t))
rel_tol_err = 1e-1