set_up_particles_ic Subroutine

public subroutine set_up_particles_ic(params, F, spp, P)

Arguments

Type IntentOptional AttributesName
type(KORC_PARAMS), intent(inout) :: params

Core KORC simulation parameters.

type(FIELDS), intent(inout) :: F

An instance of KORC's derived type FIELDS containing all the information about the fields used in the simulation. See korc_types and korc_fields.

type(SPECIES), intent(inout), DIMENSION(:), ALLOCATABLE:: spp

An instance of KORC's derived type SPECIES containing all the information of different electron species. See korc_types.

type(PROFILES), intent(in) :: P

An instance of the KORC derived type PROFILES.


Calls

proc~~set_up_particles_ic~~CallsGraph proc~set_up_particles_ic set_up_particles_ic proc~intitial_spatial_distribution intitial_spatial_distribution proc~set_up_particles_ic->proc~intitial_spatial_distribution proc~init_random_seed init_random_seed proc~set_up_particles_ic->proc~init_random_seed proc~initial_gyro_distribution initial_gyro_distribution proc~set_up_particles_ic->proc~initial_gyro_distribution float float proc~set_up_particles_ic->float proc~load_particles_ic load_particles_ic proc~set_up_particles_ic->proc~load_particles_ic proc~korc_abort korc_abort proc~intitial_spatial_distribution->proc~korc_abort mpi_barrier mpi_barrier proc~load_particles_ic->mpi_barrier h5fclose_f h5fclose_f proc~load_particles_ic->h5fclose_f proc~load_particles_ic->proc~korc_abort interface~load_array_from_hdf5 load_array_from_hdf5 proc~load_particles_ic->interface~load_array_from_hdf5 mpi_scatter mpi_scatter proc~load_particles_ic->mpi_scatter h5fopen_f h5fopen_f proc~load_particles_ic->h5fopen_f mpi_abort mpi_abort proc~korc_abort->mpi_abort proc~rload_2d_array_from_hdf5 rload_2d_array_from_hdf5 interface~load_array_from_hdf5->proc~rload_2d_array_from_hdf5 proc~rload_3d_array_from_hdf5 rload_3d_array_from_hdf5 interface~load_array_from_hdf5->proc~rload_3d_array_from_hdf5 proc~rload_1d_array_from_hdf5 rload_1d_array_from_hdf5 interface~load_array_from_hdf5->proc~rload_1d_array_from_hdf5 proc~rload_2d_array_from_hdf5->proc~korc_abort h5dclose_f h5dclose_f proc~rload_2d_array_from_hdf5->h5dclose_f h5dread_f h5dread_f proc~rload_2d_array_from_hdf5->h5dread_f proc~rload_3d_array_from_hdf5->proc~korc_abort proc~rload_3d_array_from_hdf5->h5dclose_f proc~rload_3d_array_from_hdf5->h5dread_f proc~rload_1d_array_from_hdf5->proc~korc_abort proc~rload_1d_array_from_hdf5->h5dclose_f proc~rload_1d_array_from_hdf5->h5dread_f

Called by

proc~~set_up_particles_ic~~CalledByGraph proc~set_up_particles_ic set_up_particles_ic program~main main program~main->proc~set_up_particles_ic

Contents

Source Code


Source Code

  subroutine set_up_particles_ic(params,F,spp,P)
    !! @note Subroutine with calls to subroutines to load particles' 
    !! information if it is a restarting simulation, or to initialize the
    !! spatial and velocity distribution of each species if it is a new  
    !! simulation. @endnote
    TYPE(KORC_PARAMS), INTENT(INOUT) 				:: params
    !! Core KORC simulation parameters.
    TYPE(FIELDS), INTENT(INOUT) 					:: F
    !! An instance of KORC's derived type FIELDS containing all 
    !! the information about the fields used in the simulation. 
    !! See [[korc_types]] and [[korc_fields]].
    TYPE(SPECIES), DIMENSION(:), ALLOCATABLE, INTENT(INOUT)       :: spp
    !! An instance of KORC's derived type SPECIES containing all 
    !! the information of different electron species. See [[korc_types]].
    TYPE(PROFILES), INTENT(IN)                                 :: P
    !! An instance of the KORC derived type PROFILES.
    INTEGER                                                    :: ii
    !! Species iterator.

    if (params%restart.OR.params%proceed.or.params%reinit) then
       call load_particles_ic(params,spp,F)

       if(params%LargeCollisions.and.(.not.params%load_balance)) then
          do ii=1_idef,params%num_species
             spp(ii)%pRE=int(sum(float(spp(ii)%vars%flagRE)))
          end do
       end if

       !write(6,*) 'flagRE',spp(1)%vars%flagRE
       !write(6,*) 'pRE',spp(1)%pRE
       
       call init_random_seed()              
    else

       if (params%mpi_params%rank .EQ. 0) then
          write(output_unit_write,'("* * * * INITIALIZING SPATIAL DISTRIBUTION * * * *")')
          flush(output_unit_write)
       end if
       call intitial_spatial_distribution(params,spp,P,F)
       if (params%mpi_params%rank .EQ. 0) then
          write(output_unit_write,'("* * * * * * * * * * * * * * * * * * * * * * * *",/)')
       end if

       if (params%mpi_params%rank .EQ. 0) then
          write(output_unit_write,'("* * * * INITIALIZING VELOCITY COMPONENTS * * * *")')
       end if
       call initial_gyro_distribution(params,F,spp)
       if (params%mpi_params%rank .EQ. 0) then
          write(output_unit_write,'("* * * * * * * * * * * * * * * * * * * * * * * *",/)')
       end if
    end if

  end subroutine set_up_particles_ic