Enhanced Solver in progess

This commit is contained in:
Aditya Ujeniya 2023-09-19 12:13:14 +02:00
parent 70611112d5
commit 823d1aac8f
9 changed files with 10103 additions and 19761 deletions

View File

@ -0,0 +1,73 @@
Rank, SOR, RB
1, 86.28, 46.72
2, 41.61, 32.01
3, 30.54, 29.39
4, 25.42, 21.58
5, 22.41, 24.34
6, 19.24, 18.86
7, 17.98, 22.45
8, 17.08, 18.98
9, 16.59, 19.84
10, 15.30, 18.60
11, 15.49, 21.93
12, 15.05, 19.61
13, 15.78, 21.57
14, 14.44, 16.53
15, 13.94, 17.54
16, 13.14, 18.97
17, 17.31, 19.64
18, 13.59, 18.33
19, 22.20, 34.39
20, 12.55, 16.40
21, 12.75, 18.14
22, 12.61, 17.22
23, 3.30, 30.04
24, 12.25, 18.27
25, 12.42, 16.13
26, 12.74, 17.17
27, 12.08, 19.87
28, 12.31, 17.62
29, 2.95, 3.37
30, 12.14, 16.16
31, 2.78, 3.53
32, 11.80, 19.34
33, 12.52, 21.27
34, 13.06, 15.24
35, 12.13, 15.23
36, 12.13, 18.15
37, 3.11, 3.67
38, 26.77, 26.82
39, 12.39, 21.69
40, 11.34, 15.61
41, 2.89, 3.34
42, 11.92, 18.12
43, 2.79, 3.40
44, 14.22, 37.07
45, 12.12, 15.90
46, 2.29, 23.39
47, 2.91, 3.55
48, 12.27, 21.39
49, 12.71, 19.82
50, 13.01, 16.37
51, 2.91, 17.26
52, 2.39, 5.00
53, 2.95, 3.47
54, 15.58, 65.25
55, 2.59, 15.84
56, 11.78, 21.47
57, 2.36, 3.88
58, 2.18, 2.34
59, 2.95, 3.33
60, 16.75, 14.88
61, 2.73, 3.20
62, 2.32, 2.73
63, 2.60, 25.96
64, 19.61, 36.29
65, 2.08, 17.16
66, 1.93, 2.32
67, 2.72, 3.44
68, 2.06, 17.25
69, 2.13, 129.62
70, 2.05, 15.92
71, 2.66, 3.21
72, 2.16, 2.54
1 Rank SOR RB
2 1 86.28 46.72
3 2 41.61 32.01
4 3 30.54 29.39
5 4 25.42 21.58
6 5 22.41 24.34
7 6 19.24 18.86
8 7 17.98 22.45
9 8 17.08 18.98
10 9 16.59 19.84
11 10 15.30 18.60
12 11 15.49 21.93
13 12 15.05 19.61
14 13 15.78 21.57
15 14 14.44 16.53
16 15 13.94 17.54
17 16 13.14 18.97
18 17 17.31 19.64
19 18 13.59 18.33
20 19 22.20 34.39
21 20 12.55 16.40
22 21 12.75 18.14
23 22 12.61 17.22
24 23 3.30 30.04
25 24 12.25 18.27
26 25 12.42 16.13
27 26 12.74 17.17
28 27 12.08 19.87
29 28 12.31 17.62
30 29 2.95 3.37
31 30 12.14 16.16
32 31 2.78 3.53
33 32 11.80 19.34
34 33 12.52 21.27
35 34 13.06 15.24
36 35 12.13 15.23
37 36 12.13 18.15
38 37 3.11 3.67
39 38 26.77 26.82
40 39 12.39 21.69
41 40 11.34 15.61
42 41 2.89 3.34
43 42 11.92 18.12
44 43 2.79 3.40
45 44 14.22 37.07
46 45 12.12 15.90
47 46 2.29 23.39
48 47 2.91 3.55
49 48 12.27 21.39
50 49 12.71 19.82
51 50 13.01 16.37
52 51 2.91 17.26
53 52 2.39 5.00
54 53 2.95 3.47
55 54 15.58 65.25
56 55 2.59 15.84
57 56 11.78 21.47
58 57 2.36 3.88
59 58 2.18 2.34
60 59 2.95 3.33
61 60 16.75 14.88
62 61 2.73 3.20
63 62 2.32 2.73
64 63 2.60 25.96
65 64 19.61 36.29
66 65 2.08 17.16
67 66 1.93 2.32
68 67 2.72 3.44
69 68 2.06 17.25
70 69 2.13 129.62
71 70 2.05 15.92
72 71 2.66 3.21
73 72 2.16 2.54

File diff suppressed because it is too large Load Diff

17
BasicSolver/2D-mpi-v3/sample.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
rm data.csv
echo "Rank, SOR, RB" >> data.csv
for i in {1..72}
do
res=$(mpirun -n $i ./exe-ICC dcavity.par 1 | grep "Solution took" | cut -c 14- )
res2=$(mpirun -n $i ./exe-ICC dcavity.par 2 | grep "Solution took" | cut -c 14- )
s="$i, $res, $res2"
s=${s//"s"/}
echo $s >> data.csv
done

View File

@ -80,7 +80,7 @@ int main (int argc, char** argv)
solver_generic[variant - 1](&solver);
adaptUV(&solver);
trace(&particletracer, solver.u, solver.v, t);
//trace(&particletracer, solver.u, solver.v, t);
t += solver.dt;

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -17,6 +17,6 @@ jmax 200 # number of interior cells in y-direction
itermax 10000 # maximal number of pressure iteration in one time step
eps 0.000001 # stopping tolerance for pressure iteration
rho 0.99999
omg 1.9 # relaxation parameter for SOR iteration
omg 1.991 # relaxation parameter for SOR iteration
#===============================================================================

View File

@ -19,7 +19,7 @@ enum VARIANT { SOR = 1, RB, RBA };
int main (int argc, char** argv)
{
int rank;
int variant = SOR;
int variant = RB;
Parameter params;
Solver solver;
@ -60,7 +60,7 @@ int main (int argc, char** argv)
solveRBA(&solver);
break;
}
getResult(&solver);
//getResult(&solver);
MPI_Finalize();
return EXIT_SUCCESS;

View File

@ -102,7 +102,7 @@ void initSolver(Solver *solver, Parameter *params, int problem)
solver->imax = params->imax;
solver->jmax = params->jmax;
solver->jmaxLocal = sizeOfRank(solver->rank, solver->size, solver->jmax);
printf("RANK %d: %d\n", solver->rank, solver->jmaxLocal);
printf("RANK %d: imaxLocal : %d, jmaxLocal : %d\n", solver->rank, solver->imax, solver->jmaxLocal);
solver->dx = params->xlength/params->imax;
solver->dy = params->ylength/params->jmax;
@ -182,7 +182,7 @@ int solve(Solver *solver)
{
double r;
int it = 0;
double res;
double res, res1;
int imax = solver->imax;
int jmax = solver->jmax;
@ -234,11 +234,12 @@ int solve(Solver *solver)
P(imax+1, j) = P(imax, j);
}
MPI_Allreduce(&res, &res, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(&res, &res1, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
res = res1;
res = sqrt(res / (imax*jmax));
#ifdef DEBUG
if ( solver->rank == 0 ) {
printf("%d Residuum: %e\n",it, res);
printf("%d Residuum: %e\n",it, res1);
}
#endif
it++;
@ -258,7 +259,7 @@ int solveRB(Solver* solver)
{
double r;
int it = 0;
double res;
double res, res1;
int imax = solver->imax;
int jmax = solver->jmax;
@ -311,7 +312,8 @@ int solveRB(Solver* solver)
P(0, j) = P(1, j);
P(imax + 1, j) = P(imax, j);
}
MPI_Allreduce(&res, &res1, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
res = res1;
res = res / (double)(imax * jmax);
#ifdef DEBUG
printf("%d Residuum: %e\n", it, res);