71 lines
2.6 KiB
Matlab
71 lines
2.6 KiB
Matlab
function [] = write_uvwp_chunk_ucf(file,...
|
|
u,ibu,jbu,kbu,nxu,nyu,nzu,...
|
|
v,ibv,jbv,kbv,nxv,nyv,nzv,...
|
|
w,ibw,jbw,kbw,nxw,nyw,nzw,...
|
|
p,ibp,jbp,kbp,nxp,nyp,nzp,...
|
|
time,ighost,varargin)
|
|
% [] = write_uvwp_chunk_ucf(file,...
|
|
% u,ibu,jbu,kbu,nxu,nyu,nzu,,...
|
|
% v,ibv,jbv,kbv,nxv,nyv,nzv,,...
|
|
% w,ibw,jbw,kbw,nxw,nyw,nzw,,...
|
|
% p,ibp,jbp,kbp,nxp,nyp,nzp,,...
|
|
% time,ighost,varargin)
|
|
% Writes a partial uvwp field to UCF chunk.
|
|
% Input
|
|
% file file to be written (the extension will be replaced by the proc rank)
|
|
% u,v,w,p partial u,v,w,p fields with dim(nx,ny,nz)
|
|
% ib,jb,kb global index of first data point of field w/o ghost cells
|
|
% nx,ny,nz global grid size
|
|
% time simulation time
|
|
% ighost does partial field contain ghost cells?
|
|
% Optional input (key/value pair)
|
|
% rank processor rank as array [myid,my_col,my_row,my_pln]
|
|
% endian endianess of the file as used by fopen (default: 'n')
|
|
% verbosity verbose output? (default: no)
|
|
% debug debug output? (default: no)
|
|
|
|
% Parse variable input
|
|
par = inputParser;
|
|
addParamValue(par,'rank',[0,0,0,0],@(x)isnumeric(x)&&numel(x)==4);
|
|
addParamValue(par,'endian','n',@ischar);
|
|
addParamValue(par,'verbosity',0,@isnumeric);
|
|
addParamValue(par,'debug',0,@isnumeric);
|
|
parse(par,varargin{:});
|
|
|
|
% Create file and write to it
|
|
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
|
obj.create(file,'type','field','rank',par.Results.rank,'endian',par.Results.endian);
|
|
obj.appendStep(time);
|
|
|
|
% Write u
|
|
nxul = size(u,1)-2*ighost;
|
|
nyul = size(u,2)-2*ighost;
|
|
nzul = size(u,3)-2*ighost;
|
|
params = int64([ighost,ibu,jbu,kbu,nxul,nyul,nzul,nxu,nyu,nzu]);
|
|
obj.appendSet(u,params);
|
|
|
|
% Write v
|
|
nxvl = size(v,1)-2*ighost;
|
|
nyvl = size(v,2)-2*ighost;
|
|
nzvl = size(v,3)-2*ighost;
|
|
params = int64([ighost,ibv,jbv,kbv,nxvl,nyvl,nzvl,nxv,nyv,nzv]);
|
|
obj.appendSet(v,params);
|
|
|
|
% Write w
|
|
nxwl = size(w,1)-2*ighost;
|
|
nywl = size(w,2)-2*ighost;
|
|
nzwl = size(w,3)-2*ighost;
|
|
params = int64([ighost,ibw,jbw,kbw,nxwl,nywl,nzwl,nxw,nyw,nzw]);
|
|
obj.appendSet(w,params);
|
|
|
|
% Write p
|
|
nxpl = size(p,1)-2*ighost;
|
|
nypl = size(p,2)-2*ighost;
|
|
nzpl = size(p,3)-2*ighost;
|
|
params = int64([ighost,ibp,jbp,kbp,nxpl,nypl,nzpl,nxp,nyp,nzp]);
|
|
obj.appendSet(p,params);
|
|
|
|
% Close file
|
|
obj.close();
|
|
end
|