Corrections in enhanced solver

This commit is contained in:
2023-09-19 14:17:20 +02:00
parent 823d1aac8f
commit 667e194a6b
9 changed files with 20030 additions and 20029 deletions

View File

@@ -72,13 +72,13 @@ int main (int argc, char** argv)
computeFG(&solver);
computeRHS(&solver);
//if (nt % 100 == 0) normalizePressure(&solver);
if (nt % 100 == 0) normalizePressure(&solver);
solver_generic[variant - 1](&solver);
adaptUV(&solver);
/* Added function for particle tracing. Will inject and advance particles as per timePeriod */
// trace(&particletracer, solver.u, solver.v, t);
trace(&particletracer, solver.u, solver.v, t);
t += solver.dt;
nt++;

View File

@@ -318,6 +318,19 @@ void solveRB(Solver* solver)
res = 0.0;
jsw = 1;
for (int i = 1; i < imax + 1; i++) {
P(i, 0) = P(i, 1);
P(i, jmax + 1) = P(i, jmax);
}
for (int j = 1; j < jmax + 1; j++) {
P(0, j) = P(1, j);
P(imax + 1, j) = P(imax, j);
}
// setObjectPBoundaryCondition(solver);
for (pass = 0; pass < 2; pass++)
{
isw = jsw;
@@ -342,18 +355,6 @@ void solveRB(Solver* solver)
jsw = 3 - jsw;
}
for (int i = 1; i < imax + 1; i++) {
P(i, 0) = P(i, 1);
P(i, jmax + 1) = P(i, jmax);
}
for (int j = 1; j < jmax + 1; j++) {
P(0, j) = P(1, j);
P(imax + 1, j) = P(imax, j);
}
//setObjectPBoundaryCondition(solver);
res = res / (double)(imax * jmax);
#ifdef DEBUG
@@ -630,7 +631,7 @@ void setObjectBoundaryCondition(Solver* solver)
V(i,j) = 0.0;
break;
case LEFT:
U(i,j) = 0.0;
U(i-1,j) = 0.0;
V(i,j) = -V(i-1,j);
V(i,j-1) = -V(i-1,j-1);
break;
@@ -643,13 +644,13 @@ void setObjectBoundaryCondition(Solver* solver)
U(i,j) = -U(i,j+1);
U(i-1,j) = 0.0;
V(i,j) = 0.0;
V(i,j+1) = -V(i-1,j+1);
V(i,j-1) = -V(i-1,j-1);
break;
case TOPRIGHT:
U(i,j) = 0.0;
U(i+1,j) = -U(i+1,j+1);
U(i-1,j) = -U(i-1,j+1);
V(i,j) = 0.0;
V(i,j+1) = -V(i+1,j+1);
V(i,j-1) = -V(i+1,j-1);
break;
case BOTTOMLEFT:
U(i,j) = -U(i,j-1);
@@ -659,7 +660,7 @@ void setObjectBoundaryCondition(Solver* solver)
break;
case BOTTOMRIGHT:
U(i,j) = 0.0;
U(i+1,j) = -U(i+1,j-1);
U(i-1,j) = -U(i-1,j-1);
V(i,j) = -V(i,j+1);
V(i,j-1) = 0.0;
break;