WriteTecplot_DGModel1D_t Subroutine

public subroutine WriteTecplot_DGModel1D_t(this, filename)

Arguments

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

Calls

proc~~writetecplot_dgmodel1d_t~~CallsGraph proc~writetecplot_dgmodel1d_t WriteTecplot_DGModel1D_t proc~newunit newunit proc~writetecplot_dgmodel1d_t->proc~newunit

Contents


Source Code

  subroutine WriteTecplot_DGModel1D_t(this,filename)
    implicit none
    class(DGModel1D_t),intent(inout) :: this
    character(*),intent(in),optional :: filename
    ! Local
    character(8) :: zoneID
    integer :: fUnit
    integer :: iEl,i,iVar
    character(LEN=self_FileNameLength) :: tecFile
    character(LEN=self_TecplotHeaderLength) :: tecHeader
    character(LEN=self_FormatLength) :: fmat
    character(13) :: timeStampString
    character(5) :: rankString
    type(Scalar1D) :: solution
    type(Scalar1D) :: x
    type(Lagrange),target :: interp

    if(present(filename)) then
      tecFile = filename
    else
      ! Create a 0-padded integer for the output iterate
      write(timeStampString,'(I13.13)') this%ioIterate
      ! Increment the ioIterate
      this%ioIterate = this%ioIterate+1
      tecFile = 'solution.'//timeStampString//'.curve'

    endif
    call this%solution%UpdateHost()
    ! 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)

    fmat = '(2(ES16.7E3,1x))'
    ! Let's write some tecplot!!
    open(UNIT=NEWUNIT(fUnit), &
         FILE=trim(tecFile), &
         FORM='formatted', &
         STATUS='replace')

    do iVar = 1,this%solution%nVar
      write(tecHeader,'(E15.6)') this%t
      tecHeader = "#TIME "//trim(tecHeader)
      write(fUnit,*) trim(tecHeader)

      tecHeader = "#"//trim(this%solution%meta(iVar)%name)//" vs position"
      write(fUnit,*) trim(tecHeader)
      do iEl = 1,this%solution%nElem

        do i = 1,this%solution%interp%M+1

          write(fUnit,fmat) x%interior(i,iEl,1), &
            solution%interior(i,iEl,iVar)

        enddo

      enddo
    enddo

    close(UNIT=fUnit)

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

  endsubroutine WriteTecplot_DGModel1D_t