Skip to content
  • Christopher Subich's avatar
    Fixed "automatic" grid calculation error for wave_reader · d2454796
    Christopher Subich authored
    The "automatic" (unmapped) grid calculation used by wave_reader
    (automatic_grid in BaseCase.cpp) was in error for grids of
    Chebyshev-type.  Instead of computing:
    
    z = -Lz/2 + Lz/2*cos(pi*(0:(N-1))/(N-1))
    
    it instead computed
    
    z = -Lz/2 + Lz/2*cos(pi*(0:(N-1))/N)
    
    (to use matlab-style notation).  This caused the written-out zgrid to be
    in error near the bottom (max z-index) boundary.  Files using a
    chebyshev-type unmapped x-coordinate would see the error as well in the
    x-grid (max x-index).
    
    This error affects only processing that uses the grid variables itself.
    Within wave_reader where this was used, the automatic-generated grids
    were used only for writing out; the input velocities and density were
    read directly in from their corresponding files.  Likewise, SPINS
    performed the "correct" differentiation internally without reference to
    the grid coordinate.
    d2454796