diff options
Diffstat (limited to 'Examples/Modules/embedded_boundary_cube/analysis_fields.py')
-rwxr-xr-x | Examples/Modules/embedded_boundary_cube/analysis_fields.py | 16 |
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 |