|
130 | 130 | println("Testing for COCOS ", cc)
|
131 | 131 | Gfixed = efit(transform_cocos(gfixed, cc0, cc), cc)
|
132 | 132 | Gfree = efit(transform_cocos(gfree, cc0, cc), cc)
|
133 |
| - flux_cps = boundary_control_points(Gfree, 0.999) |
| 133 | + _, ψbound = psi_limits(Gfree) |
| 134 | + flux_cps = boundary_control_points(Gfree, 0.999, ψbound) |
134 | 135 | saddle_cps = [SaddleControlPoint(Rx, Zx)]
|
135 | 136 | currents, _ = find_coil_currents!(coils, Gfixed; flux_cps, saddle_cps, λ_regularize=1e-14)
|
136 | 137 | if cc < 10
|
@@ -159,12 +160,15 @@ end
|
159 | 160 | Gfixed = efit(transform_cocos(gfixed, cc0, 11), 11)
|
160 | 161 | Gfree = efit(transform_cocos(gfree, cc0, 11), 11)
|
161 | 162 |
|
| 163 | + _, ψbound = psi_limits(Gfree) |
| 164 | + Rs, Zs = gfree.r, gfree.z |
| 165 | + |
162 | 166 | ix = argmin(gfree.zbbbs)
|
163 | 167 | Rx, Zx = gfree.rbbbs[ix], gfree.zbbbs[ix]
|
164 | 168 |
|
165 |
| - flux_cps = boundary_control_points(Gfree, 0.999) |
| 169 | + flux_cps = boundary_control_points(Gfree, 0.999, ψbound) |
166 | 170 | saddle_cps = [SaddleControlPoint(Rx, Zx)]
|
167 |
| - fixed2free(Gfixed, coils, gfree.r, gfree.z; flux_cps, saddle_cps); |
| 171 | + fixed2free(Gfixed, coils, Rs, Zs; flux_cps, saddle_cps) |
168 | 172 | end
|
169 | 173 |
|
170 | 174 | @testset "current_BtIp" begin
|
@@ -192,17 +196,23 @@ end
|
192 | 196 |
|
193 | 197 | gfree = MXHEquilibrium.readg(EQs_free[i]; set_time=0.0)
|
194 | 198 | Gfree = MXHEquilibrium.efit(gfree, cc)
|
| 199 | + _, ψbound = psi_limits(Gfree) |
195 | 200 |
|
196 | 201 | # Currents from EFIT
|
197 | 202 | p = plot(C[i, :]; linewidth=3, linecolor=:black)
|
198 | 203 |
|
199 | 204 | # Currents with ψbound=0
|
200 |
| - flux_cps = boundary_control_points(Gfixed, 0.999) |
| 205 | + flux_cps = boundary_control_points(Gfixed, 0.999, 0.0) |
201 | 206 | c0, _ = find_coil_currents!(coils, Gfixed; flux_cps, λ_regularize=1e-14)
|
202 | 207 |
|
203 | 208 | plot!(c0; linewidth=3, linecolor=:red)
|
204 | 209 |
|
| 210 | + # Currents with ψbound from EFIT |
| 211 | + flux_cps = boundary_control_points(Gfixed, 0.999, ψbound) |
| 212 | + cb, _ = find_coil_currents!(coils, Gfixed; flux_cps, λ_regularize=1e-14) |
| 213 | + plot!(cb; linewidth=3, linecolor=:blue) |
205 | 214 | display(p)
|
| 215 | + |
206 | 216 | end
|
207 | 217 | end
|
208 | 218 |
|
|
0 commit comments