LLNL / UEDGE

2D fluid simulation of plasma and neutrals in magnetic fusion devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bbb.iterm = 7?

cfuria opened this issue · comments

I am currently running multiple UEDGE simulations in Colab with isbohmcalc = 0, i.e. spatially varying transport coefficients. Here is the pseudocode:

from uedge import *
...
for i in range(n):
  #update some parameters in the bbb package
  bbb.exmain()
  #save some measurements

Recently, I have been running into the following issue with some simulations:

nksol ---  iterm = 7.
            there was a breakdown in the krylov
            iteration.  this will likely only occur when
            the jacobian matrix j or j*(p-inverse) is ill-
            conditioned.  if this error return occurs with
            mf=2, try either mf=1 or mf=3 instead.

The current simulation ends, but this issue prevents any further simulations from running successfully. The code essentially stalls during the next simulation, with the for loop process never terminating. I was wondering if there is any way to prevent to prevent this issue from occurring, or prevent UEDGE from stalling and enable it to move on to the next simulation.

Also, the error message seems to be outdated as the only options for bbb.mf are 21, 22, 24, and 25.

Thanks for the response. I looked deeper into the issue, and realized that the issues were due to the fact that the hdf5 file I was reloading from for each simulation had been converged using isbohmcalc = 1, using bbb.difni, bbb.kye, and bbb.kyi instead of the bbb.dif_use, bbb.kye_use, and bbb.kyi_use arrays.
I do want to raise a secondary issue regarding the case in the UEDGE/pyexamples/d3dHsm/ folder, which I am using. When I run this case without any modifications in Colab (runcase.py), the simulation fails to converge with bbb.iterm = 4 during the second exmain(). This is the last line shown in the snippet below:

bbb.restart=1; bbb.ftol=1e-8; 
bbb.isbcwdt=1
bbb.dtreal = 1e-14; bbb.itermx=30; bbb.exmain()

In order for this step to converge, I have to set bbb.ftol for the previous run to a value multiple orders of magnitude (I have been using 1) below its value in the original setup (1e10). Unfortunately, I subsequently get an error during the rundt() execution, shown below (bbb.dt_tot = 0.29498803792064254):

*** Number time-step changes = 18  and dt = 0.281E-01 sec
 ----------------------------------------------------
  Updating Jacobian, npe =                      1
 iter=    0 fnrm=     0.1149005437317094E-05 nfe=      1
  Updating Jacobian, npe =                      2
 iter=    1 fnrm=     0.3937963928995040E-09 nfe=     11


 nksol ---  iterm = 1.
            maxnorm(sf*f(u)) .le. ftol, where maxnorm() is
            the maximum norm function.  u is probably an
            approximate root of f.
 Interpolants created; mype =                   -1
Step number at this dtreal =   1 ; initial fnrm = 0.120E-06
Number of func eval =  11 ; nonlin iters =   1 ; precondJac eval =   1
 iter=    0 fnrm=     0.1198894616516961E-06 nfe=      1
 iter=    1 fnrm=     0.4573487022653537E-11 nfe=     11


 nksol ---  iterm = 1.
            maxnorm(sf*f(u)) .le. ftol, where maxnorm() is
            the maximum norm function.  u is probably an
            approximate root of f.
 Interpolants created; mype =                   -1
Step number at this dtreal =   2 ; initial fnrm = 0.125E-07
Number of func eval =  11 ; nonlin iters =   1 ; precondJac eval =   0
 iter=    0 fnrm=     0.1251374411625739E-07 nfe=      1
 iter=    1 fnrm=     0.1100930325265119E-12 nfe=     12


 nksol ---  iterm = 1.
            maxnorm(sf*f(u)) .le. ftol, where maxnorm() is
            the maximum norm function.  u is probably an
            approximate root of f.
 Interpolants created; mype =                   -1
Step number at this dtreal =   3 ; initial fnrm = 0.131E-08
Number of func eval =  12 ; nonlin iters =   1 ; precondJac eval =   0
 iter=    0 fnrm=     0.1305922074799284E-08 nfe=      1
 iter=    1 fnrm=     0.7879268981616436E-12 nfe=     13


 nksol ---  iterm = 1.
            maxnorm(sf*f(u)) .le. ftol, where maxnorm() is
            the maximum norm function.  u is probably an
            approximate root of f.
 Interpolants created; mype =                   -1
Step number at this dtreal =   4 ; initial fnrm = 0.136E-09
Number of func eval =  13 ; nonlin iters =   1 ; precondJac eval =   0
 iter=    0 fnrm=     0.1362437488064965E-09 nfe=      1
 iter=    1 fnrm=     0.9391791840926710E-13 nfe=     14


 nksol ---  iterm = 1.
            maxnorm(sf*f(u)) .le. ftol, where maxnorm() is
            the maximum norm function.  u is probably an
            approximate root of f.
 Interpolants created; mype =                   -1
Step number at this dtreal =   5 ; initial fnrm = 0.142E-10
Number of func eval =  14 ; nonlin iters =   1 ; precondJac eval =   0
  
*** Number time-step changes = 19  and dt = 0.957E-01 sec
 ----------------------------------------------------
  Updating Jacobian, npe =                      1
 iter=    0 fnrm=     0.1421852833924434E-10 nfe=      1


 nksol ---  iterm = 1.
            maxnorm(sf*f(u)) .le. ftol, where maxnorm() is
            the maximum norm function.  u is probably an
            approximate root of f.
 Interpolants created; mype =                   -1
Step number at this dtreal =   1 ; initial fnrm = 0.142E-10
Number of func eval =   1 ; nonlin iters =   0 ; precondJac eval =   0
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-7-2ae3ca8cd1e6> in <module>()
      1 bbb.t_stop=1e0
----> 2 bbb.rundt()
      3 bbb.dtreal=1e20
      4 bbb.isbcwdt=0
      5 bbb.exmain()

RuntimeError: **Error: need initial Jacobian-pair for icntnunk=1

If bbb.t_stop <= 1e-1, the simulation converges before this error occurs, and I have been using this for the time being. However, I know that the convention for UEDGE is for bbb.t_stop = 1 or bbb.t_stop = 10 to achieve a solution that is very close to steady state, so I was wondering if there is something that needs to be adjusted for the code to run smoothly. If it helps, the setup I have been using with bbb.t_stop = 1e-1 and the first bbb.ftol = 1 works for both bbb.isbohmcalc = 1 and bbb.isbohmcalc = 0.