ReadNETCDF Subroutine

public 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 iso_fortran_env iso_fortran_env module~modgvec_globals->iso_fortran_env

READ axis from netcdf file, needs netcdf library! ======= 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 adata 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', theta[i]=theta[1] + (i-1)/ntheta(2pi), starting value arbitrary * '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

---- PLASMA PARAMETERS: .... ======= END HEADER,START DATA ===================================================================================

NOTE THAT ONLY THE AXIS DATA IS NEEDED FOR THE AXIS DEFINITION

Arguments

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

self


Calls

proc~~readnetcdf~2~~CallsGraph proc~readnetcdf~2 ReadNETCDF proc~allocate_readin_vars allocate_readin_vars proc~readnetcdf~2->proc~allocate_readin_vars 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~mpi_check_single_access mpi_check_single_access proc~ncfile_closefile->proc~mpi_check_single_access 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_scalar->proc~mpi_check_single_access proc~ncfile_get_scalar->proc~ncfile_enter_groups proc~ncfile_enter_groups->proc~mpi_check_single_access proc~ncfile_openfile t_ncfile%ncfile_openfile proc~ncfile_enter_groups->proc~ncfile_openfile proc~ncfile_openfile->proc~mpi_check_single_access

Called by

proc~~readnetcdf~2~~CalledByGraph proc~readnetcdf~2 ReadNETCDF proc~hmap_axisnb_init_params hmap_axisNB_init_params proc~hmap_axisnb_init_params->proc~readnetcdf~2 interface~t_hmap_axisnb t_hmap_axisNB interface~t_hmap_axisnb->proc~hmap_axisnb_init_params proc~hmap_axisnb_init hmap_axisNB_init interface~t_hmap_axisnb->proc~hmap_axisnb_init proc~hmap_axisnb_init->proc~hmap_axisnb_init_params

Source Code

SUBROUTINE ReadNETCDF(sf)
  USE MODgvec_io_netcdf
  IMPLICIT NONE
!-----------------------------------------------------------------------------------------------------------------------------------
! INPUT/OUTPUT VARIABLES
!-----------------------------------------------------------------------------------------------------------------------------------
! OUTPUT VARIABLES
  CLASS(t_hmap_axisNB), INTENT(INOUT) :: sf !! self
!-----------------------------------------------------------------------------------------------------------------------------------
! LOCAL VARIABLES
!===================================================================================================================================
  IF(.NOT.MPIroot)RETURN
  WRITE(UNIT_stdOut,'(4X,A)')'READ AXIS FILE "'//TRIM(sf%nc%fileName)//'" in NETCDF format ...'

  CALL sf%nc%get_scalar("NFP",intout=sf%nfp)
  !sf%nzeta=sf%nc%get_dimension("axis/nzeta")
  CALL sf%nc%get_scalar("axis/nzeta",intout=sf%nzeta)

  CALL allocate_readin_vars(sf)
  CALL sf%nc%get_array("axis/zeta(:)",realout_1d=sf%zeta)

  CALL sf%nc%get_array("axis/xyz(::)",realout_2d=sf%xyz)

  CALL sf%nc%get_array("axis/Nxyz(::)",realout_2d=sf%Nxyz)

  CALL sf%nc%get_array("axis/Bxyz(::)",realout_2d=sf%Bxyz)
  !SWRITE(*,*)'DEBUG,zeta(1)',sf%zeta(1)
  !SWRITE(*,*)'DEBUG,xyz(1:3,1)',sf%xyz(1:3,1)
  !SWRITE(*,*)'DEBUG,Nxyz(1:3,1)',sf%Nxyz(1:3,1)
  !SWRITE(*,*)'DEBUG,Bxyz(1:3,1)',sf%Bxyz(1:3,1)
  CALL sf%nc%closefile()
  WRITE(UNIT_stdout,'(4X,A)')'...DONE.'

END SUBROUTINE ReadNETCDF