## File: energy_cons.tex

package info (click to toggle)
meep 0.10-2.1
 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 \begin{comment} #include #include #include \end{comment} \section{Energy conservation in cylindrical coordinates} In this example, we compute the total energy over time for a polaritonic material in cylindrical coordinates. Eventually I figure I may extend this example to demonstrate energy/flux conservation using PML. That would definitely 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 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 a little 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 may crop 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 for the 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 the polarization, or has been converted into heat, or (if we had a saturating gain 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}