I am currently running a Nek5000 for pipe flow, i wanted to load from separated files and calculatite the average between them as shown below, but the logFile show that the simulation hang for hours trying to load one file.
subroutine userchk
c implicit none
include 'SIZE'
include 'TOTAL'
integer n
real Ke, Ke_cross
REAL residual, H1,SEMI,L2,LINF
parameter(lt=lx1*ly1*lz1*lelv)
real vxiH(lt), vyiH(lt),vziH(lt),vxiL(lt), vyiL(lt),vziL(lt)
n = lx1*ly1*lz1*nelv
if (istep==0) then
if (nid.eq.0) then
call load_fld('IC_HIGH.fld')
call opcopy(vxiH,vyiH,vziH,vx,vy,vz)
call load_fld('IC_LOW3.fld')
call opcopy(vxiL,vyiL,vziL,vx,vy,vz)
do j = 1,n
vxiL(i) = (vxiL(i)+vxiH(i))/2
vyiL(i) = (vyiL(i)+vyiH(i))/2
vziL(i)=(vziL(i)+vziH(i))/2
end do
call opcopy(vx,vy,vz,vxiL,vyiL,vziL)
end if
end if
!Computing turbulent kinetic energy and cross section energy
Ke_cross = glsc3(vx,vx,bm1,n) + glsc3(vy,vy,bm1,n)
Ke = Ke_cross + glsc3(vz,vz,bm1,n)
Ke_cross = Ke_cross / (2*volvm1)
Ke = Ke / (2*volvm1)
!Computing residual
call normvc(h1,semi,l2,linf,vx-vxlag(:,:,:,:,1),
& vy-vylag(:,:,:,:,1),
& vz-vzlag(:,:,:,:,1))
residual = linf/dt
if (Ke_cross > 1e-3) then
call outpost(vx,vy,vz,pr,t,'HIGH_')
call exitt
end if
!Check if solution has converged and stop
if (Ke_cross < 3e-6) then
call outpost(vx,vy,vz,pr,t,'LOW_')
call exitt
end if
!Print to screen informations
if (nid.eq.0) write(6,*) 'K_e = ', Ke
if (nid.eq.0) write(6,*) 'Ke_cross = ', Ke_cross
if (nid.eq.0) write(6,*) 'residual = ', residual
!Write energy into a file
if (nid.eq.0) then
if (istep==0) then
open(unit=20, file = 'nekEnergy.dat', status='replace' )
write(20,*) "# time TKE TKE_cross residual"
end if
write(20,900) time, Ke, Ke_cross, residual
900 format(1F12.3,3E15.5)
if (istep==nsteps) close(20)
end if