SUBROUTINE initialize_m3d_c1_imp(params,F,P,num_imp,init)
TYPE(KORC_PARAMS), INTENT(IN) :: params
TYPE(FIELDS), INTENT(IN) :: F
TYPE(PROFILES), INTENT(INOUT) :: P
INTEGER, INTENT(IN) :: num_imp
LOGICAL, INTENT(IN) :: init
INTEGER :: ii
INTEGER :: status
INTEGER :: isrc
INTEGER,ALLOCATABLE,DIMENSION(:) :: Zo
INTEGER :: A,Zo1
!status = fio_open_source(FIO_M3DC1_SOURCE, &
! TRIM(params%magnetic_field_filename) &
! // C_NULL_CHAR, isrc)
isrc=F%isrc
status = fio_get_options(isrc)
if (.not.F%ReInterp_2x1t) then
status = fio_set_int_option(FIO_TIMESLICE, params%time_slice)
else
status = fio_set_int_option(FIO_TIMESLICE, F%ind_2x1t)
end if
if (init) then
ALLOCATE(P%FIO_nimp(num_imp))
else
do ii=1,num_imp
status = fio_close_field(P%FIO_nimp(ii))
end do
endif
!write(6,*) size(params%Zj)
!write(6,*) size(params%Zj(ubound(params%Zj)))
Zo=int(params%Zj(ubound(params%Zj)))
Zo1=Zo(1)
if (Zo1.eq.18) then
A=40
else if (Zo1.eq.10) then
A=20
else if (Zo1.eq.6) then
A=12
end if
do ii=1,num_imp
status = fio_set_int_option(FIO_SPECIES, &
FIO_MAKE_SPECIES(A, Zo1, Zo1+1-ii));
status = fio_get_field(isrc, FIO_DENSITY, P%FIO_nimp(ii));
end do
if (params%mpi_params%rank .EQ. 0) then
do ii=1,num_imp
write(output_unit_write,*) 'Calculate nimp_',ii,P%FIO_nimp(ii)
end do
end if
END SUBROUTINE initialize_m3d_c1_imp