Enhanced Solver in progess

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

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);