build_axes Subroutine

public subroutine build_axes()

Build per-model x coordinate, strip edges and outer boundary.

Rebuilds xval, xedge, ystar from convdata%data per st%xaxis, st%tunit, st%yaxis.

Arguments

None

Source Code

   subroutine build_axes()
      !! Build per-model x coordinate, strip edges and outer boundary.
      !!
      !! Rebuilds `xval`, `xedge`, `ystar` from `convdata%data` per `st%xaxis`, `st%tunit`,
      !! `st%yaxis`.
      integer(int32) :: i
      if (allocated(xval)) deallocate (xval)
      if (allocated(xedge)) deallocate (xedge)
      if (allocated(ystar)) deallocate (ystar)
      allocate (xval(nmodels), xedge(nmodels + 1), ystar(nmodels))
      do i = 1, nmodels
         if (st%xaxis == 'model') then
            xval(i) = real(data(i)%ncyc, real64)
         else
            xval(i) = data(i)%timesec/UFAC(unit_id(st%tunit))
         end if
         if (st%yaxis == 'radius') then
            ystar(i) = data(i)%rncoord(data(i)%ncoord)
         else
            ystar(i) = data(i)%xmcoord(data(i)%ncoord)
         end if
      end do
      ! strip edges = midpoints between successive model x-values
      xedge(1) = xval(1) - 0.5d0*(xval(2) - xval(1))
      do i = 2, nmodels
         xedge(i) = 0.5d0*(xval(i - 1) + xval(i))
      end do
      xedge(nmodels + 1) = xval(nmodels) + 0.5d0*(xval(nmodels) - xval(nmodels - 1))
   end subroutine build_axes