MCPcopy Create free account
hub / github.com/NanoComp/meep / test_pml

Function test_pml

tests/three_d.cpp:163–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163int test_pml(double eps(const vec &)) {
164 double a = 10.0;
165
166 grid_volume gv = vol3d(1.5, 1.0, 1.2, a);
167 structure s(gv, eps, pml(0.401));
168
169 master_printf("Testing pml quality...\n");
170 fields f(&s);
171 f.add_point_source(Ez, 0.8, 0.6, 0.0, 4.0, vec(0.751, 0.5, 0.601), 1.0);
172 const double deltaT = 10.0;
173 const double ttot = 3.1 * deltaT;
174 double field_energy_check_time = deltaT;
175
176 while (f.time() < f.last_source_time())
177 f.step();
178
179 double last_energy = f.field_energy();
180 while (f.time() < ttot) {
181 f.step();
182 if (f.time() >= field_energy_check_time) {
183 const double new_energy = f.field_energy();
184 master_printf("Got newE/oldE of %g\n", new_energy / last_energy);
185 if (new_energy > last_energy * 4e-3) {
186 master_printf("Energy decaying too slowly: from %g to %g (%g)\n", last_energy, new_energy,
187 new_energy / last_energy);
188 return 0;
189 }
190 field_energy_check_time += deltaT;
191 }
192 }
193 return 1;
194}
195
196int test_pml_splitting(double eps(const vec &), int splitting) {
197 double a = 10.0;

Callers 1

mainFunction · 0.70

Calls 9

vol3dFunction · 0.85
pmlFunction · 0.85
master_printfFunction · 0.85
add_point_sourceMethod · 0.80
timeMethod · 0.80
last_source_timeMethod · 0.80
stepMethod · 0.80
field_energyMethod · 0.80
vecClass · 0.50

Tested by

no test coverage detected