;$Id: p.pro,v 1.9 2026/10/11 02:22:22 brandenb Exp $
if !d.name eq 'PS' then begin
  device,xsize=18,ysize=12,yoffset=3
  !p.charthick=2 & !p.thick=2 & !x.thick=2 & !y.thick=2
end
;
siz=1.7
si2=1.0
!p.charsize=1.8
!x.margin=[7.5,.4]
!y.margin=[3.2,.3]
!x.title='!8t!6'
!y.title='!7e!6!dK!n  and  !7e!6!dM!n'
!p.multi=[0,1,3]
;
pc_read_ts,obj=ts
pc_read_dim,obj=dim
pc_read_param,obj=param
pc_read_param,obj=param2,/param2
yr=[0.,max([ts.epsK+ts.epsM])]*1.05
;plot,ts.t,ts.epsK,/nodata,yr=yr
plot,ts.t,ts.epsK+ts.epsM,yr=yr
oplot,ts.t,ts.epsK,col=55
oplot,ts.t,ts.epsM,col=122
;
nx=dim.nx
nu=param2.nu
eta=param2.eta
tmax=max(ts.t)
epsKmax=max(ts.epsK) & iepsKmax=where(epsKmax eq ts.epsK) & tepsKmax=mean(ts.t(iepsKmax))
epsMmax=max(ts.epsM) & iepsMmax=where(epsMmax eq ts.epsM) & tepsMmax=mean(ts.t(iepsMmax))
;
cwd,run
fo='(e7.1,e9.1,2(f8.4,f7.2),i6,f7.1,2x,a)'
openw,1,'res.tmp'
printf,1,nu,eta,epsKmax,tepsKmax,epsMmax,tepsMmax,nx,tmax,run,fo=fo
close,1
spawn,'cat res.tmp'
spawn,'cat res.tmp >> ../idl/res.txt'
;
oplot,[1,1]*tepsKmax,yr,col=55
oplot,[1,1]*tepsMmax,yr,col=122
;
;  panel 2
;
yr=[0.,.5*max([ts.urms^2+ts.brms^2])]*1.05
plot,ts.t,.5*ts.brms^2+.5*ts.urms^2,yr=yr
oplot,ts.t,.5*ts.urms^2,col=55
oplot,ts.t,.5*ts.brms^2,col=122
;
;  panel 3
;
yr=[-.3,.3]
yr=[-.03,.1]
plot,ts.t,deriv(ts.t,.5*ts.brms^2+.5*ts.urms^2),yr=yr,/nodata
;oplot,ts.t,deriv(ts.t,.5*ts.urms^2),col=55
;oplot,ts.t,-deriv(ts.t,.5*ts.brms^2),col=122
;oplot,ts.t,-ts.ujxbm,col=155
oplot,ts.t,-ts.ujxbm-deriv(ts.t,.5*ts.brms^2),col=122,li=2,th=4
oplot,ts.t,+ts.ujxbm-deriv(ts.t,.5*ts.urms^2),col=55,li=2,th=4
oplot,ts.t,ts.epsM,col=122
oplot,ts.t,ts.epsK,col=55
;
;  expect:
;  EBdot = -WL -epsM
;
cwd,run
!p.multi=0
print,"$mv idl.ps ../tex/fig/p_"+run+".eps"
print,"$mv idl.ps ~/Overleaf/Liubov/Dissipation-code-comparison/fig/p_"+run+".eps"
END
