File: nonlinear.tex

package info (click to toggle)
meep 0.10-2.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,380 kB
  • ctags: 5,469
  • sloc: cpp: 50,653; sh: 8,380; haskell: 744; makefile: 367; perl: 10
file content (108 lines) | stat: -rw-r--r-- 3,324 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
\section{Nonlinear materials}

FIXME: Add a nice discussion of nonlinear materials here...

In this example, we will use a CW source and compute the amplitude of the
field at a given position and time as a function of the source amplitude.
The result will be linear as long as the material remains in the linear
regime.  Once we have departed from the linear regime, we get more
complicated behavior.  Yes, this is a stupid example...

\begin{figure}
\label{nonlinear_field_shape}
\caption{Field vs. source amplitude with nonlinear material}
\includegraphics[width=14cm,clip=true]{nonlinear-out/ez-000400-00}
\end{figure}

The system is shown in Figure~\ref{nonlinear_field_shape}.  It is a 2D
metallic waveguide with vacuum $\epsilon$ of 2.25.  In the center of the
cell is a small region that is linear which contains the source, and the
rest of the waveguide contains a nonlinear material.  Both ends of the
waveguide have PML absorbing boundary conditions.

\begin{comment}
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

#include <meep.hpp>
using namespace meep;

const double a = 10.0;
const int m = 0;
const double eps_value = 2.25;

const double pml_thickness = 2.0;
const double xmax = 60.0;
const double ymax = 1.0;

double eps(const vec &v) {
  return eps_value;
}
\end{comment}
\begin{verbatim}
const double alpha_value = 0.07;
double alpha(const vec &v) {
  if (fabs(v.x() - xmax/2.0) < .51) return 0.0;
  return alpha_value;
}
\end{verbatim}

\begin{comment}
int main(int argc, char **argv) {
  initialize mpi(argc, argv);
  deal_with_ctrl_c();
  const char *dirname = make_output_directory(__FILE__);
  volume v = vol2d(xmax, ymax, a);
  const symmetry S = mirror(X,v) + mirror(Y,v);
  structure s(v, eps, pml(pml_thickness, X), S);
  s.set_output_directory(dirname);
  grace g("field", dirname);
  g.output_point(0.0, 0.0);
  g.output_point(0.0, 0.0);
\end{comment}

The set\_chi3 method is used to set the chi3 coefficient.

\begin{verbatim}
  s.set_chi3(alpha);
\end{verbatim}

We use a CW source at a frequency of 0.4, which gives single-mode behavior
when the amplitude is small.  Also note that we use real fields, since
complex fields are incorrect for nonlinear materials.

\begin{verbatim}
  continuous_src_time my_source(0.4,  0.8);
  for (double amp = 0.05; amp <= 1.01 && !interrupt; amp += 0.01) {
    fields f(&s, m);
    f.use_real_fields();
    f.add_point_source(Ez, my_source, vec(xmax*0.5,ymax*0.5), amp);
\end{verbatim}

\begin{figure}
\label{nonlinear_field}
\caption{Field vs. source amplitude with nonlinear material}
\includegraphics[width=8.8cm,clip=true]{nonlinear-out/field}
\end{figure}

Time stepping, etc, is done as usual.  We monitor the field at one end of
the cell, which gives Figure~\ref{nonlinear_field}, which show the field
versus source amplitude.

\begin{comment}
    master_printf("Working with A=%g...\n", amp);
    double next_printtime = 400;
    while (f.time() < 10.1*xmax && !interrupt) {
      if (f.time() >= next_printtime) {
        next_printtime += 100;
        //master_printf("Working on time %g...  ", f.time());
        //master_printf("energy is %g\n", f.field_energy());
	f.output_hdf5(Ez, f.total_volume());
      }
      f.step();
    }
    g.output_point(amp, real(f.get_field(Ez,vec(1.2*pml_thickness,ymax/2))));
  }
}
\end{comment}