% script to record values that change during computation

app.normu = norm(u);
app.meanu = mean(u);
app.normv = norm(v);
app.meanv = mean(v);
app.normP = norm(P);
app.meanP = mean(P);
app.meanrho = mean(rho);

if exist(sprintf('%s/Save/%s/',d0,app.savemat),'dir')
    fid = fopen(sprintf('%s/Save/%s/%s.log',d0,app.savemat,app.savemat), 'a');
else
    fid = fopen(sprintf('%s/Save/%s.log',d0,app.savemat), 'a');
end

if k==0
    fprintf(fid, '\n\ntime (T)   \tmean U \tmean V \tmean P\t\tL2norm U\tL2norm V\tL2norm P\tmean density\t time');
end
fprintf(fid, '\n %6.4f\t\t% -6.4f\t% -6.4f\t% -6.4f\t\t% -7.4f \t% -7.4f \t% -7.4f \t% -7.4f \t\t%s',k*app.dt,app.meanu,app.meanv,app.meanP,app.normu,app.normv,app.normP,app.meanrho,datestr(now));
fclose(fid);