Backstep 2D Seq completed

This commit is contained in:
2023-10-02 12:07:00 +02:00
parent bd0381e6a8
commit e9e69c2e07
12 changed files with 18951 additions and 20052 deletions

View File

@@ -134,6 +134,7 @@ void initSolver(Solver* solver, Parameter* params)
solver->dtBound = 0.5 * solver->re * 1.0 / invSqrSum;
int iCenter = 0, jCenter = 0, iRectLength = 0, jRectLength = 0, radius = 0;
double x1=0, x2=0, y1=0, y2=0;
int* s = solver->s;
@@ -142,25 +143,16 @@ void initSolver(Solver* solver, Parameter* params)
case NOSHAPE:
break;
case RECT:
iCenter = params->xCenter/dx;
jCenter = params->yCenter/dy;
iRectLength = params->xRectLength/dx;
jRectLength = params->yRectLength/dy;
int i1 = iCenter - iRectLength/2;
int i2 = iCenter + iRectLength/2;
int j1 = jCenter - jRectLength/2;
int j2 = jCenter + jRectLength/2;
printf("xCenter : %f, yCenter : %f, iCenter : %d, jCenter : %d\n", params->xCenter, params->yCenter, iCenter, jCenter);
printf("xRectLength : %f, yRectLength : %f, dx : %f, dy : %f\n", params->xRectLength, params->yRectLength, dx, dy);
printf("iRectLength : %d, jRectLength : %d, i1 : %d, i2 : %d, j1 : %d, j2 : %d\n", iRectLength, jRectLength, i1, i2, j1, j2);
x1 = params->xCenter - params->xRectLength/2;
x2 = params->xCenter + params->xRectLength/2;
y1 = params->yCenter - params->yRectLength/2;
y2 = params->yCenter + params->yRectLength/2;
for (int j = 1; j < jmax + 1; j++)
{
for (int i = 1; i < imax + 1; i++)
{
if(i1 <= i && i <= i2 && j1 <= j && j <= j2)
if((x1 <= (i*dx)) && ((i*dx) <= x2) && (y1 <= (j*dy)) && ((j*dy) <= y2))
{
S(i, j) = LOCAL;
}
@@ -171,7 +163,7 @@ void initSolver(Solver* solver, Parameter* params)
case CIRCLE:
iCenter = params->xCenter/dx;
jCenter = params->yCenter/dy;
radius = params->circleRadius/dx; // have to change the logic to get max out of both the dx and dy
radius = params->circleRadius;
for (int j = 1; j < jmax + 1; j++)
{
@@ -590,6 +582,7 @@ void setSpecialBoundaryCondition(Solver* solver)
int jmax = solver->jmax;
double mDy = solver->dy;
double* u = solver->u;
int* s = solver->s;
if (strcmp(solver->problem, "dcavity") == 0) {
for (int i = 1; i < imax; i++) {
@@ -605,13 +598,11 @@ void setSpecialBoundaryCondition(Solver* solver)
U(0, j) = y * (ylength - y) * 4.0 / (ylength * ylength);
}
}
else if (strcmp(solver->problem, "backstep") == 0) {
double ylength = solver->ylength;
double y;
for (int j = 1; j < jmax + 1; j++) {
//y = mDy * (j - 0.5);
U(0, j) = 0.0;
else if (strcmp(solver->problem, "backstep") == 0)
{
for (int j = 1; j < jmax + 1; j++)
{
if(S(0,j) == NONE) U(0, j) = 1.0;
}
}
}