Subroutine that calls subroutines of different modules to initialize the energy and pitch-angle distribution in various ways.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
type(SPECIES), | intent(inout), | DIMENSION(:), ALLOCATABLE | :: | spp | An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. |
subroutine initial_energy_pitch_dist(params,spp)
!! @note Subroutine that calls subroutines of different modules to
!! initialize the energy and pitch-angle distribution in various ways. @endnote
TYPE(KORC_PARAMS), INTENT(IN) :: params
!! Core KORC simulation parameters.
TYPE(SPECIES), DIMENSION(:), ALLOCATABLE, INTENT(INOUT) :: spp
!! An instance of the derived type SPECIES containing all the parameters and
!! simulation variables of the different species in the simulation.
INTEGER :: ii
!! Species iterator.
INTEGER :: mpierr
!! MPI error status.
do ii=1_idef,params%num_species
if (params%mpi_params%rank .EQ. 0) then
write(output_unit_write,'(/,"* * * * * SPECIES: ",I2," * * * * * * * * * * *")') ii
write(output_unit_write,'("Particles per MPI process: ",I16)') spp(ii)%ppp
write(output_unit_write,'("Energy distribution is: ",A20)') &
TRIM(spp(ii)%energy_distribution)
write(output_unit_write,'("Pitch-angle distribution is: ",A20)') &
TRIM(spp(ii)%pitch_distribution)
write(output_unit_write,'("Spatial distribution is: ",A20)') &
TRIM(spp(ii)%spatial_distribution)
write(output_unit_write,'("* * * * * * * * * * * * * * * * * * * * * *",/)')
end if
SELECT CASE (TRIM(spp(ii)%energy_distribution))
CASE ('MONOENERGETIC')
spp(ii)%go = (spp(ii)%Eo + spp(ii)%m*C_C**2)/(spp(ii)%m*C_C**2)
spp(ii)%vars%g = spp(ii)%go ! Monoenergetic
spp(ii)%Eo_lims = (/spp(ii)%Eo, spp(ii)%Eo /)
CASE ('THERMAL')
call thermal_distribution(params,spp(ii))
spp(ii)%Eo_lims = (/spp(ii)%m*C_C**2*MINVAL(spp(ii)%vars%g) - &
spp(ii)%m*C_C**2, &
spp(ii)%m*C_C**2*MAXVAL(spp(ii)%vars%g) - spp(ii)%m*C_C**2 /)
CASE ('AVALANCHE')
call get_avalanche_distribution(params,spp(ii)%vars%g, &
spp(ii)%vars%eta,spp(ii)%go,spp(ii)%etao)
spp(ii)%Eo = spp(ii)%m*C_C**2*spp(ii)%go - spp(ii)%m*C_C**2
spp(ii)%Eo_lims = (/spp(ii)%m*C_C**2*MINVAL(spp(ii)%vars%g) &
- spp(ii)%m*C_C**2, &
spp(ii)%m*C_C**2*MAXVAL(spp(ii)%vars%g) - spp(ii)%m*C_C**2 /)
CASE ('HOLLMANN')
call get_Hollmann_distribution(params,spp(ii))
! spp(ii)%Eo = spp(ii)%m*C_C**2*spp(ii)%go - spp(ii)%m*C_C**2
spp(ii)%go = (spp(ii)%Eo + spp(ii)%m*C_C**2)/(spp(ii)%m*C_C**2)
spp(ii)%Eo_lims = (/spp(ii)%m*C_C**2*MINVAL(spp(ii)%vars%g) &
- spp(ii)%m*C_C**2, &
spp(ii)%m*C_C**2*MAXVAL(spp(ii)%vars%g) - spp(ii)%m*C_C**2 /)
CASE ('EXPERIMENTAL-GAMMA')
call get_experimentalG_distribution(params,spp(ii)%vars%g, &
spp(ii)%vars%eta, &
spp(ii)%go,spp(ii)%etao)
spp(ii)%Eo = spp(ii)%m*C_C**2*spp(ii)%go - spp(ii)%m*C_C**2
spp(ii)%Eo_lims = (/spp(ii)%m*C_C**2*MINVAL(spp(ii)%vars%g) &
- spp(ii)%m*C_C**2, &
spp(ii)%m*C_C**2*MAXVAL(spp(ii)%vars%g) - spp(ii)%m*C_C**2 /)
CASE ('GAMMA')
call get_gamma_distribution(params,spp(ii)%vars%g,spp(ii)%go)
spp(ii)%Eo = spp(ii)%m*C_C**2*spp(ii)%go - spp(ii)%m*C_C**2
spp(ii)%Eo_lims = (/spp(ii)%m*C_C**2*MINVAL(spp(ii)%vars%g) &
- spp(ii)%m*C_C**2, &
spp(ii)%m*C_C**2*MAXVAL(spp(ii)%vars%g) - spp(ii)%m*C_C**2 /)
CASE ('UNIFORM')
spp(ii)%Eo = spp(ii)%Eo_lims(1)
spp(ii)%go = (spp(ii)%Eo + spp(ii)%m*C_C**2)/(spp(ii)%m*C_C**2)
call generate_2D_hammersley_sequence(params%mpi_params%rank, &
params%mpi_params%nmpi,spp(ii)%vars%g,spp(ii)%vars%eta)
spp(ii)%vars%g = (spp(ii)%Eo_lims(2) - &
spp(ii)%Eo_lims(1))*spp(ii)%vars%g/(spp(ii)%m*C_C**2) + &
(spp(ii)%Eo_lims(1) + spp(ii)%m*C_C**2)/(spp(ii)%m*C_C**2)
CASE ('AVALANCHE-4D')
spp(ii)%go = (spp(ii)%Eo + spp(ii)%m*C_C**2)/(spp(ii)%m*C_C**2)
spp(ii)%vars%g = spp(ii)%go
! Monoenergy from input file until sampled in Avalanche_4D
CASE ('HOLLMANN-3D')
spp(ii)%go = (spp(ii)%Eo + spp(ii)%m*C_C**2)/(spp(ii)%m*C_C**2)
spp(ii)%vars%g = spp(ii)%go
! Monoenergy from input file until sampled in Hollmann_3D
CASE ('HOLLMANN-3D-PSI')
spp(ii)%go = (spp(ii)%Eo + spp(ii)%m*C_C**2)/(spp(ii)%m*C_C**2)
spp(ii)%vars%g = spp(ii)%go
! Monoenergy from input file until sampled in Hollmann_3D
CASE ('HOLLMANN-1DTRANSPORT')
spp(ii)%go = (spp(ii)%Eo + spp(ii)%m*C_C**2)/(spp(ii)%m*C_C**2)
spp(ii)%vars%g = spp(ii)%go
! Monoenergy from input file until sampled in Hollmann_3D
CASE ('FIO_therm')
spp(ii)%go = (spp(ii)%Eo + spp(ii)%m*C_C**2)/(spp(ii)%m*C_C**2)
spp(ii)%vars%g = spp(ii)%go
CASE DEFAULT
! Something to be done
END SELECT
call MPI_BARRIER(MPI_COMM_WORLD,mpierr)
SELECT CASE (TRIM(spp(ii)%pitch_distribution))
CASE ('MONOPITCH')
spp(ii)%vars%eta = spp(ii)%etao ! Mono-pitch-angle
if(spp(ii)%spatial_distribution.ne.'SPONG-3D') then
spp(ii)%etao_lims = (/spp(ii)%etao , spp(ii)%etao/)
end if
CASE ('THERMAL')
spp(ii)%etao_lims = (/MINVAL(spp(ii)%vars%eta), &
MAXVAL(spp(ii)%vars%eta)/)
CASE ('AVALANCHE')
spp(ii)%etao_lims = (/MINVAL(spp(ii)%vars%eta), &
MAXVAL(spp(ii)%vars%eta)/)
CASE ('HOLLMANN')
! spp(ii)%vars%eta = spp(ii)%etao
! spp(ii)%etao_lims = (/MINVAL(spp(ii)%vars%eta), &
! MAXVAL(spp(ii)%vars%eta)/)
CASE ('EXPERIMENTAL-GAMMA')
spp(ii)%etao_lims = (/MINVAL(spp(ii)%vars%eta), &
MAXVAL(spp(ii)%vars%eta)/)
CASE ('UNIFORM')
spp(ii)%etao = spp(ii)%etao_lims(1)
spp(ii)%vars%eta = (spp(ii)%etao_lims(2) - &
spp(ii)%etao_lims(1))*spp(ii)%vars%eta + spp(ii)%etao_lims(1)
CASE ('SIMPLE-EQUILIBRIUM')
call get_equilibrium_distribution(params,spp(ii)%vars%eta, &
spp(ii)%go,spp(ii)%etao)
spp(ii)%etao_lims = (/MINVAL(spp(ii)%vars%eta),&
MAXVAL(spp(ii)%vars%eta)/)
CASE ('AVALANCHE-4D')
spp(ii)%vars%eta = spp(ii)%etao
!Monopitch from input file until sampled in Avalanche_4D
CASE ('HOLLMANN-3D')
spp(ii)%vars%eta = spp(ii)%etao
!Monopitch from input file until sampled in Hollmann_3D
CASE ('HOLLMANN-3D-PSI')
spp(ii)%vars%eta = spp(ii)%etao
!Monopitch from input file until sampled in Hollmann_3D
CASE ('HOLLMANN-1DTRANSPORT')
spp(ii)%vars%eta = spp(ii)%etao
!Monopitch from input file until sampled in Hollmann_3D
CASE ('SPONG-3D')
spp(ii)%vars%eta = spp(ii)%etao
!Monopitch from input file until sampled in Spong_3D
CASE ('FIO_therm')
spp(ii)%vars%eta = spp(ii)%etao
CASE DEFAULT
! Something to be done
END SELECT
call MPI_BARRIER(MPI_COMM_WORLD,mpierr)
end do
end subroutine initial_energy_pitch_dist