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

Problem with restart in free-boundary #35

Closed
jloizu opened this issue Feb 22, 2018 · 6 comments
Closed

Problem with restart in free-boundary #35

jloizu opened this issue Feb 22, 2018 · 6 comments
Assignees

Comments

@jloizu
Copy link
Collaborator

jloizu commented Feb 22, 2018

Usually, when a converged equilibrium is found, one can copy the ".sp.end" output file into the ".sp" input file and set Linitialize=0. Then running the ".sp" input makes SPEC start from a converged equilibrium and thus does not need to iterate on the geometry to reduce the force-imbalance.

I realized that this does not work in free-boundary, unless Lconstraint=-1. By "does not work" I mean that the restarted input has a smaller force imbalance but not zero, and one needs to iterate a couple of times the "copy .end into .sp and run again" procedure in order to (finally) have a ".sp" file that is at equilibrium from the start.

This may be due to how the equilibrium poloidal and toroidal fluxes in the vacuum region are written in the ".end " file. Perhaps not written precisely enough?

@jloizu
Copy link
Collaborator Author

jloizu commented Feb 22, 2018

Here is an example of input file (one has to remove the .txt extension) that illustrates what I mean.

l2freeboundaryexample_L0.sp.txt

@jloizu
Copy link
Collaborator Author

jloizu commented Jul 23, 2018

As identified by @SRHudson , the problem is that the angle constraint coefficient sweight , which is defined in preset.h, was proportional to tflux in each volume. However, in free-boundary and e.g. Lconstraint=0, the toroidal (and poloidal) flux in the outermost volume, namely the vacuum volume, is modified in order to ensure the constraint of the linking current(s). Thus, when force-balance is obtained, the restart .end file contains a converged geometry but the value of tflux (which is the one initially in the input) has not changed, so that when the code is run again with this new file as input, the part of the force-balance that corresponds to the angle constraints is not converged. For example, one gets initially:

newton : 6.03 : 0 0 ; |f|= 5.43747E-03 ; time= 5.87s ; log|BB|e=-16.44
newton : : ; ; log|II|o= -3.10

@jloizu
Copy link
Collaborator Author

jloizu commented Jul 23, 2018

One way to fix this, as proposed by @SRHudson, is to remove the dependency of sweight on tflux,

SALLOCATE( sweight, (1:Mvol), zero )
!sweight(1:Mvol) = upsilon * tflux(1:Mvol)**wpoloidal
do vvol = 1, Mvol ; sweight(vvol) = upsilon * (vvol*one/Nvol)**wpoloidal
enddo

@jloizu
Copy link
Collaborator Author

jloizu commented Jul 23, 2018

I created a branch called fixrestart and applied this change. I checked that the code compiles and runs, and that the restart problem has been indeed fixed.

An important caveat is that the angle constraint (and therefore the angle definition itself) is different than before, even if running the same case. That makes comparison with previous runs very hard: the physical solution should not change, but for example the harmonics Rmn,Zmn,etc. will be different.

@jloizu
Copy link
Collaborator Author

jloizu commented Jul 23, 2018

One alternative would be to keep the definition of sweight as before and write in the .end file the new values of tflux that have been calculated during the previous run.

@jloizu
Copy link
Collaborator Author

jloizu commented Jul 25, 2018

Problem solved via the branch fixrestart. Closing issue.

@jloizu jloizu closed this as completed Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants