subroutine define_collisions_time_step(params,F,init)
TYPE(KORC_PARAMS), INTENT(INOUT) :: params
TYPE(FIELDS), INTENT(IN) :: F
LOGICAL, INTENT(IN) :: init
INTEGER(ip) :: iterations
REAL(rp) :: E,E_min
REAL(rp) :: v
REAL(rp) :: Tau
REAL(rp), DIMENSION(3) :: nu
REAL(rp) :: num_collisions_in_simulation
if (params%collisions) then
E = C_ME*C_C**2 + params%minimum_particle_energy*params%cpp%energy
E_min=sqrt((cparams_ss%p_min*cparams_ss%pmin_scale* &
params%cpp%mass*params%cpp%velocity* &
C_C)**2+(C_ME*C_C**2)**2)
!write(6,'("E_min (MeV)",E17.10)') E/(10**6*C_E)
!write(6,'("E_min (MeV)",E17.10)') E_min/(10**6*C_E)
if (.not.params%LargeCollisions) then
v = SQRT(1.0_rp - (C_ME*C_C**2/E)**2)
!write(6,*) 'v_min',v
else
v = SQRT(1.0_rp - (C_ME*C_C**2/E_min)**2)
!write(6,*) 'v_therm',v
end if
if ((params%profile_model.eq.'M3D_C1').or. &
(params%profile_model(10:10).eq.'H')) then
nu = (/nu_S_FIO(params,v),nu_D_FIO(params,v),nu_par(v)/)
else
nu = (/nu_S(params,v),nu_D(params,v),nu_par(v)/)
endif
Tau = MINVAL( 1.0_rp/nu )
!write(output_unit_write,'("collision freqencies ",F25.12)') nu(3)
!write(6,*) 'collision times',1/nu*params%cpp%time
!write(6,*) 'p_min',cparams_ss%p_min
cparams_ss%subcycling_iterations = ceiling(cparams_ss%dTau*Tau/ &
params%dt,ip)
params%coll_cadence=cparams_ss%subcycling_iterations
if (params%LargeCollisions.and.params%snapshot_frequency.gt.0._rp) then
!write(6,*) 'params%snapshot_frequency',params%snapshot_frequency*params%cpp%time
!write(6,*) 'cparams_ss%dTau*Tau',cparams_ss%dTau*Tau*params%cpp%time
!write(6,*) 'FLOOR(params%snapshot_frequency/cparams_ss%dTau*Tau)', &
! FLOOR(params%snapshot_frequency/ &
! (cparams_ss%dTau*Tau),ip)
params%coll_per_dump=ceiling(params%snapshot_frequency/ &
(cparams_ss%dTau*Tau))
cparams_ss%coll_per_dump_dt=params%snapshot_frequency/params%coll_per_dump
params%coll_per_dump_dt=cparams_ss%coll_per_dump_dt
if (params%coll_per_dump.gt.params%t_skip) then
write(6,*) 'more collisional iterations than orbit iterations, decrease orbit timestep!'
call korc_abort(26)
endif
params%orbits_per_coll=ceiling(cparams_ss%coll_per_dump_dt/ &
params%dt)
params%dt=cparams_ss%coll_per_dump_dt/float(params%orbits_per_coll)
end if
if (init) num_collisions_in_simulation = params%simulation_time/Tau
if (params%mpi_params%rank .EQ. 0) then
write(output_unit_write,'("* * * * * * * * * * * SUBCYCLING FOR &
COLLISIONS * * * * * * * * * * *")')
write(output_unit_write,'("Slowing down freqency (CF): ",E17.10)') &
nu(1)/params%cpp%time
write(output_unit_write,'("Pitch angle scattering freqency (CB): ",E17.10)') &
nu(2)/params%cpp%time
write(output_unit_write,'("Speed diffusion freqency (CA): ",E17.10)') &
nu(3)/params%cpp%time
! write(6,*) Tau
write(output_unit_write,'("The shorter collisional time in the simulations &
is: ",E17.10," s")') Tau*params%cpp%time
write(output_unit_write,'("Number of KORC iterations per collision: ",I16)') &
cparams_ss%subcycling_iterations
if (init) then
write(output_unit_write,'("Number of collisions in simulated time: ",E17.10)') &
num_collisions_in_simulation
end if
if (params%LargeCollisions) then
write(output_unit_write,'("Number of collision steps per dump step: ",I16)') params%coll_per_dump
write(output_unit_write,'("Collision time step: ",E17.10)') params%coll_per_dump_dt*params%cpp%time
write(output_unit_write,'("Number of orbit steps per collision step: ",I16)') params%orbits_per_coll
write(output_unit_write,'("Orbit time step: ",E17.10)') params%dt*params%cpp%time
end if
write(output_unit_write,'("* * * * * * * * * * * * * * * * * * * * &
* * * * * * * * * * * * * * *",/)')
end if
end if
end subroutine define_collisions_time_step