-- Resonant cavity test. See Pozar, section 6.3 for theory. ----------------------- --[[ Problem setup ]]-- sim.name = "test_maxwell_resonator" -- simulation name sim.dt = 1e-12 -- timestep size sim.timesteps = 100001 -- num of iterations sim.gmsh_model = "resonator.geo" -- gmsh model filename sim.use_gpu = 0 -- 0: cpu, 1: gpu sim.approx_order = 1 -- approximation order sim.time_integrator = "euler" postpro.silo_output_rate = 100 postpro.cycle_print_rate = 100 -- console print rate postpro["E"].silo_mode = "zonal" postpro["H"].silo_mode = "zonal" postpro["J"].silo_mode = "none" local epsr = 1 local mur = 1 materials[1] = {} materials[1].epsilon = epsr materials[1].mu = mur materials[1].sigma = 0 function electric_initial_condition(x, y, z) local Ex = 0 local Ey = math.sin(math.pi*x) * math.sin(math.pi*z) local Ez = 0 return Ex, Ey, Ez end -------------------------- --[[ Validation stuff ]]-- debug = {} local c0 = 1/math.sqrt(const.eps0*const.mu0) -- Mode local m = 1 -- along x local n = 0 -- along y local l = 1 -- along z -- Cavity dimensions (must match sim.gmsh_model) local a = 1 -- along x local b = 0.1 -- along y local d = 1 -- along z local u = m*math.pi/a local v = n*math.pi/b local w = l*math.pi/d -- Compute resonant frequency local omega0 = c0*math.sqrt(u*u + v*v + w*w)/math.sqrt(epsr*mur) -- Compute impedance local eps = materials[1].epsilon * const.eps0 local mu = materials[1].mu * const.mu0 local Y = math.sqrt(eps/mu) function ansol(tag, x, y, z, t) local Ex = 0.0 local Ey = math.cos(omega0*t)*math.sin(math.pi*x)*math.sin(math.pi*z) local Ez = 0.0 local Hx = -Y*math.sin(omega0*t)*math.sin(math.pi*x)*math.cos(math.pi*z) local Hy = 0.0 local Hz = Y*math.sin(omega0*t)*math.cos(math.pi*x)*math.sin(math.pi*z) return Ex, Ey, Ez, Hx, Hy, Hz end --debug.analytical_solution = ansol debug.dump_cell_ranks = true