;$Id: pdiss.pro,v 1.1 2026/10/05 06:41:51 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,4f7.3,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
;
s=1./(2.*!dpi)^2
yr=[0.,s*max([ts.ekin+ts.emag])]*1.05
plot,ts.t,s*ts.emag+s*ts.ekin,yr=yr
oplot,ts.t,s*ts.ekin,col=55
oplot,ts.t,s*ts.emag,col=122
;
;  panel 3
;
yr=[-.3,.3]
yr=[-.03,.1]
plot,ts.t,deriv(ts.t,s*ts.emag+s*ts.ekin),yr=yr,/nodata
;oplot,ts.t,deriv(ts.t,ts.ekin),col=55
;oplot,ts.t,-deriv(ts.t,ts.emag),col=122
;oplot,ts.t,-ts.ujxbm,col=155
oplot,ts.t,-ts.ujxbm-deriv(ts.t,ts.emag),col=122,li=2,th=4
oplot,ts.t,+ts.ujxbm-deriv(ts.t,ts.ekin),col=55,li=2,th=4
oplot,ts.t,s*ts.epsM,col=122
oplot,ts.t,s*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
