ReadNETCDF Subroutine

private subroutine ReadNETCDF(sf)

Uses

  • proc~~readnetcdf~2~~UsesGraph proc~readnetcdf~2 ReadNETCDF module~modgvec_io_netcdf MODgvec_IO_NETCDF proc~readnetcdf~2->module~modgvec_io_netcdf module~modgvec_globals MODgvec_Globals module~modgvec_io_netcdf->module~modgvec_globals netcdf netcdf module~modgvec_io_netcdf->netcdf iso_fortran_env iso_fortran_env module~modgvec_globals->iso_fortran_env

READ FROM SPECIFIC NETCDF FILE: general data and "boundary" group ======= HEADER OF THE NETCDF FILE VERSION 3.1 =================================================================================== === FILE DESCRIPTION: * axis, normal and binormal of the frame are given in cartesian coordinates along the curve parameter zeta [0,2pi]. * The curve is allowed to have a field periodicity NFP, but the curve must be provided on a full turn. * The data is given in REAL SPACE, sampled along equidistant zeta point positions: zeta(i)=(i+0.5)/nzeta * (2pi/NFP), i=0,...,nzeta-1 always shifted by (2pi/NFP) for the next field period. Thus the number of points along the axis for a full turn is NFP*nzeta * definition of the axis-following frame in cartesian coordinates ( boundary surface at rho=1):

 {x,y,z}(rho,theta,zeta)={x,y,z}(zeta) + X(rho,theta,zeta)*N_{x,y,z}(zeta)+Y(rho,theta,zeta)*B_{x,y,z}(zeta)

=== DATA DESCRIPTION - general data * NFP: number of field periods * VERSION: version number as integer: V3.0 => 300 - axis/ data group: * 'axis/n_max' : maximum mode number in zeta (in one field period) * 'axis/nzeta' : number of points along the axis, in one field period (>=2n_max+1) * 'axis/zeta(:)' : zeta positions, 1D array of size 'axis/nzeta', for one field period. zeta[i]=zeta[1] + (i-1)/nzeta(2pi/nfp), i=1,..nzeta, zeta[1] is arbitrary * 'axis/xyz(::)' : cartesian positions along the axis for ONE FULL TURN, 2D array of size (3,NFP nzeta ), sampled at zeta positions, must exclude the endpoint xyz[:,j+fpnzeta]=axis(zeta[j]+fp2pi/NFP), for j=0,..nzeta-1 and fp=0,...,NFP-1 * 'axis/Nxyz(::)': cartesian components of the normal vector of the axis frame, 2D array of size (3, NFP nzeta), evaluated analogously to the axis * 'axis/Bxyz(::)': cartesian components of the bi-normal vector of the axis frame, 2D array of size (3, NFPnzeta), evaluated analogously to the axis - boundary data group: * 'boundary/m_max' : maximum mode number in theta * 'boundary/n_max' : maximum mode number in zeta (in one field period) * 'boundary/lasym' : asymmetry, logical. if lasym=0, boundary surface position X,Y in the N-B plane of the axis frame can be represented only with X(theta,zeta)=sum X_mncos(mtheta-nNFPzeta), with {m=0,n=0...n_max},{m=1...m_max,n=-n_max...n_max} Y(theta,zeta)=sum Y_mnsin(mtheta-nNFPzeta), with {m=0,n=1...n_max},{m=1...m_max,n=-n_max...n_max} if lasym=1, full fourier series is taken for X,Y * 'boundary/ntheta' : number of points in theta (>=2m_max+1) * 'boundary/nzeta' : number of points in zeta (>=2n_max+1), can be different to 'axis/nzeta' * 'boundary/theta(:)' : theta positions, 1D array of size 'boundary_ntheta', on half grid! theta(i)=(i+0.5)/ntheta(2pi), i=0,...ntheta-1 * 'boundary/zeta(:)' : zeta positions, 1D array of size 'boundary/nzeta', for one field period! zeta[i]=zeta[1] + (i-1)/nzeta*(2pi/nfp), i=1,..nzeta, zeta[1] is arbitrary * 'boundary/X(::)', 'boundary/Y(::)' : boundary position X,Y in the N-B plane of the axis frame, in one field period, 2D array of size(ntheta, nzeta), with X[i, j]=X(theta[i],zeta[j]) Y[i, j]=Y(theta[i],zeta[j]), i=0...ntheta-1,j=0...nzeta-1

Arguments

Type IntentOptional Attributes Name
class(t_boundaryFromFile), intent(inout) :: sf

self


Calls

proc~~readnetcdf~2~~CallsGraph proc~readnetcdf~2 ReadNETCDF proc~ncfile_closefile t_ncfile%ncfile_closefile proc~readnetcdf~2->proc~ncfile_closefile proc~ncfile_get_array t_ncfile%ncfile_get_array proc~readnetcdf~2->proc~ncfile_get_array proc~ncfile_get_scalar t_ncfile%ncfile_get_scalar proc~readnetcdf~2->proc~ncfile_get_scalar proc~ncfile_var_exists t_ncfile%ncfile_var_exists proc~readnetcdf~2->proc~ncfile_var_exists nf90_close nf90_close proc~ncfile_closefile->nf90_close proc~mpi_check_single_access mpi_check_single_access proc~ncfile_closefile->proc~mpi_check_single_access proc~ncfile_handle_error t_ncfile%ncfile_handle_error proc~ncfile_closefile->proc~ncfile_handle_error nf90_get_var nf90_get_var proc~ncfile_get_array->nf90_get_var nf90_inq_varid nf90_inq_varid proc~ncfile_get_array->nf90_inq_varid nf90_inquire_dimension nf90_inquire_dimension proc~ncfile_get_array->nf90_inquire_dimension nf90_inquire_variable nf90_inquire_variable proc~ncfile_get_array->nf90_inquire_variable proc~ncfile_get_array->proc~mpi_check_single_access proc~ncfile_enter_groups t_ncfile%ncfile_enter_groups proc~ncfile_get_array->proc~ncfile_enter_groups proc~ncfile_get_array->proc~ncfile_handle_error proc~ncfile_get_scalar->nf90_get_var proc~ncfile_get_scalar->nf90_inq_varid proc~ncfile_get_scalar->proc~mpi_check_single_access proc~ncfile_get_scalar->proc~ncfile_enter_groups proc~ncfile_get_scalar->proc~ncfile_handle_error proc~ncfile_var_exists->nf90_inq_varid proc~ncfile_var_exists->proc~mpi_check_single_access proc~ncfile_var_exists->proc~ncfile_enter_groups proc~ncfile_enter_groups->proc~mpi_check_single_access nf90_inq_ncid nf90_inq_ncid proc~ncfile_enter_groups->nf90_inq_ncid proc~ncfile_openfile t_ncfile%ncfile_openfile proc~ncfile_enter_groups->proc~ncfile_openfile proc~ncfile_handle_error->proc~mpi_check_single_access nf90_strerror nf90_strerror proc~ncfile_handle_error->nf90_strerror proc~ncfile_openfile->proc~mpi_check_single_access proc~ncfile_openfile->proc~ncfile_handle_error nf90_create nf90_create proc~ncfile_openfile->nf90_create nf90_open nf90_open proc~ncfile_openfile->nf90_open

Called by

proc~~readnetcdf~2~~CalledByGraph proc~readnetcdf~2 ReadNETCDF proc~bff_init t_boundaryFromFile%bff_init proc~bff_init->proc~readnetcdf~2 proc~boundaryfromfile_new boundaryFromFile_new proc~boundaryfromfile_new->proc~bff_init

Source Code

  SUBROUTINE ReadNETCDF(sf)
    USE MODgvec_io_netcdf
    IMPLICIT NONE
  !-----------------------------------------------------------------------------------------------------------------------------------
  ! INPUT/OUTPUT VARIABLES
  !-----------------------------------------------------------------------------------------------------------------------------------
  ! OUTPUT VARIABLES
    CLASS(t_boundaryFromFile), INTENT(INOUT) :: sf !! self
  !-----------------------------------------------------------------------------------------------------------------------------------
  ! LOCAL VARIABLES
  !===================================================================================================================================

  CALL sf%nc%get_scalar("NFP",intout=sf%nfp)
  CALL sf%nc%get_scalar("boundary/lasym",intout=sf%lasym)
  CALL sf%nc%get_scalar("boundary/ntheta",intout=sf%ntheta)
  CALL sf%nc%get_scalar("boundary/nzeta",intout=sf%nzeta)
   IF(sf%nc%var_exists("boundary/m_max"))THEN
    CALL sf%nc%get_scalar("boundary/m_max",intout=sf%m_max)
    sf%m_max=MIN(sf%m_max,(sf%ntheta-1)/2)  !maximum mode number based on number of interpolation points ntheta>=2*m_max+1
  ELSE
    sf%m_max=(sf%ntheta-1)/2  !maximum mode number based on number of interpolation points ntheta>=2*m_max+1
    WRITE(UNIT_stdOut,'(6X,A,I8)')'"boundary/m_max" not found, set to: ',sf%m_max
  END IF
  IF(sf%nc%var_exists("boundary/n_max"))THEN
    CALL sf%nc%get_scalar("boundary/n_max",intout=sf%n_max)
    sf%n_max = MIN(sf%n_max,(sf%nzeta-1)/2)  !maximum mode number based on number of interpolation points nzeta>=2*n_max+1
  ELSE
    sf%n_max=(sf%nzeta-1)/2   !maximum mode number based on number of interpolation points nzeta>=2*n_max+1
  END IF
  WRITE(UNIT_stdOut,'(6X,A,2I4)')'" boundary (m_max,n_max)" is set to: ',sf%m_max,sf%n_max
  ALLOCATE(sf%theta(sf%ntheta))
  CALL sf%nc%get_array("boundary/theta(:)",realout_1d=sf%theta)
  ALLOCATE(sf%zeta(sf%nzeta))
  CALL sf%nc%get_array("boundary/zeta(:)",realout_1d=sf%zeta)
  ALLOCATE(sf%X(sf%ntheta,sf%nzeta))
  CALL sf%nc%get_array("boundary/X(::)",realout_2d=sf%X)
  ALLOCATE(sf%Y(sf%ntheta,sf%nzeta))
  CALL sf%nc%get_array("boundary/Y(::)",realout_2d=sf%Y)
  CALL sf%nc%closefile()
END SUBROUTINE READNETCDF