quasineutrality_check Subroutine

public subroutine quasineutrality_check()

Checks whether quasi-neutrality is satisfied to some tol

Arguments

None

Called by

proc~~quasineutrality_check~~CalledByGraph proc~quasineutrality_check quasineutrality_check program~fidasim fidasim program~fidasim->proc~quasineutrality_check

Contents

Source Code


Source Code

subroutine quasineutrality_check
    !+ Checks whether quasi-neutrality is satisfied to some tol
    real(Float64) :: tol = 0.01
    real(Float64), dimension(:,:,:), allocatable :: quasi, deni
    integer :: i, quasi_cnt

    allocate(deni(inter_grid%nr,inter_grid%nz,inter_grid%nphi))
    deni = 0.d0
    do i=1,n_thermal
            deni = deni + equil%plasma%deni(i)
    enddo

    !! Quasi-neutrality check
    allocate(quasi(inter_grid%nr,inter_grid%nz,inter_grid%nphi))
    where(equil%mask.ge.0.5)
        quasi = equil%plasma%dene - (deni + impurity_charge*equil%plasma%denimp + equil%plasma%denf)
    end where

    quasi_cnt = count(abs(quasi).gt.(tol*equil%plasma%dene))
    if(inputs%verbose.ge.1) then
        write(*,'(a)') '---- Quasi-neutrality Check ----'
        write(*,'(T2, a, f5.2, "%")') 'Tolerance: ',tol*100
        write(*,'(T2, a, f6.2, "%")') 'Percent Failure: ', &
                                  100.0*quasi_cnt/size(quasi)
        write(*,*) ''
    endif
    deallocate(deni,quasi)

end subroutine quasineutrality_check