LLNL / UEDGE

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improper resetting of pandf during jacobian calculation

jguterl opened this issue · comments

There are two variables in pandf subroutine which are not reinitalized between each call:

  • the variable resmo in the following block for neutral species (zi(ifld)=0). I suggest to add an "else" statement to set resmo to zero when zi=0 (see cJG:suggested correction). The residual of the momentum for the gas species is thus wrong when nusp>1 which is the case when nhsp>1.

      do 99 iy = j2, j5
         do 98 ix = i2, i5
            ix2 = ixp1(ix,iy)
            if (zi(ifld) .ne. 0) then  # additions only for charged ions
               dp1 =  cngmom(ifld)*(1/fac2sp)*
                        ( ng(ix2,iy,1)*tg(ix2,iy,1)-
                          ng(ix ,iy,1)*tg(ix ,iy,1) )
               resmo(ix,iy,ifld) = 0.
               resmo(ix,iy,ifld) =
                    smoc(ix,iy,ifld)
                  + smov(ix,iy,ifld) * up(ix,iy,ifld)
                  - cfneut * cfneutsor_mi * sx(ix,iy) * rrv(ix,iy) * dp1
                  - cfneut * cfneutsor_mi * cmwall(ifld)*0.5*(ng(ix,iy,1)+ng(ix2,iy,1))
                        * mi(ifld)*up(ix,iy,ifld)*0.5
                        *(nucx(ix,iy,1)+nucx(ix2,iy,1))*volv(ix,iy)
                  + cmneut * cmneutsor_mi * uesor_up(ix,iy,ifld)
                  + cfmsor*(msor(ix,iy,ifld) + msorxr(ix,iy,ifld)) #### IJ 2017: needs *cfneut for multi-charge state ions & MC neutrals?
                  + volmsor(ix,iy,ifld)
                  + cfvisxneov*visvol_v(ix,iy,ifld)
                  + cfvisxneoq*visvol_q(ix,iy,ifld)
    c  Add drag with cold, stationary impurity neutrals
               if (ifld > nhsp) then
                 resmo(ix,iy,ifld) = resmo(ix,iy,ifld) - cfupimpg*
                      0.25*mi(ifld)*(ni(ix,iy,ifld)+ni(ix2,iy,ifld))*
                       ( nucxi(ix,iy,ifld)+nucxi(ix2,iy,ifld)+
                        nueli(ix,iy,ifld)+nueli(ix2,iy,ifld) )*
                         up(ix,iy,ifld)*volv(ix,iy)
                endif
     cJG: suggest correction
            else
               resmo(ix,iy,ifld) = 0
            endif
    
  • the electron power background variable pwrebkg is not reset properly when xinc!=0 or yinc!=0. That should not be a problem though as it is to prevent small values of pwrebkg. But that should be fixed for the pupose of code validation.