! read flui, then import to pyton
module fluid_parameters
    integer frcfluid, mR, mZ, mgrid
    real(kind=8),dimension(:),ALLOCATABLE:: pe, ne, pene
    real(kind=8),dimension(:,:),ALLOCATABLE :: ue, Bfield, Efield, curlB, curlE
    CHARACTER(len=99) fname
!f2py intent(in) fname

    contains
    subroutine filename(name)
        CHARACTER(*) name
        fname=trim(name)
    end subroutine filename
    subroutine deallocate
        implicit none
        deallocate(pe,ne,pene,ue,Bfield,Efield,curlB,curlE)
    end subroutine deallocate
    subroutine fluid_read
        frcfluid=322
        open(frcfluid,file=fname,status='old')
        read(frcfluid,101) mR, mz, mgrid
        allocate(Bfield(3,mgrid), Efield(3,mgrid),pene(mgrid),pe(mgrid),ne(mgrid),ue(3,mgrid),&
                 curlB(3,mgrid), curlE(3,mgrid))
        read(frcfluid,102) Bfield, Efield
        read(frcfluid,102) curlB, curlE
        read(frcfluid,102) pene
        read(frcfluid,102) pe, ne, ue
        close(frcfluid)

    101 format(i6)
    102 format(e13.6)
    end subroutine fluid_read
end module
