Commit a0a9a0a4 authored by ronesy's avatar ronesy
Browse files

Correction to istate index in simulate.f90 to work even when gtime is not in ascending order

parent 82dbbfe6
......@@ -326,7 +326,7 @@ subroutine simulate(iter, files, config, fluxes, obs, states, grad_o, cost_o)
hx(:) = 0.
do n = 1, ngrid
if( istate(n).eq.0 ) cycle
ns = istate(n) - istate(1) + 1
ns = istate(n) - minval(istate,mask=(istate.gt.0)) + 1
! state vector, px
px((ns-1)*ndt*nbox+1:ns*ndt*nbox) = states%px((istate(n)-1)*ndt*nbox+1:istate(n)*ndt*nbox)
! transport operator, hx
......@@ -415,7 +415,7 @@ subroutine simulate(iter, files, config, fluxes, obs, states, grad_o, cost_o)
hx(:) = 0.
do n = 1, ngrid
if ( istate(n).eq.0 ) cycle
ns = istate(n) - istate(1) + 1
ns = istate(n) - minval(istate,mask=(istate.gt.0)) + 1
! state vector, px
px((ns-1)*nbox+1:ns*nbox) = states%px((istate(n)-1)*nbox+1:istate(n)*nbox)
! transport operator, hx
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment