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 optimization results in NaN coil parameters #80

Open
jimlobsien opened this issue Oct 28, 2021 · 4 comments
Open

Coil optimization results in NaN coil parameters #80

jimlobsien opened this issue Oct 28, 2021 · 4 comments
Assignees
Labels

Comments

@jimlobsien
Copy link
Collaborator

The Problem appeared a couple of times now. I am using the coil-surface constraints together with the curvature constraint. FOCUS is optimizing which you can see in the nohup.out file, but after the line search fails during an interval update, the coils are written with NaN as parameters. I am clueless what I am doing wrong, since FOCUS actually finds suitable coils.
Please have a look at the files used for optimization: https://datashare.mpcdf.mpg.de/s/vObhcQv4HbHBJci

I am giving FOCUS initial coils and the output was written in nohup.out

Thanks

@jimlobsien jimlobsien changed the title Coil optimization result in NaN coil parameters Coil optimization results in NaN coil parameters Nov 17, 2021
@jimlobsien
Copy link
Collaborator Author

jimlobsien commented Nov 24, 2021

The Problem still persist. Here is another example of a focus run, that starts the optimization but then does not outputs the coils correctly and crashes afterwards: https://datashare.mpcdf.mpg.de/s/dpK1brUJm3qc8zA

@zhucaoxiang
Copy link
Collaborator

@jimlobsien Thanks for reporting. I will look into this and get it back to you.

@jimlobsien
Copy link
Collaborator Author

jimlobsien commented Nov 24, 2021 via email

@zhucaoxiang
Copy link
Collaborator

(Sorry for the late reply)

After running the example in the debug mode (dfocus), I found the problem is from floating-point overflow. The corresponding line is if ( ideriv == 1 ) sumdE = sqrt(sum(t1E**2)). My guess is that some term in the gradient is too large/small, when we take a square, it exceeds the floating-point limit. This is likely from the coil-surface separation or coil-coil separation.

A short-term solution is to tune (decrease) the input parameters, especially cssep_factor and ccsep_alpha (these are the exponential factors and it will contribute a lot to the cost function.

 ------------- Nonlinear Conjugate Gradient (CG) -----
output  :      2 :  2.69167E+02 ;  6.09270E+01 ;  2.36038E+02 ;  1.00690E+01 ;  0.00000E+00 ;  0.00000E+00 ;  0.00000E+00 ;  5.74665E+02 ;  0.00000E+00 ;  0.\
00000E+00 ;  0.00000E+00 ;  0.00000E+00 ;
output  :      3 :  4.04429E+02 ;  4.87827E+01 ;  1.03660E+03 ;  8.02496E+00 ;  0.00000E+00 ;  0.00000E+00 ;  0.00000E+00 ;  1.33727E+04 ;  0.00000E+00 ;  5.\
91964E-07 ;  0.00000E+00 ;  0.00000E+00 ;
[stellar-i08n18:2561708:0:2561708] Caught signal 8 (Floating point exception: floating-point overflow)
..
=================================
forrtl: error (75): floating point exception
Image              PC                Routine            Line        Source
dfocus             000000000096142B  Unknown               Unknown  Unknown
libpthread-2.28.s  0000146188DE1B20  Unknown               Unknown  Unknown
dfocus             00000000005E3184  costfun_                  473  solvers_m.F90
dfocus             00000000005F4D09  mygrad_                   362  congrad_m.F90
dfocus             0000000000942D23  cg_updatew_              1514  cg_descent.f
dfocus             0000000000941A1C  cg_linew_                1313  cg_descent.f
dfocus             000000000093B08E  cg_descent_               273  cg_descent.f
dfocus             00000000005F42E4  congrad_                  299  congrad_m.F90
dfocus             00000000005D5FCF  solvers_                  160  solvers_m.F90
dfocus             000000000091BB30  MAIN__                     94  focus_m.F90
dfocus             000000000040B962  Unknown               Unknown  Unknown
libc-2.28.so       0000146186951493  __libc_start_main     Unknown  Unknown
dfocus             000000000040B86E  Unknown               Unknown  Unknown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants