subroutine preenr c c (* old: Determine wkin,wmgt,wki and wenr at time step=ne-1 *) c c c Calculates energy (wner) at time step=ne-1 c Also stores grtmx (mode amplitudes c implicit none include 'itg.par' include 'itg.cmn' c real vol,dummy(mz,nz),dum,nuur,nuui integer nea,m,n,l,i real den2,v2,tpar2,tp2,u2(mz,nz) real d1eta,d2eta,d3eta,d1par,d2par,wupsi real d1r,d3r,d4r,d5r,d6r,d7r,d8r,d9r complex kyn1(lz,mz,nz,nspecz),kyt1(lz,mz,nz,nspecz) complex kyt2(lz,mz,nz,nspecz),kwn1(lz,mz,nz,nspecz) complex kwt1(lz,mz,nz,nspecz),kwt2(lz,mz,nz,nspecz) complex kpt1(lz,mz,nz,nspecz),kpt2(lz,mz,nz,nspecz) complex ktu1(lz,mz,nz,nspecz),ktt1(lz,mz,nz,nspecz) complex ktt2(lz,mz,nz,nspecz),ktr1(lz,mz,nz,nspecz) c c volsq operates on only the primary species for any call without c (1,1,1,i) indexing. c call volsq(density,density,den2,dummy) call volsq(u_par,u_par,v2,dummy) call volsq(t_par,t_par,tpar2,dummy) call volsq(t_perp,t_perp,tp2,dummy) call volsq(potential,potential,dum,u2) if (nparmom.eq.3) then nuur=nu5r nuui=nu5i else nuur=0.0 nuui=0.0 endif nea=ne+1 do n=1,nd do m=1,md grtmx(nea,m,n)=u2(m,n) enddo enddo pwenr=0.5*(den2+v2+tpar2/2.+tp2) return end