-- Validation test: simulate a plane wave propagating in a parallel plate -- waveguide with a discontinuity in materials. sim.name = "twomat" -- simulation name sim.dt = 1e-12 -- timestep size sim.timesteps = 20000 -- num of iterations sim.gmsh_model = "parallel_plate.geo" -- gmsh model filename sim.use_gpu = 0 -- 0: cpu, 1: gpu sim.approx_order = 2 -- approximation order sim.time_integrator = "leapfrog" postpro.silo_output_rate = 100 postpro.cycle_print_rate = 100 -- console print rate postpro["E"].mode = "nodal" postpro["H"].mode = "none" postpro["J"].mode = "none" debug = {}; debug.dump_cell_ranks = true; function setup_materials() local bulk_m1 = physical_group_to_volumes(1); for i,v in ipairs(bulk_m1) do materials[v] = {} materials[v].epsilon = 1 materials[v].mu = 1 materials[v].sigma = 0 end local bulk_m2 = physical_group_to_volumes(2); for i,v in ipairs(bulk_m2) do materials[v] = {} materials[v].epsilon = 4 materials[v].mu = 1 materials[v].sigma = 0 end end local freq = 3e8 function plane_wave(tag, x, y, z, t) local Ex = 0 local Ey = 0 local Ez = math.sin(2*math.pi*t*freq) return Ex, Ey, Ez end function setup_boundary_conditions() local source = physical_group_to_surfaces(10); for i,v in ipairs(source) do bndconds[v] = {}; bndconds[v].kind = "plane_wave_E"; bndconds[v].source = plane_wave; end local pmc = physical_group_to_surfaces(11); for i,v in ipairs(pmc) do bndconds[v] = {}; bndconds[v].kind = "pmc"; end local abc = physical_group_to_surfaces(13); for i,v in ipairs(abc) do bndconds[v] = {}; bndconds[v].kind = "impedance"; end end function on_mesh_loaded() setup_materials(); setup_boundary_conditions(); end