Skip to content

Commit

Permalink
Adds recycling function to SB
Browse files Browse the repository at this point in the history
  • Loading branch information
holm10 committed Dec 4, 2024
1 parent 6876fb7 commit 9ff2541
Showing 1 changed file with 51 additions and 25 deletions.
76 changes: 51 additions & 25 deletions bbb/boundary.m
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ c_mpi Use(MpiVars) #module defined in com/mpivarsmod.F.in
real osmw
real t0

real harmave, onesided_maxwellian
real harmave, onesided_maxwellian, outflux_atom
real yld96

c ====================================================================
Expand Down Expand Up @@ -759,30 +759,56 @@ call sputchem (isch_sput(igsp), eng_sput, tvwalli(ix),
. * harmave(ng(ix,0,igsp), ng(ix,1,igsp))
. - fng_chem + sputflxpf(ix,igsp) ) / (osmw*n0g(igsp))
if(matwalli(ix) .gt. 0) then
if (recycwit(ix,igsp,1) .gt. 0.) then
fniy_recy = fac2sp*fniy(ix,0,1)
if(isrefluxclip==1) fniy_recy=min(fniy_recy,0.)
if (igsp .gt. nhgsp) fniy_recy = zflux
if (ishymol.eq.1 .and. igsp.eq.2) then # 2 atoms per molecule
if (isupgon(1) .eq. 1) then
fniy_recy = 0.5*( fniy(ix,0,1) + fniy(ix,0,2) )
else
fniy_recy = 0.5*( fniy(ix,0,1) + fngy(ix,0,1) )
endif
if(isrefluxclip==1) fniy_recy=min(fniy_recy,0.)
endif
osmw = onesided_maxwellian(
. cdifg(igsp)*tg(ix,0,igsp), 1.0, mg(igsp),
. sy(ix,0), tgmin*ev
. )
yldot(iv) = -nurlxg*( fngy(ix,0,igsp)
. + fniy_recy*recycwit(ix,igsp,1)
. - fngyi_use(ix,igsp) - fngysi(ix,igsp)
. + (1-albedoi(ix,igsp))*osmw
. * harmave(ng(ix,0,igsp), ng(ix, 1, igsp))
. - fng_chem + sputflxpf(ix,igsp)
. ) / (osmw*n0g(igsp))
elseif (recycwit(ix,igsp,1) < -1) then
fniy_recy = fac2sp*fniy(ix,0,1)
if(isrefluxclip==1)
. fniy_recy=min(fniy_recy,0.)
if (igsp .gt. nhgsp)
. fniy_recy = zflux
IF (ishymol .ne. 1) THEN
osmw = onesided_maxwellian(
. cdifg(igsp)*tg(ix,0,igsp), 1.0, mg(igsp),
. sy(ix,0), tgmin*ev
. )
yldot(iv) = -nurlxg*( fngy(ix,0,igsp)
. - fngyi_use(ix,igsp)
. - fngysi(ix,igsp)
. - outflux_atom(
. -fniy_recy,
. -harmave(ng(ix,0,igsp), ng(ix,1,igsp)),
. recycwit(ix,igsp,1),
. albedoi(ix,igsp)
. ) - fng_chem
. + sputflxpf(ix,igsp)
. ) / (osmw*n0g(igsp))

ELSE
IF (igsp .eq. 2) THEN
if (isupgon(1) .eq. 1) then
fniy_recy =
. 0.5*( fniy(ix,0,1) + fniy(ix,0,2) )
else
fniy_recy =
. 0.5*( fniy(ix,0,1) + fngy(ix,0,1) )
endif
if(isrefluxclip==1)
. fniy_recy=min(fniy_recy,0.)
ENDIF
osmw = onesided_maxwellian(
. cdifg(igsp)*tg(ix,0,igsp), 1.0, mg(igsp),
. sy(ix,0), tgmin*ev
. )
yldot(iv) = -nurlxg*( fngy(ix,0,igsp)
. + fniy_recy*recycwit(ix,igsp,1)
. - fngyi_use(ix,igsp) - fngysi(ix,igsp)
. + (1-albedoi(ix,igsp))*osmw
. * harmave(ng(ix,0,igsp), ng(ix, 1, igsp))
. - fng_chem + sputflxpf(ix,igsp)
. ) / (osmw*n0g(igsp))
ENDIF



if (recycwit(ix,igsp,1) < -1) then
yldot(iv)=nurlxg*(ngbackg(igsp)-ng(ix,0,igsp))/
. n0g(igsp)
elseif (recycwit(ix,igsp,1) .le. 0.) then # treat recycwit as albedo
Expand Down

0 comments on commit 9ff2541

Please sign in to comment.