Fixed Poisson 2D MPI

This commit is contained in:
Aditya Ujeniya 2023-10-02 10:43:16 +02:00
parent 667e194a6b
commit bd0381e6a8
9 changed files with 20292 additions and 20210 deletions

View File

@ -0,0 +1,72 @@
#==============================================================================
# Laminar Canal Flow
#==============================================================================
# Problem specific Data:
# ---------------------
name backstep # name of flow setup
bcTop 1 # flags for boundary conditions
bcBottom 1 # 1 = no-slip 3 = outflow
bcLeft 3 # 2 = free-slip 4 = periodic
bcRight 3 #
gx 0.0 # Body forces (e.g. gravity)
gy 0.0 #
re 30000.0 # Reynolds number
u_init 1.0 # initial value for velocity in x-direction
v_init 0.0 # initial value for velocity in y-direction
p_init 0.0 # initial value for pressure
# Geometry Data:
# -------------
xlength 30.0 # domain size in x-direction
ylength 4.0 # domain size in y-direction
imax 200 # number of interior cells in x-direction
jmax 50 # number of interior cells in y-direction
# Time Data:
# ---------
te 100.0 # final time
dt 0.02 # time stepsize
tau 0.5 # safety factor for time stepsize control (<0 constant delt)
# Pressure Iteration Data:
# -----------------------
itermax 500 # maximal number of pressure iteration in one time step
eps 0.0001 # stopping tolerance for pressure iteration
rho 0.52
omg 1.8 # relaxation parameter for SOR iteration
gamma 0.9 # upwind differencing factor gamma
# Particle Tracing Data:
# -----------------------
numberOfParticles 60
startTime 0
injectTimePeriod 2.0
writeTimePeriod 0.5
x1 1.0
y1 0.0
x2 1.0
y2 4.0
# Obstacle Geometry Data:
# -----------------------
# Shape 0 disable, 1 Rectangle/Square, 2 Circle
shape 1
xCenter 0.0
yCenter 0.0
xRectLength 8.0
yRectLength 1.0
circleRadius 1.0
#===============================================================================

View File

@ -32,7 +32,7 @@ jmax 50 # number of interior cells in y-direction
# Time Data: # Time Data:
# --------- # ---------
te 700.0 # final time te 100.0 # final time
dt 0.02 # time stepsize dt 0.02 # time stepsize
tau 0.5 # safety factor for time stepsize control (<0 constant delt) tau 0.5 # safety factor for time stepsize control (<0 constant delt)
@ -62,7 +62,7 @@ y2 4.0
# ----------------------- # -----------------------
# Shape 0 disable, 1 Rectangle/Square, 2 Circle # Shape 0 disable, 1 Rectangle/Square, 2 Circle
shape 1 shape 0
xCenter 4.0 xCenter 4.0
yCenter 1 yCenter 1
xRectLength 8.0 xRectLength 8.0

File diff suppressed because it is too large Load Diff

View File

@ -78,7 +78,7 @@ int main (int argc, char** argv)
/* Added function for particle tracing. Will inject and advance particles as per timePeriod */ /* 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; t += solver.dt;
nt++; nt++;

View File

@ -595,7 +595,8 @@ void setSpecialBoundaryCondition(Solver* solver)
for (int i = 1; i < imax; i++) { for (int i = 1; i < imax; i++) {
U(i, jmax + 1) = 2.0 - U(i, jmax); U(i, jmax + 1) = 2.0 - U(i, jmax);
} }
} else if (strcmp(solver->problem, "canal") == 0) { }
else if (strcmp(solver->problem, "canal") == 0) {
double ylength = solver->ylength; double ylength = solver->ylength;
double y; double y;
@ -604,6 +605,15 @@ void setSpecialBoundaryCondition(Solver* solver)
U(0, j) = y * (ylength - y) * 4.0 / (ylength * ylength); 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;
}
}
} }
void setObjectBoundaryCondition(Solver* solver) void setObjectBoundaryCondition(Solver* solver)

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 42 KiB

File diff suppressed because one or more lines are too long

View File

@ -288,7 +288,7 @@ int solveRB(Solver* solver)
isw = jsw; isw = jsw;
exchange(solver); exchange(solver);
for (int j = 1; j < jmax + 1; j++) { for (int j = 1; j < jmaxLocal + 1; j++) {
for (int i = isw; i < imax + 1; i += 2) { for (int i = isw; i < imax + 1; i += 2) {
double r = RHS(i, j) - double r = RHS(i, j) -
@ -305,10 +305,10 @@ int solveRB(Solver* solver)
for (int i = 1; i < imax + 1; i++) { for (int i = 1; i < imax + 1; i++) {
P(i, 0) = P(i, 1); P(i, 0) = P(i, 1);
P(i, jmax + 1) = P(i, jmax); P(i, jmaxLocal + 1) = P(i, jmaxLocal);
} }
for (int j = 1; j < jmax + 1; j++) { for (int j = 1; j < jmaxLocal + 1; j++) {
P(0, j) = P(1, j); P(0, j) = P(1, j);
P(imax + 1, j) = P(imax, j); P(imax + 1, j) = P(imax, j);
} }
@ -366,7 +366,7 @@ int solveRBA(Solver* solver)
isw = jsw; isw = jsw;
exchange(solver); exchange(solver);
for (int j = 1; j < jmax + 1; j++) { for (int j = 1; j < jmaxLocal + 1; j++) {
for (int i = isw; i < imax + 1; i += 2) { for (int i = isw; i < imax + 1; i += 2) {
double r = RHS(i, j) - double r = RHS(i, j) -
@ -385,10 +385,10 @@ int solveRBA(Solver* solver)
for (int i = 1; i < imax + 1; i++) { for (int i = 1; i < imax + 1; i++) {
P(i, 0) = P(i, 1); P(i, 0) = P(i, 1);
P(i, jmax + 1) = P(i, jmax); P(i, jmaxLocal + 1) = P(i, jmaxLocal);
} }
for (int j = 1; j < jmax + 1; j++) { for (int j = 1; j < jmaxLocal + 1; j++) {
P(0, j) = P(1, j); P(0, j) = P(1, j);
P(imax + 1, j) = P(imax, j); P(imax + 1, j) = P(imax, j);
} }