Newer
Older
-- 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.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()
materials[v] = {}
materials[v].epsilon = 1
materials[v].mu = 1
materials[v].sigma = 0
end
for i,v in ipairs(bulk_m2) do
materials[v] = {}
materials[v].epsilon = 4
materials[v].mu = 1
materials[v].sigma = 0
end
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()
for i,v in ipairs(source) do
bndconds[v] = {};
bndconds[v].kind = "plane_wave_E";
bndconds[v].source = plane_wave;
end
for i,v in ipairs(pmc) do
bndconds[v] = {};
bndconds[v].kind = "pmc";
end
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