Skip to content

Commit

Permalink
Merge pull request #70 from holm10/fniycbo_netzero
Browse files Browse the repository at this point in the history
Adds controls for fniycbo, the core drift currents
  • Loading branch information
holm10 authored Jan 12, 2024
2 parents c778688 + 99df7a3 commit a232747
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
5 changes: 5 additions & 0 deletions bbb/bbb.v
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ isnicore(nispmx) integer /1,30*0/ +input #switch for ion-density core B.
#=4, use impur. source terms (impur only)
#=5, set d(ni)/dy=-ni/lynicore at midp &
# ni constant poloidally
isfniycbozero real /0./ +input # Switch for divergence-free fluxes on core boundary
#=0, allows divergence-free fluxes to modify net core flux
#=1, redistributes fluxes due to divergence-free term
# without affecting the net core boundary flux
#=-1,assumes no divergence-free fluxes on the core boundary
isupcore(nispmx) integer /nispmx*0/ +input #=0 sets up=upcore on core bdry
#=1 sets d(up)/dy=0 on the core bdry
#=2 sets d^2(up)/dy^2 = 0
Expand Down
23 changes: 22 additions & 1 deletion bbb/oderhs.m
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ subroutine pandf (xc, yc, neq, time, yl, yldot)
. zeffave, noavex, noavey, tiavey, tgavey, psordisold,
. nucxiold(nigmx), nueliold(nigmx), nuelgold(nigmx), rrfac, visxtmp,
. vttn, vttp, neavex, pwrebkgold, pwribkgold, feexflr, feixflr,
. naavex,naavey,nuelmolx,nuelmoly
. naavex,naavey,nuelmolx,nuelmoly,fniycboave
real fqpo, fqpom, friceo, friceom, upeo, upeom, fricio(100),
. friciom(100), upio(100), upiom(100), uupo(100), uupom(100)
real nevol, ngvol, kionz, krecz, kcxrz, kionm, krecm, kcxrm, nzbg,
Expand Down Expand Up @@ -3347,6 +3347,27 @@ ccc iysptrx is the last closed flux surface (see S.R. nphygeo)
enddo
enddo

c ... Normalize core flux to zero to avoid introducing artifical core source/sink
if (isfniycbozero .gt. 0) then
fniycboave = 0
do ifld = 1, nfsp
do ix = ixpt1(1)+1, ixpt2(1)
fniycboave = fniycboave + fniycbo(ix, ifld)
end do
fniycboave = fniycboave / (ixpt2(1) - ixpt1(1))
do ix = ixpt1(1)+1, ixpt2(1)
fniycbo(ix, ifld) = fniycbo(ix, ifld) - isfniycbozero*fniycboave
end do
end do
else if (isfniycbozero .lt. 0) then
do ifld = 1, nfsp
do ix = ixpt1(1)+1, ixpt2(1)
fniycbo(ix, ifld) = 0
end do
end do
end if



c----------------------------------------------------------------------c
c SCALE SOURCE TERMS FROM MONTE-CARLO-NEUTRALS MODEL
Expand Down

0 comments on commit a232747

Please sign in to comment.