Skip to content

Commit

Permalink
Added profile curvatures inputs to output
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Candy committed May 3, 2024
1 parent 43c6703 commit 3d337ff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
11 changes: 10 additions & 1 deletion cgyro/src/cgyro_write_initdata.f90
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ subroutine cgyro_write_initdata
is,int(z(is)),dens(is),temp(is),mass(is),dlnndr(is),dlntdr(is),nu(is)
enddo

! Profile shear
! Profile shear (let s=curvature, k=gradient)
!
! k(x) = k(0) + s * r/rho
!
! where x = r/rho. The half-domain has -L/4 < r < L/4.
if (profile_shear_flag == 1) then
write(io,*)
write(io,'(a)') ' i s(a/Ln) (a/Ln)_L (a/Ln)_R | s(a/Lt) (a/Lt)_L (a/Lt)_R '
Expand Down Expand Up @@ -219,6 +223,11 @@ subroutine cgyro_write_initdata
write (io,fmtstr) dlntdr(is)
write (io,fmtstr) nu(is)
enddo
! Added 3 May 2024
do is=1,n_species
write (io,fmtstr) sdlnndr(is)
write (io,fmtstr) sdlntdr(is)
enddo
close(io)

endif
Expand Down
18 changes: 12 additions & 6 deletions f2py/pygacode/cgyro/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,14 +491,20 @@ def getgrid(self):
self.temp[i],p = self.eget(data,p)
self.dlnndr[i],p = self.eget(data,p)
self.dlntdr[i],p = self.eget(data,p)
self.nu[i],p = self.eget(data,p)
self.nu[i],p = self.eget(data,p)

# Added 3 May 2024
self.sdlnndr = np.zeros(ns)
self.sdlntdr = np.zeros(ns)
for i in range(ns):
self.sdlnndr[i],p = self.eget(data,p)
self.sdlntdr[i],p = self.eget(data,p)

if p == -1:
print('ERROR: (getgrid) Data format outdated. Please run cgyro -t')
sys.exit()

if not self.silent:
print('INFO: (getgrid) Read {:d} entries out.cgyro.equilibrium.'.format(p))
print('WARNING: (getgrid) Data format outdated. Please run cgyro -t')
else:
if not self.silent:
print('INFO: (getgrid) Read {:d} entries out.cgyro.equilibrium.'.format(p))

#-----------------------------------------------------------------

Expand Down

0 comments on commit 3d337ff

Please sign in to comment.