Jacopo Canton and Nicolò Fabbiane (in alphabetical order)
January, 2016
This function reads binary data from the nek5000 file format
[data,lr1,elmap,time,istep,fields,emode,wdsz,etag,header,status] = readnek(fname)
input
fname: name of the file
output
data: nek5000 data ordered as{iel,inode,[x|y|(z)|u|v|(w)|p|T|s_i]}lr1: element-size vector[lx1,ly1,lz1]elmap: reading/writing map of the elements in the filetime: simulation timeistep: simulation stepfields: fields saved in the fileemode: endian mode 'le' = little-endian, 'be' = big-endianwdsz: single (4) or double (8) precisionetag: tag for endian indentificationheader: header of the file (string)status: status (< 0 something went wrong)
This function writes binary data in the nek5000 new file format
status = writenek(fname,data,lr1,elmap,time,istep,fields,emode,wdsz,etag)
input
fname: name of the filedata: nek5000 data ordered as{iel,inode,[x|y|(z)|u|v|(w)|p|T|s_i]}lr1: element-size vector[lx1,ly1,lz1]elmap: reading/writing map of the elements in the filetime: simulation timeistep: simulation stepfields: fields saved in the fileemode: endian mode 'le' = little-endian, 'be' = big-endianwdsz: single (4) or double (8) precisionetag: tag for endian indentification
output
status: status (< 0 something went wrong)
Reshape data from nekread to a meshgrid
[mesh1,mesh2,...] = reshapenek(data,nelx,nely)
input
data: nek5000 data ordered as{iel,inode,[x|y|(z)|u|v|(w)|p|T|s_i]}nelx: number of element in the first direction (second index)nely: number of element in the second direction (first index)
output
meshn: meshgrid of the n-th field in data
Demesh a meshgrid to data
[data] = reshapenek(mesh,lr1)
input
mesh: meshgrid (fields along third index)lr1: element-size vector[lx1,ly1,lz1]
output
data: nek5000 data ordered as{iel,inode,[x|y|(z)|u|v|(w)|p|T|s_i]}
This package has been also tested with Octave.