Write_DGModel1D_t Subroutine

public subroutine Write_DGModel1D_t(this, fileName)

Arguments

TypeIntentOptionalAttributesName
class(DGModel1D_t), intent(inout) :: this
character, intent(in), optional :: fileName

Calls

proc~~write_dgmodel1d_t~~CallsGraph proc~write_dgmodel1d_t Write_DGModel1D_t info info proc~write_dgmodel1d_t->info interface~open_hdf5 Open_HDF5 proc~write_dgmodel1d_t->interface~open_hdf5 proc~close_hdf5 Close_HDF5 proc~write_dgmodel1d_t->proc~close_hdf5 proc~creategroup_hdf5 CreateGroup_HDF5 proc~write_dgmodel1d_t->proc~creategroup_hdf5 proc~open_hdf5_parallel Open_HDF5_parallel interface~open_hdf5->proc~open_hdf5_parallel proc~open_hdf5_serial Open_HDF5_serial interface~open_hdf5->proc~open_hdf5_serial h5fclose_f h5fclose_f proc~close_hdf5->h5fclose_f h5close_f h5close_f proc~close_hdf5->h5close_f h5gcreate_f h5gcreate_f proc~creategroup_hdf5->h5gcreate_f h5lexists_f h5lexists_f proc~creategroup_hdf5->h5lexists_f h5gclose_f h5gclose_f proc~creategroup_hdf5->h5gclose_f h5open_f h5open_f proc~open_hdf5_parallel->h5open_f h5pset_fapl_mpio_f h5pset_fapl_mpio_f proc~open_hdf5_parallel->h5pset_fapl_mpio_f h5fcreate_f h5fcreate_f proc~open_hdf5_parallel->h5fcreate_f h5pcreate_f h5pcreate_f proc~open_hdf5_parallel->h5pcreate_f h5fopen_f h5fopen_f proc~open_hdf5_parallel->h5fopen_f h5pclose_f h5pclose_f proc~open_hdf5_parallel->h5pclose_f proc~open_hdf5_serial->h5open_f proc~open_hdf5_serial->h5fcreate_f proc~open_hdf5_serial->h5fopen_f

Contents

Source Code


Source Code

  subroutine Write_DGModel1D_t(this,fileName)
#undef __FUNC__
#define __FUNC__ "Write_DGModel1D_t"
    implicit none
    class(DGModel1D_t),intent(inout) :: this
    character(*),optional,intent(in) :: fileName
    ! Local
    integer(HID_T) :: fileId
    type(Scalar1D) :: solution
    type(Scalar1D) :: x
    type(Lagrange),target :: interp
    character(LEN=self_FileNameLength) :: pickupFile
    character(13) :: timeStampString

    write(timeStampString,'(I13.13)') this%ioIterate
    if(present(filename)) then
      pickupFile = trim(filename)
    else
      pickupFile = 'solution.'//timeStampString//'.h5'
    endif

    INFO("Writing pickup file : "//trim(pickupFile))
    call this%solution%UpdateHost()

    call Open_HDF5(pickupFile,H5F_ACC_TRUNC_F,fileId)

    ! Write the interpolant to the file
    call this%solution%interp%WriteHDF5(fileId)

    ! In this section, we write the solution and geometry on the control (quadrature) grid
    ! which can be used for model pickup runs or post-processing

    ! Write the model state to file
    call CreateGroup_HDF5(fileId,'/controlgrid')
    call this%solution%WriteHDF5(fileId,'/controlgrid/solution')

    ! Write the geometry to file
    call CreateGroup_HDF5(fileId,'/controlgrid/geometry')
    call this%geometry%x%WriteHDF5(fileId,'/controlgrid/geometry/x')
    ! -- END : writing solution on control grid -- !

    ! Interpolate the solution to a grid for plotting results
    ! Create an interpolant for the uniform grid
    call interp%Init(this%solution%interp%M, &
                     this%solution%interp%targetNodeType, &
                     this%solution%interp%N, &
                     this%solution%interp%controlNodeType)

    call solution%Init(interp, &
                       this%solution%nVar,this%solution%nElem)

    call x%Init(interp,1,this%solution%nElem)

    ! Map the mesh positions to the target grid
    call this%geometry%x%GridInterp(x%interior)

    ! Map the solution to the target grid
    call this%solution%GridInterp(solution%interior)

    ! Write the model state to file
    call CreateGroup_HDF5(fileId,'/targetgrid')
    call solution%WriteHDF5(fileId,'/targetgrid/solution')

    ! Write the geometry to file
    call CreateGroup_HDF5(fileId,'/targetgrid/geometry')
    call x%WriteHDF5(fileId,'/targetgrid/geometry/x')

    call Close_HDF5(fileId)

    call x%Free()
    call solution%Free()
    call interp%Free()

  endsubroutine Write_DGModel1D_t