# Ziolkowski active region material qm = mb.qm_desc_2lvl(1e24, 2 * math.pi * 2e14, 6.24e-11, 1.0e10, 1.0e10, -1.0) mat_ar = mb.material("AR_Ziolkowski", qm) mb.material.add_to_library(mat_ar) # Ziolkowski setup dev = mb.device("Ziolkowski") dev.add_region(mb.region("Vacuum left", mat_vac, 0, 7.5e-6)) dev.add_region(mb.region("Active region", mat_ar, 7.5e-6, 142.5e-6)) dev.add_region(mb.region("Vacuum right", mat_vac, 142.5e-6, 150e-6)) # initial density matrix rho_init = mb.qm_operator([1, 0]) # scenario sce = mb.scenario("Basic", 32768, 200e-15, rho_init) sce.add_record(mb.record("inv12", 2.5e-15)) sce.add_record(mb.record("e", 2.5e-15)) # add source sce.add_source( mb.sech_pulse("sech", 0.0, mb.source.hard_source, 4.2186e9, 2e14, 10, 2e14)) # run solver sol = mb.solver.create_instance("cpu-fdtd-red-2lvl-cvr-rodr", dev, sce) print('Solver ' + sol.get_name() + ' started') tic = time.time() sol.run() toc = time.time() print('Solver ' + sol.get_name() + ' finished in ' + str(toc - tic) + ' sec')
# Ziolkowski active region material qm = mb.qm_desc_2lvl(1e24, 2 * math.pi * 2e14, 6.24e-11, 1.0e10, 1.0e10, -1.0) mat_ar = mb.material("AR_Ziolkowski", qm) mb.material.add_to_library(mat_ar) # Ziolkowski setup dev = mb.device("Ziolkowski") dev.add_region(mb.region("Vacuum left", mat_vac, 0, 7.5e-6)) dev.add_region(mb.region("Active region", mat_ar, 7.5e-6, 142.5e-6)) dev.add_region(mb.region("Vacuum right", mat_vac, 142.5e-6, 150e-6)) # initial density matrix rho_init = mb.qm_operator([ 1, 0 ]) # scenario sce = mb.scenario("Basic", 32768, 200e-15, rho_init) sce.add_record(mb.record("inv12", 2.5e-15)) sce.add_record(mb.record("e", 2.5e-15)) # add source sce.add_source(mb.sech_pulse("sech", 0.0, mb.source.hard_source, 4.2186e9, 2e14, 10, 2e14)) # run solver sol = mb.solver("openmp-2lvl-os-red", dev, sce) print('Solver ' + sol.get_name() + ' started') tic = time.time() sol.run() toc = time.time() print('Solver ' + sol.get_name() + ' finished in ' + str(toc - tic) + ' sec')
import sys sys.path.append('./mbsolve-lib/') sys.path.append('./solver-generic/') sys.path.append('./writer-matlab/') import pymbsolvelib as mb import pysolvergeneric import pywritermatlab import numpy as np dev = mb.device("test") sce = mb.scenario("basic", 32768, 200e-15) sce.add_record(mb.record("d11")) sol = mb.solver("generic", dev, sce) print('Solver ' + sol.get_name() + ' started') sol.run() print('Solver ' + sol.get_name() + ' finished') wri = mb.writer("matlab") outfile = dev.get_name() + "_" + sce.get_name() + "." + wri.get_extension() results = sol.get_results()
# overlap factor 1 mat_ar = mb.material("AR_Freeman", qm, 12.9, 1, loss) mb.material.add_to_library(mat_ar) L_abs = 0.25e-3 dev = mb.device("Freeman") dev.add_region(mb.region("Vacuum left", mat_abs, 0, L_abs)) dev.add_region(mb.region("Active region", mat_ar, L_abs, L_abs + L)) dev.add_region(mb.region("Vacuum right", mat_abs, L_abs + L, 2 * L_abs + L)) # scenario # approx 14000 grid points -> choose 16k? # rather set d_x directly # courant number? sce = mb.scenario("Basic", 16384, 230e-12) sce.add_record(mb.record("inv12", 2e-12)) sce.add_record(mb.record("e", 1e-13, L_abs + L)) #TODO check whether position > device length # add source sce.add_source( mb.single_cycle_pulse("seed-pulse", L_abs, mb.source.soft_source, 1e5, 2.45e12, 1 / (0.35e-12 / 2.634), 1e-12)) # TODO: add phase to carrier sine wave ? # initialization: perfect inversion sce.set_dm_init_type(mb.scenario.upper_full) sol = mb.solver("openmp-2lvl-pc", dev, sce)