Commit cd37c678 authored by Caneses Marin, Juan Francisco's avatar Caneses Marin, Juan Francisco
Browse files

Included plasmaTYP and fieldSplineTYP to all operators of the code

parent d1058505
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
&in_nml
! Simulation name:
! ===============
in%fileDescriptor = '2021_02_16a',
in%fileDescriptor = '2021_02_17c',

! Magnetic field input data:
! =========================
+1 −1
Original line number Diff line number Diff line
&in_nml
! Simulation name:
! ===============
in%fileDescriptor = '2021_02_16d',
in%fileDescriptor = '2021_02_17a',

! Magnetic field input data:
! =========================
+1 −1
Original line number Diff line number Diff line
&in_nml
! Simulation name:
! ===============
in%fileDescriptor = '2021_02_16d',
in%fileDescriptor = '2021_02_17b',

! Magnetic field input data:
! =========================
+1 KiB

File added.

No diff preview for this file type.

+121 −46
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@ END MODULE local
! =============================================================================
MODULE PhysicalConstants
USE local

IMPLICIT NONE

REAL(r8), PARAMETER :: e_0   = 8.854e-12
@@ -25,51 +24,6 @@ REAL(r8), PARAMETER :: c = 299792458 ! Speed of light [m/s]

END MODULE PhysicalConstants

! MODULE dataTYP
! =============================================================================
! Module containing definition of an object to contain all data used in
! computation
MODULE dataTYP
USE local

IMPLICIT NONE
TYPE inTYP
  CHARACTER*150 :: fileDescriptor, repoDir
  CHARACTER*150 :: BFieldFile, BFieldFileDir
  REAL(r8) :: Ti0, Te0, ne0, dt
  REAL(r8) :: Aion, Zion
  INTEGER(i4) :: Nparts, Nsteps, nz, species_a, species_b
  INTEGER(i4) :: jstart, jend, jincr
  INTEGER(i4) :: threads_given
  LOGICAL:: iDrag, iPotential, iSave, iPush, iHeat, iColl
  INTEGER(i4) :: IC_Type, BC_Type
  REAL(r8) :: IC_zp_mean, IC_Ep, IC_xip, IC_zp_std, IC_Tp
  REAL(r8) :: BC_zp_mean, BC_Ep, BC_xip, BC_zp_std, BC_Tp
  REAL(r8) :: zmin, zmax
  INTEGER(i4) :: CollOperType
  REAL(r8) :: elevel
  REAL(r8) :: s1, s2, s3, phi1, phi2, phi3
  REAL(r8) :: f_RF, kpar, kper, Ew, zRes1, zRes2
  INTEGER(i4) :: n_harmonic
  REAL(r8) :: tComputeTime, tSimTime                              ! Variables to hold cpu time at start and end of computation
  REAL(r8) :: Ma, qa
END TYPE inTYP
  
TYPE plasmaTYP
 TYPE(inTYP) :: in
 REAL(r8) :: NC, Nsteps, dt
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: zp, kep, xip, a
 INTEGER(i4), DIMENSION(:), ALLOCATABLE :: f1 , f2 , f3 , f4
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: dE1, dE2, dE3, dE4, dE3_hat
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: tau, Jm, rL, doppler
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: NR , NSP
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: Eplus, Eminus
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: Ndot1, Ndot2, Ndot3, Ndot4
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: Edot1, Edot2, Edot3, Edot4, Edot3_hat
END TYPE plasmaTYP

END MODULE dataTYP

! MODULE spline_fits
! =============================================================================
! Module containing arrays used in spline fits
@@ -251,3 +205,124 @@ CONTAINS
     END SUBROUTINE splint

END MODULE spline_fits

! MODULE dataTYP
! =============================================================================
! Module containing definition of an object to contain all data used in
! computation
MODULE dataTYP
USE local
USE spline_fits

IMPLICIT NONE
TYPE inTYP
  CHARACTER*150 :: fileDescriptor, repoDir
  CHARACTER*150 :: BFieldFile, BFieldFileDir
  REAL(r8) :: Ti0, Te0, ne0, dt
  REAL(r8) :: Aion, Zion
  INTEGER(i4) :: Nparts, Nsteps, nz, species_a, species_b
  INTEGER(i4) :: jstart, jend, jincr
  INTEGER(i4) :: threads_given
  LOGICAL:: iDrag, iPotential, iSave, iPush, iHeat, iColl
  INTEGER(i4) :: IC_Type, BC_Type
  REAL(r8) :: IC_zp_mean, IC_Ep, IC_xip, IC_zp_std, IC_Tp
  REAL(r8) :: BC_zp_mean, BC_Ep, BC_xip, BC_zp_std, BC_Tp
  REAL(r8) :: zmin, zmax
  INTEGER(i4) :: CollOperType
  REAL(r8) :: elevel
  REAL(r8) :: s1, s2, s3, phi1, phi2, phi3
  REAL(r8) :: f_RF, kpar, kper, Ew, zRes1, zRes2
  INTEGER(i4) :: n_harmonic
  REAL(r8) :: tComputeTime, tSimTime                              ! Variables to hold cpu time at start and end of computation
  REAL(r8) :: Ma, qa
END TYPE inTYP
  
TYPE plasmaTYP
 TYPE(inTYP) :: in
 REAL(r8) :: NC, Nsteps, dt
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: zp, kep, xip, a
 INTEGER(i4), DIMENSION(:), ALLOCATABLE :: f1 , f2 , f3 , f4
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: dE1, dE2, dE3, dE4, dE3_hat
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: tau, Jm, rL, doppler
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: NR , NSP
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: Eplus, Eminus
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: Ndot1, Ndot2, Ndot3, Ndot4
 REAL(r8)   , DIMENSION(:), ALLOCATABLE :: Edot1, Edot2, Edot3, Edot4, Edot3_hat
END TYPE plasmaTYP

TYPE fieldSplineTYP
 TYPE(splTYP) :: B, dB, ddB, V, dV, U
END TYPE fieldSplineTYP

CONTAINS
! ----------------------------------------------------------------------------
SUBROUTINE InitPlasma(plasma,in)
   IMPLICIT NONE
   ! Declare interface variables:
   TYPE(plasmaTYP), INTENT(INOUT) :: plasma
   TYPE(inTYP)    , INTENT(IN)    :: in

   ! Declare local variables:
   INTEGER(i4) :: NC, NS

   NC = in%Nparts
   NS = in%Nsteps
   
   ! Allocate memory: 
   ALLOCATE(plasma%zp(NC) ,plasma%kep(NC),plasma%xip(NC),plasma%a(NC)      )
   ALLOCATE(plasma%f1(NC) ,plasma%f2(NC) ,plasma%f3(NC) ,plasma%f4(NC)     )
   ALLOCATE(plasma%dE1(NC),plasma%dE2(NC),plasma%dE3(NC),plasma%dE4(NC)    )
   ALLOCATE(plasma%tau(NC),plasma%Jm(NC) ,plasma%rL(NC) ,plasma%doppler(NC))

   ALLOCATE(plasma%NR(NS)   ,plasma%NSP(NS)    )
   ALLOCATE(plasma%Eplus(NS),plasma%Eminus(NS) )
   ALLOCATE(plasma%Ndot1(NS),plasma%Ndot2(NS) ,plasma%Ndot3(NS),plasma%Ndot4(NS))
   ALLOCATE(plasma%Edot1(NS),plasma%Edot2(NS) ,plasma%Edot3(NS),plasma%Edot4(NS))
   
   ALLOCATE(plasma%dE3_hat(NC),plasma%Edot3_hat(NS))

END SUBROUTINE InitPlasma

! --------------------------------------------------------------------------
SUBROUTINE InitFieldSpline(fieldspline,in)
   USE spline_fits   

   IMPLICIT NONE
   ! Declare interface variables:
   TYPE(fieldSplineTYP), INTENT(INOUT) :: fieldspline
   TYPE(inTYP)         , INTENT(IN)    :: in

   ! Declare local variables:
   INTEGER(i4) :: NZ
   
   ! Size of spline data:
   NZ = in%nz
   
   ! Allocate memory: 
   CALL InitSpline(fieldspline%B  ,NZ,0._8,0._8)
   CALL InitSpline(fieldspline%dB ,NZ,0._8,0._8)
   CALL InitSpline(fieldspline%ddB,NZ,0._8,0._8)
   CALL InitSpline(fieldspline%V  ,NZ,0._8,0._8)
   CALL InitSpline(fieldspline%dV ,NZ,0._8,0._8)
   CALL InitSpline(fieldspline%U  ,NZ,0._8,0._8)

END SUBROUTINE InitFieldSpline

SUBROUTINE ComputeFieldSpline(fieldspline)
   USE spline_fits   

   IMPLICIT NONE
   ! Declare interface variables:
   TYPE(fieldSplineTYP), INTENT(INOUT) :: fieldspline

   ! Complete setting up the spline data: 
   CALL ComputeSpline(fieldspline%B)
   CALL ComputeSpline(fieldspline%dB)
   CALL ComputeSpline(fieldspline%ddB)
   CALL ComputeSpline(fieldspline%V)
   CALL ComputeSpline(fieldspline%dV)
   CALL ComputeSpline(fieldspline%U)

END SUBROUTINE ComputeFieldSpline

END MODULE dataTYP
Loading