Subroutine to free allocatable simulation variables.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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(PROFILES), | intent(inout) | :: | P | |||
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. |
subroutine deallocate_variables(params,F,P,spp)
!! @note Subroutine to free allocatable simulation variables.
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(PROFILES), INTENT(INOUT) :: P
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]].
INTEGER :: ii
!! Iterator of the spp array
DEALLOCATE(params%outputs_list)
do ii=1_idef,params%num_species
DEALLOCATE(spp(ii)%vars%X)
DEALLOCATE(spp(ii)%vars%V)
DEALLOCATE(spp(ii)%vars%Rgc)
DEALLOCATE(spp(ii)%vars%Y)
DEALLOCATE(spp(ii)%vars%E)
DEALLOCATE(spp(ii)%vars%B)
DEALLOCATE(spp(ii)%vars%PSI_P)
DEALLOCATE(spp(ii)%vars%ne)
DEALLOCATE(spp(ii)%vars%ni)
if (ALLOCATED(spp(ii)%vars%nimp)) DEALLOCATE(spp(ii)%vars%nimp)
DEALLOCATE(spp(ii)%vars%Te)
DEALLOCATE(spp(ii)%vars%Zeff)
DEALLOCATE(spp(ii)%vars%g)
DEALLOCATE(spp(ii)%vars%eta)
DEALLOCATE(spp(ii)%vars%mu)
DEALLOCATE(spp(ii)%vars%Prad)
DEALLOCATE(spp(ii)%vars%flagCon)
DEALLOCATE(spp(ii)%vars%flagCol)
DEALLOCATE(spp(ii)%vars%flagRE)
DEALLOCATE(spp(ii)%vars%initLCFS)
DEALLOCATE(spp(ii)%vars%wt)
if (params%orbit_model(1:2).eq.'GC') then
DEALLOCATE(spp(ii)%vars%Y0)
DEALLOCATE(spp(ii)%vars%V0)
DEALLOCATE(spp(ii)%vars%k1)
DEALLOCATE(spp(ii)%vars%k2)
DEALLOCATE(spp(ii)%vars%k3)
DEALLOCATE(spp(ii)%vars%k4)
DEALLOCATE(spp(ii)%vars%RHS)
end if
end do
DEALLOCATE(spp)
call DEALLOCATE_FIELDS_ARRAYS(F)
call DEALLOCATE_PROFILES_ARRAYS(P)
end subroutine deallocate_variables