output_data Subroutine

public subroutine output_data(qunit, xO1, xO2, dxO1, dxO2, wO, nXO1, nXO2, nWO, datatype)

Uses

  • proc~~output_data~~UsesGraph proc~output_data output_data module~mod_global_parameters mod_global_parameters proc~output_data->module~mod_global_parameters module~mod_basic_types mod_basic_types module~mod_global_parameters->module~mod_basic_types module~mod_connectivity mod_connectivity module~mod_global_parameters->module~mod_connectivity module~mod_constants mod_constants module~mod_global_parameters->module~mod_constants module~mod_physicaldata mod_physicaldata module~mod_global_parameters->module~mod_physicaldata module~mod_variables mod_variables module~mod_global_parameters->module~mod_variables mpi mpi module~mod_global_parameters->mpi module~mod_variables->module~mod_basic_types

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: qunit
double precision, intent(in) :: xO1(nXO1)
double precision, intent(in) :: xO2(nxO2)
double precision, intent(in) :: dxO1(nxO1)
double precision, intent(in) :: dxO2(nxO2)
double precision, intent(inout) :: wO(nXO1,nXO2,nWO)
integer, intent(in) :: nXO1
integer, intent(in) :: nXO2
integer, intent(in) :: nWO
character(len=20), intent(in) :: datatype

Calls

proc~~output_data~~CallsGraph proc~output_data output_data proc~mpistop mpistop proc~output_data->proc~mpistop proc~write_image_vticc write_image_vtiCC proc~output_data->proc~write_image_vticc proc~write_image_vtucc write_image_vtuCC proc~output_data->proc~write_image_vtucc mpi_abort mpi_abort proc~mpistop->mpi_abort proc~get_line_info get_line_info proc~write_image_vticc->proc~get_line_info proc~write_image_vtucc->proc~get_line_info proc~get_line_info->proc~mpistop

Called by

proc~~output_data~~CalledByGraph proc~output_data output_data proc~get_image get_image proc~get_image->proc~output_data proc~get_image_datresol get_image_datresol proc~get_image_datresol->proc~output_data proc~get_spectrum get_spectrum proc~get_spectrum->proc~output_data proc~get_spectrum_datresol get_spectrum_datresol proc~get_spectrum_datresol->proc~output_data proc~get_euv_image get_EUV_image proc~get_euv_image->proc~get_image proc~get_euv_image->proc~get_image_datresol proc~get_euv_spectrum get_EUV_spectrum proc~get_euv_spectrum->proc~get_spectrum proc~get_euv_spectrum->proc~get_spectrum_datresol proc~get_sxr_image get_SXR_image proc~get_sxr_image->proc~get_image proc~get_sxr_image->proc~get_image_datresol proc~get_whitelight_image get_whitelight_image proc~get_whitelight_image->proc~get_image

Source Code

    subroutine output_data(qunit,xO1,xO2,dxO1,dxO2,wO,nXO1,nXO2,nWO,datatype)
      ! change the format of data and write data
      use mod_global_parameters

      integer, intent(in) :: qunit,nXO1,nXO2,nWO
      double precision, intent(in) :: dxO1(nxO1),dxO2(nxO2)
      double precision, intent(in) :: xO1(nXO1),xO2(nxO2)
      double precision, intent(inout) :: wO(nXO1,nXO2,nWO)
      character(20), intent(in) :: datatype

      integer :: nPiece,nP1,nP2,nC1,nC2,nWC
      integer :: piece_nmax1,piece_nmax2,ix1,ix2,j,ipc,ixc1,ixc2
      double precision, allocatable :: xC(:,:,:,:),wC(:,:,:,:),dxC(:,:,:,:)

      ! clean small values
      do ix1=1,nxO1
        do ix2=1,nxO2
          do j=1,nWO
            if (abs(wO(ix1,ix2,j))<smalldouble) wO(ix1,ix2,j)=zero
          enddo
        enddo
      enddo

      ! how many cells in each grid
      if (dat_resolution) then
        if (datatype=='image_euv' .or. datatype=='image_sxr') then
          if (LOS_phi==0 .and. LOS_theta==90) then
            piece_nmax1=block_nx2
            piece_nmax2=block_nx3
          else if (LOS_phi==90 .and. LOS_theta==90) then
            piece_nmax1=block_nx3
            piece_nmax2=block_nx1
          else
            piece_nmax1=block_nx1
            piece_nmax2=block_nx2
          endif
        else if (datatype=='spectrum_euv') then
          piece_nmax1=16
          if (direction_slit==1) then
            piece_nmax2=block_nx1
          else if (direction_slit==2) then
            piece_nmax2=block_nx2
          else
            piece_nmax2=block_nx3
          endif
        endif
      else
        piece_nmax1=20
        piece_nmax2=20
      endif
      LOOPN1: do j=piece_nmax1,1,-1
        if(mod(nXO1,j)==0) then
          nC1=j
          exit LOOPN1
        endif
      enddo LOOPN1
      LOOPN2: do j=piece_nmax2,1,-1
        if(mod(nXO2,j)==0) then
          nC2=j
          exit LOOPN2
        endif
      enddo LOOPN2
      ! how many grids
      nP1=nXO1/nC1
      nP2=nXO2/nC2
      nPiece=nP1*nP2
      nWC=nWO

      ! output images
      select case(convert_type)
        case('EIvtuCCmpi','ESvtuCCmpi','SIvtuCCmpi','WIvtuCCmpi')
          ! put data into grids
          allocate(xC(nPiece,nC1,nC2,2))
          allocate(dxC(nPiece,nC1,nC2,2))
          allocate(wC(nPiece,nC1,nC2,nWO))
          do ipc=1,nPiece
            do ixc1=1,nC1
              do ixc2=1,nC2
                ix1=mod(ipc-1,nP1)*nC1+ixc1
                ix2=floor(1.0*(ipc-1)/nP1)*nC2+ixc2
                xC(ipc,ixc1,ixc2,1)=xO1(ix1)
                xC(ipc,ixc1,ixc2,2)=xO2(ix2)
                dxC(ipc,ixc1,ixc2,1)=dxO1(ix1)
                dxC(ipc,ixc1,ixc2,2)=dxO2(ix2)
                do j=1,nWC
                  wC(ipc,ixc1,ixc2,j)=wO(ix1,ix2,j)
                enddo
              enddo
            enddo
          enddo
          ! write data into vtu file
          call write_image_vtuCC(qunit,xC,wC,dxC,nPiece,nC1,nC2,nWC,datatype)
          deallocate(xC,dxC,wC)
        case('EIvtiCCmpi','ESvtiCCmpi','SIvtiCCmpi','WIvtiCCmpi')
          if (sum(stretch_type(:))>0 .and. dat_resolution) then
            call mpistop&
("Error in synthesize emission: vti is not supported for dat resolution")
          else
            call write_image_vtiCC(qunit,xO1,xO2,dxO1,dxO2,wO,nXO1,nXO2,nWO,&
               nC1,nC2)
          endif
        case default
          call mpistop("Error in synthesize emission: Unknown convert_type")
      end select

    end subroutine output_data