Skip to content

Commit 89bbf74

Browse files
authored
Merge pull request #230 from danielver02/kgk-kperp-norm-250716
Kgk kperp norm 250716
2 parents 6aeb3bb + 80cbe6e commit 89bbf74

19 files changed

Lines changed: 311 additions & 128 deletions

input.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ Selection for root finding method.
6262
**`numiter`**
6363
Maximum number of iterations in secant method.
6464

65+
**`kperp_norm`**
66+
Choice of:
67+
68+
- True: Follow's Stix (10-57) normalization convention.
69+
- False: Multiplies Stix (10-57) by $k_{\perp}^2 d_{ref}^2$.
70+
71+
Depending on the user's choice of normalization, `D_threshold` needs to be adjusted to account for additional factors of $k_{\perp}^6 d_{ref}^6$.
72+
6573
**`D_threshold`**
6674
Minimum threshold for secant method.
6775

src/ALPS_NHDS.f90

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ subroutine calc_chi(chi,chi_low,j,kz,kperp,x)
6060
!! Subroutine that calculates the susceptibility of species j based on NHDS.
6161
use alps_var, only : bMnmaxs, bMBessel_zeros, bMbetas, bMalphas,bMpdrifts
6262
use alps_var, only : ms, qs, ns
63+
use alps_var, only : kperp_norm
6364
implicit none
6465

6566
double complex, intent(out) :: chi(3,3)
@@ -193,7 +194,11 @@ subroutine calc_chi(chi,chi_low,j,kz,kperp,x)
193194
chi(2,3)=Y(2,3)/(ell*ell)
194195
chi(3,1)=Y(3,1)/(ell*ell)
195196
chi(3,2)=Y(3,2)/(ell*ell)
196-
chi(3,3)=kperp*kperp*2.d0*x*vdrift/(ell*ell*kz*vtherm*vtherm*bMalphas(j))+Y(3,3)/(ell*ell)
197+
if (kperp_norm) then
198+
chi(3,3)=2.d0*x*vdrift/(ell*ell*kz*vtherm*vtherm*bMalphas(j))+Y(3,3)/(ell*ell)
199+
else
200+
chi(3,3)=kperp*kperp*2.d0*x*vdrift/(ell*ell*kz*vtherm*vtherm*bMalphas(j))+Y(3,3)/(ell*ell)
201+
endif
197202

198203
n=0
199204
chi_low(1,1,n)=Y0(1,1)/(ell*ell)
@@ -204,7 +209,11 @@ subroutine calc_chi(chi,chi_low,j,kz,kperp,x)
204209
chi_low(2,3,n)=Y0(2,3)/(ell*ell)
205210
chi_low(3,1,n)=Y0(3,1)/(ell*ell)
206211
chi_low(3,2,n)=Y0(3,2)/(ell*ell)
207-
chi_low(3,3,n)=Y0(3,3)/(ell*ell)+kperp*kperp*2.d0*x*vdrift/(ell*ell*kz*vtherm*vtherm*bMalphas(j))
212+
if (kperp_norm) then
213+
chi_low(3,3,n)=Y0(3,3)/(ell*ell)+2.d0*x*vdrift/(ell*ell*kz*vtherm*vtherm*bMalphas(j))
214+
else
215+
chi_low(3,3,n)=Y0(3,3)/(ell*ell)+kperp*kperp*2.d0*x*vdrift/(ell*ell*kz*vtherm*vtherm*bMalphas(j))
216+
endif
208217

209218
n=1
210219
chi_low(1,1,n)=Y1(1,1)/(ell*ell)
@@ -242,6 +251,7 @@ subroutine calc_ypsilon(Y,j,n,kz,kperp,x)
242251
!! Calculates the Y-tensor according to Stix for a bi-Maxwelling, using the NHDS calculation.
243252
use alps_var, only : bMbetas, bMalphas,bMpdrifts
244253
use alps_var, only : ms, qs, ns
254+
use alps_var, only : kperp_norm
245255
implicit none
246256

247257
double complex, parameter :: uniti=(0.d0,1.d0)
@@ -338,28 +348,29 @@ subroutine calc_ypsilon(Y,j,n,kz,kperp,x)
338348
endif
339349

340350

341-
! The tensor in Stix's (10-57)
342-
!Y(1,1)=1.d0*(n*n)*BInz*An/z
343-
!Y(1,2)=-uniti*n*(BInz-dBInzdz)*An
344-
!Y(1,3)=kperp*n*BInz*Bn/(Omega*z)
345-
!Y(2,1)=uniti*n*(BInz-dBInzdz)*An
346-
!Y(2,2)=(1.d0*(n*n)*BInz/z+2.d0*z*BInz-2.d0*z*dBInzdz)*An
347-
!Y(2,3)=uniti*kperp*(BInz-dBInzdz)*Bn/Omega
348-
!Y(3,1)=kperp*BInz*n*Bn/(Omega*z)
349-
!Y(3,2)=-uniti*kperp*(BInz-dBInzdz)*Bn/Omega
350-
!Y(3,3)=2.d0*(x-1.d0*n*Omega)*BInz*Bn/(kz*vtherm*vtherm*bMalphas(j))
351-
352-
! The tensor in Stix's (10-57), multiplied by kperp^2 d_ref^2
353-
Y(1,1)=1.d0*(n*n)*BInz*An/zp
354-
Y(1,2)=-uniti*n*(BInz-dBInzdz)*An*kperp*kperp
355-
Y(1,3)=kperp*n*BInz*Bn/(Omega*zp)
356-
Y(2,1)=uniti*n*(BInz-dBInzdz)*An*kperp*kperp
357-
Y(2,2)=(1.d0*(n*n)*BInz/zp+kperp*kperp*2.d0*z*BInz-kperp*kperp*2.d0*z*dBInzdz)*An
358-
Y(2,3)=uniti*kperp*kperp*kperp*(BInz-dBInzdz)*Bn/Omega
359-
Y(3,1)=kperp*BInz*n*Bn/(Omega*zp)
360-
Y(3,2)=-uniti*kperp*kperp*kperp*(BInz-dBInzdz)*Bn/Omega
361-
Y(3,3)=kperp*kperp*2.d0*(x-1.d0*n*Omega)*BInz*Bn/(kz*vtherm*vtherm*bMalphas(j))
362-
351+
if (kperp_norm) then
352+
! The tensor in Stix's (10-57)
353+
Y(1,1)=1.d0*(n*n)*BInz*An/z
354+
Y(1,2)=-uniti*n*(BInz-dBInzdz)*An
355+
Y(1,3)=kperp*n*BInz*Bn/(Omega*z)
356+
Y(2,1)=uniti*n*(BInz-dBInzdz)*An
357+
Y(2,2)=(1.d0*(n*n)*BInz/z+2.d0*z*BInz-2.d0*z*dBInzdz)*An
358+
Y(2,3)=uniti*kperp*(BInz-dBInzdz)*Bn/Omega
359+
Y(3,1)=kperp*BInz*n*Bn/(Omega*z)
360+
Y(3,2)=-uniti*kperp*(BInz-dBInzdz)*Bn/Omega
361+
Y(3,3)=2.d0*(x-1.d0*n*Omega)*BInz*Bn/(kz*vtherm*vtherm*bMalphas(j))
362+
else
363+
! The tensor in Stix's (10-57), multiplied by kperp^2 d_ref^2
364+
Y(1,1)=1.d0*(n*n)*BInz*An/zp
365+
Y(1,2)=-uniti*n*(BInz-dBInzdz)*An*kperp*kperp
366+
Y(1,3)=kperp*n*BInz*Bn/(Omega*zp)
367+
Y(2,1)=uniti*n*(BInz-dBInzdz)*An*kperp*kperp
368+
Y(2,2)=(1.d0*(n*n)*BInz/zp+kperp*kperp*2.d0*z*BInz-kperp*kperp*2.d0*z*dBInzdz)*An
369+
Y(2,3)=uniti*kperp*kperp*kperp*(BInz-dBInzdz)*Bn/Omega
370+
Y(3,1)=kperp*BInz*n*Bn/(Omega*zp)
371+
Y(3,2)=-uniti*kperp*kperp*kperp*(BInz-dBInzdz)*Bn/Omega
372+
Y(3,3)=kperp*kperp*2.d0*(x-1.d0*n*Omega)*BInz*Bn/(kz*vtherm*vtherm*bMalphas(j))
373+
endif
363374

364375
end subroutine
365376

@@ -369,6 +380,7 @@ subroutine calc_chi_cold(chi,j,kz,kperp,x)
369380
!! Subroutine that calculates the susceptibility of species j based on the cold-plasma dispersion relation based on the paper Verscharen & Chandran, ApJ 764, 88, 2013.
370381
use alps_var, only : bMbetas,bMpdrifts
371382
use alps_var, only : ms, qs, ns
383+
use alps_var, only : kperp_norm
372384
implicit none
373385

374386
double complex, intent(out) :: chi(3,3)
@@ -434,16 +446,21 @@ subroutine calc_chi_cold(chi,j,kz,kperp,x)
434446
dispM=uniti*(1.d0/(ell*ell))*kperp*vdrift*Omega/((x-kz*vdrift)**2-Omega**2)
435447

436448

437-
chi(1,1)=(dispR+dispL)/2.d0
438-
chi(1,2)=-uniti*(dispR-dispL)/2.d0
439-
chi(1,3)=dispJ
440-
chi(2,1)=uniti*(dispR-dispL)/2.d0
441-
chi(2,2)=(dispR+dispL)/2.d0
442-
chi(2,3)=dispM
443-
chi(3,1)=dispJ
444-
chi(3,2)=-dispM
445-
chi(3,3)=dispP
446-
449+
if (kperp_norm) then
450+
chi(1,1)=(dispR+dispL)/2.d0
451+
chi(1,2)=-uniti*(dispR-dispL)/2.d0
452+
chi(1,3)=dispJ
453+
chi(2,1)=uniti*(dispR-dispL)/2.d0
454+
chi(2,2)=(dispR+dispL)/2.d0
455+
chi(2,3)=dispM
456+
chi(3,1)=dispJ
457+
chi(3,2)=-dispM
458+
chi(3,3)=dispP
459+
else
460+
write(*,*) 'ERROR: check kperp norm for cold plasma distribution!!'
461+
stop
462+
endif
463+
447464
end subroutine
448465

449466

src/ALPS_com.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ subroutine pass_instructions
3232
use alps_var, only : ns, qs, ms, wroots, kperp, kpar, bessel_zero
3333
use alps_var, only : wave, chi0, chi0_low, pp, df0, vA, pi
3434
use alps_var, only : secant_method, numiter, D_threshold, D_gap, D_prec
35-
use alps_var, only : use_map
35+
use alps_var, only : use_map, kperp_norm
3636
use alps_var, only : ni, nr, omi, omf, gami, gamf, loggridg, loggridw
3737
use alps_var, only : determine_minima, n_resonance_interval, positions_principal, Tlim
3838
use alps_var, only : n_scan, scan, scan_option, relativistic, logfit, usebM
@@ -65,6 +65,7 @@ subroutine pass_instructions
6565
call mpi_bcast(D_gap,1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierror)
6666
call mpi_bcast(Tlim, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierror)
6767
call mpi_bcast(use_map, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierror)
68+
call mpi_bcast(kperp_norm, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierror)
6869
call mpi_bcast(n_scan, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierror)
6970
call mpi_bcast(scan_option, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierror)
7071
call mpi_bcast(secant_method, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierror)

0 commit comments

Comments
 (0)