Skip to content
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

Coil-surface optimization is now enabled in the branch "develop" #17

Open
zhucaoxiang opened this issue Apr 9, 2018 · 9 comments
Open

Comments

@zhucaoxiang
Copy link
Collaborator

zhucaoxiang commented Apr 9, 2018

I have added an new constraint cssep (in surfsep.h) to push coils away from any surfaces. For more details, please read the following documents.
1. surfsep documentation surfsep.pdf.
2. testing cases in google doc.

There are still some issues remained to be solved. But the results are pretty promising. Please feel free to test and use this new function. After full verifications, I will merge this the main branch.

@logan-nc
Copy link
Collaborator

logan-nc commented Apr 9, 2018

This looks promising @zhucaoxiang.

What input can I use to set q? Can you add some annotated lines to FOCUS/examples/New_d3d_RMP/d3d.input or some other example input so I can easily modify them and give it a try (its fine to have it turned off - which I assume is the default - I just need to see where/what to change)?

Does this currently support q<1 to constrain coils to a "winding surface"? This would be an elegant way to do either one once you add the ability to input non-plasma surfaces.

@zhucaoxiang
Copy link
Collaborator Author

@logan-nc I recommend you to use some values larger than 2, e.g. q=3. The objective function has a integration over the coils, so minimizing the coil length would also reduce the coil-surface separation. It depends on which effect is dominant.

I will update the examples right now. Or you can just add two lines in *.input file. It's the same way to use it as other constraints.

I don't think q<1 could constrain coils lying on a winding surface. I suppose this will lead to compress the coils. We need to do more tests. As to winding surface, I plan to add an explicit representation for coils on a defined winding surface in the future. But this is not on my short-term list and Stuart is doing something like that. I can transplant and merge it in the future.

@zhucaoxiang
Copy link
Collaborator Author

This is now improved by specifying a separate limiter surface. Please check #42

A note on testing the function can be viewed at FOCUS_limiter_surface.html. The summary is attached below.

Summary

Here is the summary.

No. limiter surface radius weight_cssep cssep_factor Bnorm Ave. length
1 N/A 0 N/A 2.72675E-04 8.950953876643659E+00
2 0.3 4.5E-4 1 2.40886E-03 7.393134245040679E+00
3 0.3 4.5E-4 2 2.81821E-04 8.917045951521997E+00
4 0.3 4.5E-3 2 9.44831E-04 8.941794764356937E+00
5 0.3 4.5E-4 4 2.64044E-05 1.183940868491258E+01
6 0.5 4.5E-4 4 4.33171E-05 1.304298679204274E+01

Some observations:

  • The coil-surface separation is working, but make sure the coils are all outside the limiter surface and use an appropriate weight (might need some trials).
  • By increasing the weight_cssep, cssep_factor and limiter surface, the coils are getting further (longer)
  • Increasing cssep_factor is more significant than increasing the weight.
  • When cssep_factor is small, it actually has effect of compressing the coils, due to the $dl$ in the numerator (check surfsep.pdf).

@logan-nc
Copy link
Collaborator

This looks great @zhucaoxiang!
I have 2 questions:

  1. Is weight_cssep normalized in any way or do we always have to run one case with no optimization to figure out the relative, initial separation and Bharm (or Bnorm) costs? I can imagine their relative values being very different in different machines.
  2. Have you tried setting a boundary outside of the initial coils and using cssep_factor = -2? In this case, I want to draw the coils towards a particular surface (where I know I have structural supports, for example) rather than repel them away from it. Does it work?

@logan-nc
Copy link
Collaborator

@ysm1887 should try using this with the 3 levels of interest pointed out at the last meeting: by the limiter, by the TF coils, and outside the cyo. Please start with just 2 coils toroidally to make things easier to understand so we can see how this feature works.

@zhucaoxiang
Copy link
Collaborator Author

@logan-nc

  1. IsNormWeight will normalize the weight using the present value of the objective function. Say if you set weight_cssep = 0.1, IsNormWeight = 1 and the initial value of cssep = 100, then FOCUS will automatically set weight_cssep = weight_cesep / cssep = 1E-3. This works similarly for all the objective functions. If IsNormWeight = 0, no internal adjustment for the input weights.
    Generally, the coil-surface separation should be small, like 1/1000 of Bnorm. One clearly doesn't want this function to dominant the optimization. One might need some trials for a particular problem.

  2. That is a good point. I haven't tested it. But if you want to make sure that the coils are inside a particular surface, you only need to make sure the initial coils are inside the surface. The coil-surface separation is penalizing the relative distance between coils and the surface. When the coils are outside, it will push the coils; when inside, it will also push/compress the coils. Because of singularities, the coils are not allowed to cross the surface.

@jimlobsien
Copy link
Collaborator

I am sorry, but the coil-surface constraint does not work for me. The coils, even tho they are initialized outside the limiting surface, are going through the limiting surface during the optimization. I tried various values for the weight and the factor without changing the outcome that the coils are inside the surface after the optimization. Can anyone tell me whats going on? Thanks for any help in advance. PS: Necessary files are attached and I used FOCUS in the develop branch
QIPC_Case.zip

@zhucaoxiang
Copy link
Collaborator Author

@jimlobsien I think the reason is your weights are not optimal, especially weight_cssep is too small. The coil-surface separation is not a hard constraint. You need to assign an appropriate weight.

@logan-nc
Copy link
Collaborator

logan-nc commented Jul 7, 2021

@jimlobsien another hint you may find helpful is to boost the number of grid points for the surface and the coils. The coil-surface separation is calculated between coil curve nodes and surface grid points. If these are sparse, it is easier for a coil node to jump through a gap in the surface grid (1 pt 10cm outside and one 10cm inside is the same penalty as both 10cm outside). I also found that initializing coils close to the surface often resulted in jumps through it.... I believe the weights must be very delicately balanced in this case. The balancing is less delicate if the initial coils are well away from the surface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment