📄 energy_cons.tex
字号:
\begin{comment}#include <stdio.h>#include <stdlib.h>#include <signal.h>\end{comment}\section{Energy conservation in cylindrical coordinates}In this example, we compute the total energy over time for a polaritonicmaterial in cylindrical coordinates. Eventually I figure I may extend thisexample to demonstrate energy/flux conservation using PML. That woulddefinitely be more impressive.\begin{figure}\label{econs_cyl}\caption{Energy vs. Time.}\includegraphics[width=8.8cm,clip=true]{energy_cons-out/energy}\end{figure}\begin{comment}#include <meep.hpp>using namespace meep;const double a = 10;\end{comment}For our example polaritonic material, we'll use an $\epsilon(0)$ of 13.4.We will put the polaritons in just one quarter of our system to add alittle extra excitement.\begin{verbatim}double eps(const vec &) { return 13.4; }double one(const vec &p) { return (p.z() > 15.0)?1:0; }\end{verbatim}\begin{comment}int main(int argc, char **argv) { initialize mpi(argc, argv); deal_with_ctrl_c(); const double ttot = 600.0;\end{comment}We use a long and skinny system so as to exaggerate any errors that maycrop up at small $r$.\begin{verbatim} structure s(volcyl(1.0,20.0, a), eps);\end{verbatim}\begin{comment} const char *dirname = make_output_directory(__FILE__); s.set_output_directory(dirname); s.add_polarizability(one, 0.25, 0.1, 3.0); fields f(&s); grace g("energy", dirname);\end{comment}We use several point sources, to cover a broad frequency range, just forthe heck of it.\begin{verbatim} f.add_point_source(Ep, 0.6 , 1.8, 0.0, 8.0, veccyl(0.5,2.0)); f.add_point_source(Ep, 0.4 , 1.8, 0.0, 8.0, veccyl(0.5,2.0)); f.add_point_source(Ep, 0.33, 1.8, 0.0, 8.0, veccyl(0.5,2.0));\end{verbatim}\begin{comment} double next_printtime = 50; while (f.time() < ttot && !interrupt) { if (f.time() >= next_printtime) { next_printtime += 50; master_printf("Working on time %g... ", f.time()); master_printf("energy is %g\n", f.total_energy());\end{comment}We plot the total energy, the electromagnetic energy and the``thermodynamic energy'' which is the energy that is either stored in thepolarization, or has been converted into heat, or (if we had a saturatinggain system) perhaps is stored in a population inversion.\begin{verbatim} g.output_out_of_order(0, f.time(), f.total_energy()); g.output_out_of_order(1, f.time(), f.field_energy_in_box(f.v.surroundings())); g.output_out_of_order(2, f.time(), f.thermo_energy_in_box(f.v.surroundings()));\end{verbatim}\begin{comment} } f.step(); }}\end{comment}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -