From dec136d2277b5592d9beb904c7aa104c97bee994 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Thu, 3 Mar 2022 14:29:21 -0800 Subject: 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 --- .../Modules/embedded_boundary_cube/analysis_fields.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Examples/Modules/embedded_boundary_cube/analysis_fields.py') 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 -- cgit v1.2.3