| 91 | } |
| 92 | |
| 93 | int test_metal(double eps(const vec &), int splitting) { |
| 94 | double a = 10.0; |
| 95 | double ttot = 17.0; |
| 96 | |
| 97 | grid_volume gv = vol3d(1.5, 0.5, 1.0, a); |
| 98 | structure s1(gv, eps); |
| 99 | structure s(gv, eps, no_pml(), identity(), splitting); |
| 100 | |
| 101 | master_printf("Metal test using %d chunks...\n", splitting); |
| 102 | fields f(&s); |
| 103 | f.add_point_source(Ez, 0.8, 0.6, 0.0, 4.0, vec(1.299, 0.299, 0.401), 1.0); |
| 104 | fields f1(&s1); |
| 105 | f1.add_point_source(Ez, 0.8, 0.6, 0.0, 4.0, vec(1.299, 0.299, 0.401), 1.0); |
| 106 | double field_energy_check_time = 8.0; |
| 107 | while (f.time() < ttot) { |
| 108 | f.step(); |
| 109 | f1.step(); |
| 110 | if (!compare_point(f, f1, vec(0.5, 0.5, 0.01))) return 0; |
| 111 | if (!compare_point(f, f1, vec(0.46, 0.33, 0.33))) return 0; |
| 112 | if (!compare_point(f, f1, vec(1.301, 0.301, 0.399))) return 0; |
| 113 | if (f.time() >= field_energy_check_time) { |
| 114 | if (!compare(f.field_energy(), f1.field_energy(), " total energy")) return 0; |
| 115 | if (!compare(f.electric_energy_in_box(gv.surroundings()), |
| 116 | f1.electric_energy_in_box(gv.surroundings()), "electric energy")) |
| 117 | return 0; |
| 118 | if (!compare(f.magnetic_energy_in_box(gv.surroundings()), |
| 119 | f1.magnetic_energy_in_box(gv.surroundings()), "magnetic energy")) |
| 120 | return 0; |
| 121 | field_energy_check_time += 5.0; |
| 122 | } |
| 123 | } |
| 124 | return 1; |
| 125 | } |
| 126 | |
| 127 | int test_periodic(double eps(const vec &), int splitting) { |
| 128 | double a = 10.0; |
no test coverage detected