-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors in core and edge profile interpolation and extrapolation #14
Comments
Scan Z at different values of R. The X-point is near R=5.5, Z=-3.5, # 1 The double valued core profile thing is because of the interpolation through psi. psi_N has similar values in the core plasma and private flux region. So any function that only considers psi_N will not distinguish between PFR and core. This happens all the time and is pretty easy to get around by checking against X-point height. By the way, we need X-point height. I'm working on it (ProjectTorreyPines/SOLPS2ctrl.jl#22). Scan Z at different values of R. The X-point is near R=5.5, Z=-3.5, # 2 I don't know how edge profiles is being extrapolated that far out beyond the SOLPS mesh. I didn't finish that thing, right? What does the green highlight mean? The core profiles assume all quantities are constant on flux surfaces (the flux function approximatin), and the edge profiles do not. The flux function approximation is usually good deep in the core, and is useless in the SOL. Somewhere in between, the approximation can be seen breaking down. I based the core profile extrapolation on the outboard midplane, so I would expect core and edge profiles to match exactly at the outboard midplane and have errors elsewhere. See SOLPS-only ne(R,Z) (or Te) 2D plots to help clarify this. Okay, but as for the specific variations that are seen here... some look weird. The large spike in the slice at Z=-2.5 m, for instance, is unexpected. That sort of thing is sometimes seen on the high field (smaller R) side. It's called the high-field-side-high-density. It's a very creative name. |
|
Dude that is really not bad for a simple first try at edge extrapolation. This significantly lowers the urgency of ProjectTorreyPines/SOLPS2ctrl.jl#4 or maybe even solves it, depending on how far we want to take that thing. Anyway, it gives time to do a higher quality edge extrapolation while we use what you have for testing. Good work. Very nice. Can we have a look at your extrapolated edge profile in 2d? I'm curious now. The gap in the core should not be there. Could there have been some rounding error or use of the wrong value for psi axis (such as from another time or something?) such that psi_N < 0 deep in the core? |
And yes, I need a more general X-point finder that operates on equilibrium data so that I can find a secondary X-point that's outside of the SOLPS grid. |
"Can we have a look at your extrapolated edge profile in 2d?"Here is the plot made by only using the interp function from GGDUtils.jl at efd8468 Minimum code to generate this:using SOLPS2IMAS
using GGDUtils
b2gmtry = "GGDUtils.jl/samples/b2fgmtry"
b2output = "GGDUtils.jl/samples/b2time_red.nc"
gsdesc = "GGDUtils.jl/samples/gridspacedesc.yml"
b2mn = "GGDUtils.jl/samples/b2mn.dat"
ids = solps2imas(b2gmtry, b2output, gsdesc, b2mn)
grid_ggd = ids.edge_profiles.grid_ggd[1]
n_e = GGDUtils.interp(ids.edge_profiles.ggd[1].electrons.density, grid_ggd, 5)
R = 3:.01:9
Z= -5:0.01:5
rz = [(r, z) for r in R, z in Z]
n_e_rz = n_e.(rz)
heatmap(R, Z, n_e_rz', c=:inferno, xlabel="R / m",
ylabel="Z / m", title=L"n_e / m^{-3}", colorbar_scale=:log10)
p = plot!(space) Inferences
Using more nearest neighborsAs I was writing this, I figures I can quickly try using more nearest points. Here are the plots: Using 8 nearest neighborsUsing 16 nearest neighborsUsing 32 nearest neighbors
|
It suffices to conclude then that outside SOLPS mesh, the extrapolation needs to be more careful and follow a different approach. I realized one error in my understanding of what is happening outside the mesh. Since the algorithm takes weighted mean of inverse distance, it actually just picks the closest cell value when it is outside the mesh. That's why even if I use an exponentially decaying weighing function with decay length of just 1 cm, the extrapolated profile looks exactly the same as 1/d weighing function. Now that I think about it, I remember knowing this at the time when I wrote this function. That outside the grid, it will just return the value of the closest grid cell. That's why the density does not actually drop with distance outside the mesh. This also explain the nutty behavior at the target. It is essentially just copying the target value to all nearest positions. Artifacts within the meshThe artifacts inside the mesh are coming because this is a 2D interpolation using values from the four closest points. Thus a "X" like feature will appear if the values at nearest points are very different from each other. The other extreme would be just giving the whole cell the same value everywhere inside which will create discontinuities at the boundary. So I am not sure how we can not have such artifacts in places where the gradient is large. My guesses are:
Possible flaw in weighed meanI cross-checked the code and there does not seem to be an error in it, atleast to me. But I might be blind to an error I committed myself, so if you think that the reproduced mesh values are too high, maybe you should check closely once. In the core region, edge_profile extrapolation agreed with the core_profile values which again makes the case stronger for edge_profile interpolation to be correct. |
Thin-plate splineWell, well, well...
I used the thin plate spline method generously defined in this document (distributed under Creative Commons license): It is basically a surface solution that reduces the bending energy while remaining on all the specified grid points. The above plot has enforced color bar limits to show the variation properly in mesh and core area. Without such limits though, we can see how the extrapolation goes outside the grid: GGDUtils_interp_from_edge_profiles_thin_plates_complete.pdf P.S. Use the pdf if you want to zoom into some area. |
Good work, this is great for a simple approximation. This will take us pretty far with testing. It's still a little excitable near the targets, but that's okay for now. When I finish off the extended mesh and my fancy witchcraft for extrapolating into the SOL, this same interpolation scheme can draw from that extension. |
I ran a scan of core and edge profiles of electron density on our sample file to see how the interpolation functions are doing. While for some values of Z and R, they are working exactly as we would like them to, there are weird problems with them on some values of R, Z. See these plots:
Scan Z at different values of R. The X-point is near R=5.5, Z=-3.5
Scan R at different values of Z. The X-point is near R=5.5, Z=-3.5
The text was updated successfully, but these errors were encountered: