⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 energy_cons_1d.tex

📁 采用FDTD时域有限差分法计算电磁波的传播问题等。
💻 TEX
字号:
\begin{comment}#include <stdio.h>#include <stdlib.h>#include <signal.h>\end{comment}\section{Energy conservation in one dimension}In this example, we compute the total energy over time for a polaritonicmaterial in one dimension to verify that it is indeed conserved.  This alsodemonstrates how to use a 1D system.\begin{figure}\label{econs_1d}\caption{Energy vs. Time.}\includegraphics[width=8.8cm,clip=true]{energy_cons_1d-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 create a 1D system by making the volume with the ``\verb!volone!''function, and making sure any vecs we use are one dimensional.\begin{verbatim}  structure s(volone(20.0, a), eps);\end{verbatim}\begin{comment}  const char *dirname = make_output_directory(__FILE__);  s.set_output_directory(dirname);\end{comment}The polarizability is added as usual... in this case we use a very sharpresonance, which means that our energy will only be very slowly absorbed.\begin{verbatim}  s.add_polarizability(one, 0.25, 0.0001, 3.0);  fields f(&s);  grace g("energy", dirname);\end{verbatim}We use several point sources, to cover a broad frequency range, just forthe heck of it.\begin{verbatim}  f.add_point_source(Ex, 0.6 , 1.8, 0.0, 8.0, vec(2.0));  f.add_point_source(Ex, 0.4 , 1.8, 0.0, 8.0, vec(2.0));  f.add_point_source(Ex, 0.33, 1.8, 0.0, 8.0, vec(2.0));\end{verbatim}\begin{comment}  const double ezero = f.total_energy();  double next_printtime = 10;  while (f.time() < ttot && !interrupt) {    if (f.time() >= next_printtime) {      next_printtime += 10;      master_printf("Working on time %g...  ", f.time());      master_printf("energy is %g\n", f.total_energy() - ezero);      master_printf("thermo energy is %g\n", f.thermo_energy_in_box(f.v.surroundings()) - ezero);      //f.eps_slices();\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() - ezero);      g.output_out_of_order(1, f.time(),                            f.electric_energy_in_box(f.v.surroundings())                          + f.magnetic_energy_in_box(f.v.surroundings()));      g.output_out_of_order(2, f.time(),                            f.thermo_energy_in_box(f.v.surroundings()) - ezero);\end{verbatim}\begin{comment}    }    f.step();  }}\end{comment}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -