Working 2D MPI v3 PT with VTK
This commit is contained in:
parent
920dd887ea
commit
b696d4860e
@ -32,7 +32,7 @@ jmax 50 # number of interior cells in y-direction
|
||||
# Time Data:
|
||||
# ---------
|
||||
|
||||
te 100.0 # final time
|
||||
te 60.0 # final time
|
||||
dt 0.02 # time stepsize
|
||||
tau 0.5 # safety factor for time stepsize control (<0 constant delt)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,18 @@ static int ts = 0;
|
||||
#define XOFFSETEND 2
|
||||
#define YOFFSETEND 3
|
||||
|
||||
static double sum(int* sizes, int size)
|
||||
{
|
||||
double sum = 0;
|
||||
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
sum += sizes[i];
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
static double sumX(double* sizes, int size, int offset, int coord, int init)
|
||||
{
|
||||
double sum = 0;
|
||||
@ -283,13 +295,30 @@ void writeParticles(ParticleTracer* particletracer)
|
||||
char filename[50];
|
||||
FILE* fp;
|
||||
|
||||
snprintf(filename, 50, "vis_files/particles_%d.dat", ts);
|
||||
snprintf(filename, 50, "vtk_files/particles_%d.vtk", ts);
|
||||
fp = fopen(filename, "w");
|
||||
|
||||
if (fp == NULL) {
|
||||
printf("Error!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
fprintf(fp, "# vtk DataFile Version 3.0\n");
|
||||
fprintf(fp, "PAMPI cfd solver particle tracing file\n");
|
||||
fprintf(fp, "ASCII\n");
|
||||
|
||||
|
||||
fprintf(fp, "DATASET UNSTRUCTURED_GRID\n");
|
||||
fprintf(fp, "FIELD FieldData 2\n");
|
||||
fprintf(fp, "TIME 1 1 double\n");
|
||||
fprintf(fp, "%d\n", ts);
|
||||
fprintf(fp, "CYCLE 1 1 int\n");
|
||||
fprintf(fp, "1\n");
|
||||
|
||||
int overallTotalParticles = sum(collectedBuffIndex, particletracer->size);
|
||||
|
||||
fprintf(fp, "POINTS %d float\n", overallTotalParticles);
|
||||
|
||||
printf("Total particles : %d\n", overallTotalParticles);
|
||||
|
||||
for (int i = 1; i < particletracer->size; ++i)
|
||||
{
|
||||
@ -300,7 +329,7 @@ void writeParticles(ParticleTracer* particletracer)
|
||||
{
|
||||
double x = recvBuff[j].x;
|
||||
double y = recvBuff[j].y;
|
||||
fprintf(fp, "%f %f\n", x, y);
|
||||
fprintf(fp, "%f %f 0\n", x, y);
|
||||
//printf("Rank : 0 receiving from rank %d X : %.2f, Y : %.2f with totalpt : %d\n", i, x, y, particletracer->totalParticles);
|
||||
|
||||
}
|
||||
@ -310,8 +339,25 @@ void writeParticles(ParticleTracer* particletracer)
|
||||
{
|
||||
double x = particletracer->particlePool[i].x;
|
||||
double y = particletracer->particlePool[i].y;
|
||||
fprintf(fp, "%f %f\n", x, y);
|
||||
fprintf(fp, "%f %f 0\n", x, y);
|
||||
}
|
||||
|
||||
fprintf(fp, "CELLS %d %d\n", overallTotalParticles, 2 * overallTotalParticles);
|
||||
|
||||
|
||||
for (int i = 0; i < overallTotalParticles; ++i)
|
||||
{
|
||||
fprintf(fp, "1 %d\n", i);
|
||||
}
|
||||
|
||||
fprintf(fp, "CELL_TYPES %d\n", overallTotalParticles);
|
||||
|
||||
|
||||
for (int i = 0; i < overallTotalParticles; ++i)
|
||||
{
|
||||
fprintf(fp, "1\n");
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user