Enhanced Solver in progess
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -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
|
||||
|
||||
#===============================================================================
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user