I want to export the u component of velocity field every 100 iterations to a file. I also write the coordinates of the cells in 3 columns.
So, I wrote the following codes in cs_extra_operations.cs file.
Code: Select all
const cs_lnum_t n_cells = cs_glob_mesh-> n_cells;
cs_real_3_t *cvar_vel = (cs_real_3_t *)CS_F_(u)->val;
cs_real_3_t *cell_cen = mesh_quantities->cell_cen;
if(fmod(ntcabs,5) == 0)
{
for (cs_lnum_t i = 0; i < n_cells; i++) {
FILE *f2 = NULL;
f2 = fopen("VELOCITY_COMPONENTS","a");
fprintf(f2, "%i\t%f\t%f\t%f\t%f\n", ntcabs, cvar_vel[i][0],cell_cen[i][0],cell_cen[i][1],cell_cen[i][2]);
fclose (f2);
}
}
The exported data are sorted randomly in parallel mode, while in single processor mode they are sorted very well by cell id.
Is there a way to sort the exported data in parallel mode like the ones in single processor mode?
Regards,
Mohammad