Skip to content
Snippets Groups Projects
Commit b62159cf authored by Antoine Cyril David Hoffmann's avatar Antoine Cyril David Hoffmann
Browse files

partial update to refresh home computer files

parent bba2d18b
Branches
Tags
No related merge requests found
module closure
! Contains the routines to define closures
USE basic
USE model, ONLY: CLOS, tau_e, tau_i, q_e, q_i, eta_B, nu
USE model, ONLY: CLOS, tau_e, tau_i, q_e, q_i, nu
USE grid
USE array, ONLY: kernel_e, kernel_i
USE fields, ONLY: moments_e, moments_i
......
......@@ -43,7 +43,9 @@ zloop: DO iz = izs,ize
real_data_c = 0._dp ! initialize sum over real nonlinear term
! Set non linear sum truncation
IF (NL_CLOS .EQ. -2) THEN
IF (NL_CLOS .EQ. -3) THEN
return
ELSEIF (NL_CLOS .EQ. -2) THEN
nmax = Jmaxe
ELSEIF (NL_CLOS .EQ. -1) THEN
nmax = Jmaxe-(ij-1)
......@@ -139,7 +141,9 @@ zloop: DO iz = izs,ize
real_data_c = 0._dp ! initialize sum over real nonlinear term
! Set non linear sum truncation
IF (NL_CLOS .EQ. -2) THEN
IF (NL_CLOS .EQ. -3) THEN
return
ELSEIF (NL_CLOS .EQ. -2) THEN
nmax = Jmaxi
ELSEIF (NL_CLOS .EQ. -1) THEN
nmax = Jmaxi-(ij-1)
......
......@@ -32,11 +32,11 @@ END SUBROUTINE update_ghosts
! [a b|C D|e f] : proc n has moments a to f where a,b,e,f are ghosts
!
!proc 0: [0 1 2 3 4|5 6]
! V V ^ ^
! V V ^ ^
!proc 1: [3 4|5 6 7 8|9 10]
! V V ^ ^
!proc 2: [7 8|9 10 11 12|13 14]
! V V ^ ^
! V V ^ ^
!proc 3: [11 12|13 14 15 16|17 18]
! ^ ^
!Closure by zero truncation : 0 0
......
......@@ -342,7 +342,6 @@ CONTAINS
DO ikp = ikps,ikpe
kparray(ikp) = REAL(ikp-1,dp) * deltakx
ENDDO
write(*,*) rank_kx, ': ikps = ', ikps, 'ikpe = ',ikpe
two_third_kpmax = SQRT(two_third_kxmax**2+two_third_kymax**2)
kp_max = 3._dp/2._dp * two_third_kpmax
END SUBROUTINE
......
......@@ -20,9 +20,11 @@ MODULE model
REAL(dp), PUBLIC, PROTECTED :: sigma_i = 1._dp !
REAL(dp), PUBLIC, PROTECTED :: q_e = -1._dp ! Charge
REAL(dp), PUBLIC, PROTECTED :: q_i = 1._dp !
REAL(dp), PUBLIC, PROTECTED :: eta_n = 1._dp ! Density gradient
REAL(dp), PUBLIC, PROTECTED :: eta_T = 1._dp ! Temperature gradient
REAL(dp), PUBLIC, PROTECTED :: eta_B = 1._dp ! Magnetic gradient
REAL(dp), PUBLIC, PROTECTED :: K_n = 1._dp ! Density drive
REAL(dp), PUBLIC, PROTECTED :: K_T = 0._dp ! Temperature drive
REAL(dp), PUBLIC, PROTECTED :: K_E = 0._dp ! Backg. electric field drive
REAL(dp), PUBLIC, PROTECTED :: GradB = 1._dp ! Magnetic gradient
REAL(dp), PUBLIC, PROTECTED :: CurvB = 1._dp ! Magnetic curvature
REAL(dp), PUBLIC, PROTECTED :: lambdaD = 1._dp ! Debye length
REAL(dp), PUBLIC, PROTECTED :: taue_qe ! factor of the magnetic moment coupling
......@@ -50,7 +52,7 @@ CONTAINS
IMPLICIT NONE
NAMELIST /MODEL_PAR/ CO, CLOS, NL_CLOS, KERN, NON_LIN, mu, mu_p, mu_j, nu, tau_e, tau_i, sigma_e, sigma_i, &
q_e, q_i, eta_n, eta_T, eta_B, lambdaD
q_e, q_i, K_n, K_T, K_E, GradB, CurvB, lambdaD
READ(lu_in,model_par)
......@@ -92,22 +94,22 @@ CONTAINS
INTEGER, INTENT(in) :: fidres
CHARACTER(len=256), INTENT(in) :: str
CALL attach(fidres, TRIM(str), "CO", CO)
CALL attach(fidres, TRIM(str), "CLOS", CLOS)
CALL attach(fidres, TRIM(str), "KERN", KERN)
CALL attach(fidres, TRIM(str), "NON_LIN", NON_LIN)
CALL attach(fidres, TRIM(str), "nu", nu)
CALL attach(fidres, TRIM(str), "mu", mu)
CALL attach(fidres, TRIM(str), "tau_e", tau_e)
CALL attach(fidres, TRIM(str), "tau_i", tau_i)
CALL attach(fidres, TRIM(str), "sigma_e", sigma_e)
CALL attach(fidres, TRIM(str), "sigma_i", sigma_i)
CALL attach(fidres, TRIM(str), "q_e", q_e)
CALL attach(fidres, TRIM(str), "q_i", q_i)
CALL attach(fidres, TRIM(str), "eta_n", eta_n)
CALL attach(fidres, TRIM(str), "eta_T", eta_T)
CALL attach(fidres, TRIM(str), "eta_B", eta_B)
CALL attach(fidres, TRIM(str), "lambdaD", lambdaD)
CALL attach(fidres, TRIM(str), "CO", CO)
CALL attach(fidres, TRIM(str), "CLOS", CLOS)
CALL attach(fidres, TRIM(str), "KERN", KERN)
CALL attach(fidres, TRIM(str), "NON_LIN", NON_LIN)
CALL attach(fidres, TRIM(str), "nu", nu)
CALL attach(fidres, TRIM(str), "mu", mu)
CALL attach(fidres, TRIM(str), "tau_e", tau_e)
CALL attach(fidres, TRIM(str), "tau_i", tau_i)
CALL attach(fidres, TRIM(str), "sigma_e", sigma_e)
CALL attach(fidres, TRIM(str), "sigma_i", sigma_i)
CALL attach(fidres, TRIM(str), "q_e", q_e)
CALL attach(fidres, TRIM(str), "q_i", q_i)
CALL attach(fidres, TRIM(str), "K_n", K_n)
CALL attach(fidres, TRIM(str), "K_T", K_T)
CALL attach(fidres, TRIM(str), "K_E", K_E)
CALL attach(fidres, TRIM(str), "lambdaD", lambdaD)
END SUBROUTINE model_outputinputs
END MODULE model
......@@ -44,7 +44,7 @@ SUBROUTINE moments_eq_rhs_e
ELSE
! Loop on kspace
zloope : DO iz = izs,ize
! Periodic BC for first order derivative
! Periodic BC for parallel centered finite differences
iznext = iz+1; izprev = iz-1;
IF(iz .EQ. 1) izprev = Nz
IF(iz .EQ. Nz) iznext = 1
......@@ -116,15 +116,23 @@ SUBROUTINE moments_eq_rhs_e
!! Sum of all linear terms (the sign is inverted to match RHS)
moments_rhs_e(ip,ij,ikx,iky,iz,updatetlevel) = &
! Perpendicular magnetic gradient/curvature effects
- imagu*Ckxky(ikx,iky,iz) * (Tnepj + Tnepp2j + Tnepm2j + Tnepjp1 + Tnepjm1)&
! Parallel coupling (Landau Damping)
- Tpare/2._dp/deltaz*gradz_coeff(iz) &
! Mirror term (parallel magnetic gradient)
- gradzB(iz)* Tmir *gradz_coeff(iz) &
- i_ky * Tphi &
! Drives (density + temperature gradients)
- i_ky * Tphi &
! Electrostatic background gradients
- i_ky * K_E * moments_e(ip,ij,ikx,iky,iz,updatetlevel) &
! Numerical hyperdiffusion (totally artificial, for stability purpose)
- mu*kperp2**2 * moments_e(ip,ij,ikx,iky,iz,updatetlevel) &
! Collision term
+ TColl
!! Adding non linearity
IF ( NON_LIN ) THEN
IF ( NON_LIN .AND. (NL_CLOS .GT. -3)) THEN
moments_rhs_e(ip,ij,ikx,iky,iz,updatetlevel) = &
moments_rhs_e(ip,ij,ikx,iky,iz,updatetlevel) - Sepj(ip,ij,ikx,iky,iz)
ENDIF
......@@ -258,17 +266,25 @@ SUBROUTINE moments_eq_rhs_i
TColl = TColl_i(ip,ij,ikx,iky,iz)
ENDIF
!! Sum of linear terms
moments_rhs_i(ip,ij,ikx,iky,iz,updatetlevel) = &
!! Sum of all linear terms (the sign is inverted to match RHS)
moments_rhs_e(ip,ij,ikx,iky,iz,updatetlevel) = &
! Perpendicular magnetic gradient/curvature effects
- imagu*Ckxky(ikx,iky,iz) * (Tnipj + Tnipp2j + Tnipm2j + Tnipjp1 + Tnipjm1)&
! Parallel coupling (Landau Damping)
- Tpari/2._dp/deltaz*gradz_coeff(iz) &
! Mirror term (parallel magnetic gradient)
- gradzB(iz)* Tmir *gradz_coeff(iz) &
- i_ky * Tphi &
! Drives (density + temperature gradients)
- i_ky * Tphi &
! Electrostatic background gradients
- i_ky * K_E * moments_i(ip,ij,ikx,iky,iz,updatetlevel) &
! Numerical hyperdiffusion (totally artificial, for stability purpose)
- mu*kperp2**2 * moments_i(ip,ij,ikx,iky,iz,updatetlevel) &
! Collision term
+ TColl
!! Adding non linearity
IF ( NON_LIN ) THEN
IF ( NON_LIN .AND. (NL_CLOS .GT. -3)) THEN
moments_rhs_i(ip,ij,ikx,iky,iz,updatetlevel) = &
moments_rhs_i(ip,ij,ikx,iky,iz,updatetlevel) - Sipj(ip,ij,ikx,iky,iz)
ENDIF
......
......@@ -158,7 +158,8 @@ END SUBROUTINE evaluate_kernels
SUBROUTINE compute_lin_coeff
USE array
USE model, ONLY: taue_qe, taui_qi, sqrtTaue_qe, sqrtTaui_qi, eta_T, eta_n
USE model, ONLY: taue_qe, taui_qi, sqrtTaue_qe, sqrtTaui_qi, &
K_T, K_n, CurvB, GradB
USE prec_const
USE grid, ONLY: parray_e, parray_i, jarray_e, jarray_i, &
ip,ij, ips_e,ipe_e, ips_i,ipe_i, ijs_e,ije_e, ijs_i,ije_i
......@@ -173,7 +174,8 @@ SUBROUTINE compute_lin_coeff
DO ij = ijs_e, ije_e
j_int= jarray_e(ij) ! Laguerre degree
j_dp = REAL(j_int,dp) ! REAL of Laguerre degree
xnepj(ip,ij) = taue_qe * 2._dp * (p_dp + j_dp + 1._dp)
xnepj(ip,ij) = taue_qe*(CurvB*(2._dp*p_dp + 1._dp) &
+GradB*(2._dp*j_dp + 1._dp))
ynepp1j (ip,ij) = -SQRT(tau_e)/sigma_e * (j_dp+1)*SQRT(p_dp+1._dp)
ynepm1j (ip,ij) = -SQRT(tau_e)/sigma_e * (j_dp+1)*SQRT(p_dp)
ynepp1jm1(ip,ij) = +SQRT(tau_e)/sigma_e * j_dp*SQRT(p_dp+1._dp)
......@@ -205,7 +207,8 @@ SUBROUTINE compute_lin_coeff
DO ij = ijs_i, ije_i
j_int= jarray_i(ij) ! Laguerre degree
j_dp = REAL(j_int,dp) ! REAL of Laguerre degree
xnipj(ip,ij) = taui_qi * 2._dp * (p_dp + j_dp + 1._dp)
xnepj(ip,ij) = taui_qi*(CurvB*(2._dp*p_dp + 1._dp) &
+GradB*(2._dp*j_dp + 1._dp))
ynipp1j (ip,ij) = -SQRT(tau_i)/sigma_i * (j_dp+1)*SQRT(p_dp+1._dp)
ynipm1j (ip,ij) = -SQRT(tau_i)/sigma_i * (j_dp+1)*SQRT(p_dp)
ynipp1jm1(ip,ij) = +SQRT(tau_i)/sigma_i * j_dp*SQRT(p_dp+1._dp)
......@@ -238,11 +241,11 @@ SUBROUTINE compute_lin_coeff
j_dp = REAL(j_int,dp) ! REALof Laguerre degree
!! Electrostatic potential pj terms
IF (p_int .EQ. 0) THEN ! kronecker p0
xphij(ip,ij) =+eta_n + 2.*j_dp*eta_T
xphijp1(ip,ij) =-eta_T*(j_dp+1._dp)
xphijm1(ip,ij) =-eta_T* j_dp
xphij(ip,ij) =+K_n + 2.*j_dp*K_T
xphijp1(ip,ij) =-K_T*(j_dp+1._dp)
xphijm1(ip,ij) =-K_T* j_dp
ELSE IF (p_int .EQ. 2) THEN ! kronecker p2
xphij(ip,ij) =+eta_T/SQRT2
xphij(ip,ij) =+K_T/SQRT2
xphijp1(ip,ij) = 0._dp; xphijm1(ip,ij) = 0._dp;
ELSE
xphij(ip,ij) = 0._dp; xphijp1(ip,ij) = 0._dp
......
character(len=40) VERSION
character(len=40) BRANCH
character(len=20) AUTHOR
character(len=40) EXECDATE
character(len=40) HOST
parameter (VERSION='d118c2b-dirty')
parameter (BRANCH='master')
parameter (AUTHOR='ahoffman')
parameter (EXECDATE='Thu Oct 7 17:18:16 CEST 2021')
parameter (HOST ='spcpc606')
character(len=40) VERSION
character(len=40) BRANCH
character(len=20) AUTHOR
character(len=40) EXECDATE
character(len=40) HOST
parameter (VERSION='d118c2b-dirty')
parameter (BRANCH='master')
parameter (AUTHOR='ahoffman')
parameter (EXECDATE='Thu Oct 7 17:18:16 CEST 2021')
parameter (HOST ='spcpc606')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment