Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions cgyro/src/cgyro_init_arrays.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ subroutine cgyro_init_arrays
!-------------------------------------------------------------------------
! Distributed Bessel-function Gyroaverages

allocate(jloc_c(2,nc,nt1:nt2))
allocate(jloc_c(3,nc,nt1:nt2))

do itor=nt1,nt2
iv_loc = 0
Expand All @@ -63,6 +63,14 @@ subroutine cgyro_init_arrays
! Needed for B_parallel in GK and field equations

jloc_c(2,ic,itor) = 0.5*(jloc_c(1,ic,itor) + bessel_jn(2,arg))/bmag(it)

! Needed for Maxwell stress (A_parallel) term in momentum flux

if(itor == 0) then
jloc_c(3,ic,itor) = 0.0
else
jloc_c(3,ic,itor) = bessel_j0(arg)/(arg**2)
endif

enddo

Expand Down Expand Up @@ -95,15 +103,15 @@ subroutine cgyro_init_arrays

if (n_field > 1) then
efac = -xi(ix)*vel2(ie)*vth(is)
jxvec_c(2,ic,iv_loc,itor) = efac * fac * (bmag(it) * jloc_c(2,ic,itor))
jxvec_c(2,ic,iv_loc,itor) = efac * fac * (bmag(it) * jloc_c(2,ic,itor) + jloc_c(3,ic,itor))

if (n_field > 2) then
if(itor == 0) then
jxvec_c(3,ic,iv_loc,itor) = 0.0
else
jxvec_c(3,ic,iv_loc,itor) = fac * z(is)*bmag(it)/mass(is) &
/(k_perp(ic,itor)*rho)**2 &
* (bmag(it) * jloc_c(2,ic,itor) - jloc_c(1,ic,itor))
* (2 * bmag(it) * jloc_c(2,ic,itor) - jloc_c(1,ic,itor))
endif
endif

Expand Down
2 changes: 1 addition & 1 deletion cgyro/src/cgyro_init_h.f90
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ subroutine cgyro_init_h
h_x(ic,iv_loc,nt1) = rho/(1.0+ang**4)
else
! anti-symmetric
h_x(ic,iv_loc,nt1) = rho*ang/(1.0+ang**4)
h_x(ic,iv_loc,nt1) = 0.5*rho*(1+ang)/(1.0+ang**4)
endif
enddo
endif
Expand Down
Loading