Module fd4_netcdf4_mod


Uses:
    module fd4_globaldef_mod
    module fd4_vartab_mod
    module fd4_domain_mod
    module fd4_iter_mod
    module netcdf
Types:
    public type fd4_netcdf4_comm
Subroutines and functions:
    public subroutine fd4_netcdf4_open (nfcomm, domain, filename, nfields, idx, st, err, int_opt)
    public subroutine fd4_netcdf4_close (nfcomm, err)
    public subroutine fd4_netcdf4_write (nfcomm, err, st_opt)

Write data of an fd4_domain to a NetCDF4/HDF5 file.

This implementation is very simple and not optimized for performance!

TODO:

Author: Matthias Lieber


Description of Types

fd4_netcdf4_comm

public type fd4_netcdf4_comm
    type (fd4_domain), pointer :: domain => null ()
    integer :: ncid
    integer, dimension (0:4) :: dimids
    integer, pointer, dimension (:) :: varid
    integer (kind=i_k) :: rec
    integer (kind=i_k), pointer, dimension (:) :: idx
    integer (kind=i_k), pointer, dimension (:) :: st
    logical :: interpolate
    integer (kind=i_k) :: maxnbins
end type fd4_netcdf4_comm
Components:
domain the domain which owns the blocks to iterate
ncid NetCDF file handle
dimids NetCDF dimension IDs
varid NetCDF variable IDs
rec current output record (output time step)
idx field indices of the data fields to write
st time step indices of the data fields to write
interpolate interpolate face vars to center?
maxnbins max number of bins
FD4 NetCDF4 I/O Communicator

Description of Subroutines and Functions

fd4_netcdf4_open

public subroutine fd4_netcdf4_open (nfcomm, domain, filename, nfields, idx, st, err, int_opt)
    type (fd4_netcdf4_comm), intent(inout) :: nfcomm
    type (fd4_domain), target, intent(in) :: domain
    character (len=*), intent(in) :: filename
    integer (kind=i_k), intent(in) :: nfields
    integer (kind=i_k), intent(in), dimension (nfields) :: idx
    integer (kind=i_k), intent(in), dimension (nfields) :: st
    integer (kind=i_k), intent(out) :: err
    logical, optional, intent(in) :: int_opt
end subroutine fd4_netcdf4_open
Parameters:
nfcomm FD4 NetCDF4 I/O Communicator
domain the domain
filename name of the file to write
nfields number of data fields to write
idx field indices of the data fields to write
st time step indices of the data fields to write
err error status: 0...ok
int_opt interpolate face vars to center?
Open a NetCDF4 file.

fd4_netcdf4_close

public subroutine fd4_netcdf4_close (nfcomm, err)
    type (fd4_netcdf4_comm), intent(inout) :: nfcomm
    integer (kind=i_k), intent(out) :: err
end subroutine fd4_netcdf4_close
Parameters:
nfcomm FD4 NetCDF4 I/O Communicator
err error status: 0...ok
Close NetCDF file.

fd4_netcdf4_write

public subroutine fd4_netcdf4_write (nfcomm, err, st_opt)
    type (fd4_netcdf4_comm), intent(inout), target :: nfcomm
    integer (kind=i_k), intent(out) :: err
    integer (kind=i_k), optional, target, intent(in), dimension (:) :: st_opt
end subroutine fd4_netcdf4_write
Parameters:
nfcomm FD4 NetCDF4 I/O Communicator
err error status: 0...ok
st_opt time step indices of the data fields to write
Write current data of the domain to NetCDF file.

The optional st_opt parameter will overwrite the values given to fd4_netcdf4_open.