forked from moebiusband/NuSiF-Solver
Refactor and add red-black solver
This commit is contained in:
@@ -69,7 +69,7 @@ int main(int argc, char** argv)
|
||||
{
|
||||
double timeStart, timeStop;
|
||||
Parameter params;
|
||||
Solver solver;
|
||||
Solver s;
|
||||
initParameter(¶ms);
|
||||
|
||||
if (argc != 2) {
|
||||
@@ -79,30 +79,28 @@ int main(int argc, char** argv)
|
||||
|
||||
readParameter(¶ms, argv[1]);
|
||||
printParameter(¶ms);
|
||||
initSolver(&solver, ¶ms);
|
||||
initSolver(&s, ¶ms);
|
||||
#ifndef VERBOSE
|
||||
initProgress(solver.te);
|
||||
initProgress(s.te);
|
||||
#endif
|
||||
|
||||
double tau = solver.tau;
|
||||
double te = solver.te;
|
||||
double tau = s.tau;
|
||||
double te = s.te;
|
||||
double t = 0.0;
|
||||
int nt = 0;
|
||||
|
||||
timeStart = getTimeStamp();
|
||||
while (t <= te) {
|
||||
if (tau > 0.0) computeTimestep(&solver);
|
||||
setBoundaryConditions(&solver);
|
||||
setSpecialBoundaryCondition(&solver);
|
||||
computeFG(&solver);
|
||||
computeRHS(&solver);
|
||||
solve(&solver);
|
||||
adaptUV(&solver);
|
||||
t += solver.dt;
|
||||
nt++;
|
||||
if (tau > 0.0) computeTimestep(&s);
|
||||
setBoundaryConditions(&s);
|
||||
setSpecialBoundaryCondition(&s);
|
||||
computeFG(&s);
|
||||
computeRHS(&s);
|
||||
solveRB(&s);
|
||||
adaptUV(&s);
|
||||
t += s.dt;
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("TIME %f , TIMESTEP %f\n", t, solver.dt);
|
||||
printf("TIME %f , TIMESTEP %f\n", t, s.dt);
|
||||
#else
|
||||
printProgress(t);
|
||||
#endif
|
||||
@@ -115,8 +113,7 @@ int main(int argc, char** argv)
|
||||
|
||||
double *pg, *ug, *vg, *wg;
|
||||
|
||||
size_t bytesize = solver.grid.imax * solver.grid.jmax * solver.grid.kmax *
|
||||
sizeof(double);
|
||||
size_t bytesize = (size_t)(s.grid.imax * s.grid.jmax * s.grid.kmax) * sizeof(double);
|
||||
|
||||
pg = allocate(64, bytesize);
|
||||
ug = allocate(64, bytesize);
|
||||
@@ -124,8 +121,8 @@ int main(int argc, char** argv)
|
||||
wg = allocate(64, bytesize);
|
||||
|
||||
createBulkArrays(&s, pg, ug, vg, wg);
|
||||
VtkOptions opts = { .grid = solver.grid };
|
||||
vtkOpen(&opts, solver.problem);
|
||||
VtkOptions opts = { .grid = s.grid };
|
||||
vtkOpen(&opts, s.problem);
|
||||
vtkScalar(&opts, "pressure", pg);
|
||||
vtkVector(&opts, "velocity", (VtkVector) { ug, vg, wg });
|
||||
vtkClose(&opts);
|
||||
|
Reference in New Issue
Block a user