The sweeping in all three directions (if 3D). This routine does the x-sweep and is parallelized using OpenMP for shared memory machines.
{
int i, j, k, n, nmin, nmax;
int direction = 0;
double *rho_1D, *pre_1D, *eng_1D, *vx_1D, *vy_1D, *vz_1D, *marker_1D;
double *rhodown, *rhoup, *rhofront, *rhoback;
double *vxdown, *vxup, *vxfront, *vxback;
double *vydown, *vyup, *vyfront, *vyback;
double *vzdown, *vzup, *vzfront, *vzback;
double *pressure_solid_1D;
double *xa, *dx;
double *dx0, *xa0;
double *a_coef, *ai_coef, *b_coef, *bi_coef, *c_coef, *ci_coef;
double *d_x;
double *diffa;
double *da, *ar;
double *pl, *p6, *rl, *r6;
double *u6, *ul, *vl, *v6;
double *wl, *w6, *el, *e6;
double *ql, *q6, *dp, *du;
double *dv, *dw, *dq, *de;
double *scratch1, *scratch2, *scratch3;
double *dr, *deltaa;
double *plft, *prgh, *ulft, *urgh, *rlft, *rrgh, *Cdtdx, *fCdtdx;
double *steep, *flat;
double **para;
double *clft, *crgh, *plfti, *prghi, *pmid, *pmold, *wlft, *wrgh, *zlft, *zrgh;
double *umidl, *umidr, *umid;
double *dm, *dtbdm, *upmid, *xa1, *xa2, *xa3;
double *vx_1D_old;
double *dvol, *dvol0, *dvol1;
double *delta;
double *fluxr, *fluxu, *fluxv, *fluxw, *fluxe, *fluxq;
double *dm0;
double *e_int_1D;
#ifdef _OPENMP
#pragma omp parallel default(none) \
private(j, i, k, n, nmin, nmax, state, state_next, rho_1D, pre_1D, \
eng_1D, vx_1D, vy_1D, vz_1D, marker_1D, dx0, xa0, xa, dx, \
pressure_solid_1D, a_coef, ai_coef, b_coef, bi_coef, c_coef, ci_coef, \
d_x, diffa, da, ar, pl, p6, rl, r6, \
u6, ul, vl, v6, wl, w6, \
el, e6, ql, q6, dp, du, dr, deltaa, \
dv, dw, dq, de, scratch1, scratch2, scratch3, \
plft, prgh, ulft, urgh, rlft, rrgh, Cdtdx, fCdtdx, \
steep, flat, para, clft, crgh, plfti, prghi, pmid, \
pmold, wlft, wrgh, zlft, zrgh, umidl, umidr, umid, \
dm, dtbdm, upmid, xa1, xa2, xa3, vx_1D_old, \
dvol, dvol0, dvol1, delta, fluxr, fluxu, fluxv, \
fluxw, fluxe, fluxq, dm0, e_int_1D, rhodown, rhoup, \
rhofront, rhoback, vxdown, vxup, vxfront, vxback, \
vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, \
vzback) \
shared(x, y, z, dom, rho, pre, vx, vy, vz, marker, zxa, zdx, \
pressure_on_solid, smallr, small, smallp, Gamma, max_array_length, flag, \
direction, obstacle_density, obstacle_temperature, advection, with_obstacles, \
viscosity_on_off, bound, inflow_density, inflow_velocity, dimension, \
rho_visc, vx_visc, vy_visc, vz_visc)
{
#endif
init_ppm(&rho_1D, &pre_1D, &eng_1D, &vx_1D, &vy_1D, &vz_1D, &marker_1D, &dx0, &xa0, &xa, &dx,
&a_coef, &ai_coef, &b_coef, &bi_coef, &c_coef, &ci_coef, &d_x, &da, &ar,
&dp, &dr, &du, &pl, &p6, &rl, &r6, &ul, &u6, &vl, &v6, &wl, &w6, &el, &e6, &ql,
&q6, &deltaa, &dv, &dw, &dq, &de, &scratch1, &scratch2, &scratch3, &diffa,
&plft, &prgh, &ulft, &urgh, &rlft, &rrgh, &Cdtdx, &fCdtdx, &clft, &crgh,
&plfti, &prghi, &pmid, &pmold, &wlft, &wrgh, &zlft, &zrgh, &umidl, &umidr,
&umid, &dm, &dtbdm, &upmid, &xa1, &xa2, &xa3, &vx_1D_old, &e_int_1D, &dvol,
&dvol0, &dvol1, &delta, &fluxr, &fluxu, &fluxv, &fluxw, &fluxe, &fluxq,
&dm0, &steep, &flat, ¶, &pressure_solid_1D, &rhodown, &rhoup, &rhofront,
&rhoback, &vxdown, &vxup, &vxfront, &vxback, &vydown, &vyup, &vyfront,
&vyback, &vzdown, &vzup, &vzfront, &vzback,
dimension);
for (k = 0; k <
z; k++) {
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (j = 0; j <
y; j++) {
int lefter;
nmin = 0;
nmax = 0;
lefter = 0;
for (i = 0; i <
x; i++) {
n = i + 6 - nmin;
rho_1D[n] =
rho[i][j][k];
pre_1D[n] =
pre[i][j][k];
eng_1D[n] = pre_1D[n] / (rho_1D[n] *
Gamma) + 0.5 * ((pow(vx_1D[n], 2))+(pow(vy_1D[n], 2))+(pow(vz_1D[n], 2)));
if ((j > 0) && (
dom[i][j - 1][k] == 0) && (j < y - 1)) {
}
if ((j > 0) && (
dom[i][j - 1][k] != 0) && (j < y - 1)) {
rhodown[n] = 0.0;
vxdown[n] = 0.0;
vydown[n] = 0.0;
vzdown[n] = 0.0;
}
if (j == 0) {
}
}
if ((j < y - 1) && (
dom[i][j + 1][k] == 0) && (j > 0)) {
}
if ((j < y - 1) && (
dom[i][j + 1][k] != 0) && (j > 0)) {
rhoup[n] = 0.0;
vxup[n] = 0.0;
vyup[n] = 0.0;
vzup[n] = 0.0;
}
if (j == y - 1) {
}
}
}
if ((k > 0) && (
dom[i][j][k - 1] == 0) && (k < z - 1)) {
}
if ((k > 0) && (
dom[i][j][k - 1] != 0) && (k < z - 1)) {
rhofront[n] = 0.0;
vxfront[n] = 0.0;
vyfront[n] = 0.0;
vzfront[n] = 0.0;
}
if (k == 0) {
}
}
if ((k < z - 1) && (
dom[i][j][k + 1] == 0) && (k > 0)) {
}
if ((k < z - 1) && (
dom[i][j][k + 1] != 0) && (k > 0)) {
rhoback[n] = 0.0;
vxback[n] = 0.0;
vyback[n] = 0.0;
vzback[n] = 0.0;
}
if (k == z - 1) {
}
}
}
}
}
else if (
dom[i][j][k] == 1) {
vx_1D[n] = 0.0;
vy_1D[n] = 0.0;
vz_1D[n] = 0.0;
pre_1D[n] = 0.0;
eng_1D[n] = 0.0;
}
if (i < x - 1) {
} else {
}
if (state != state_next) {
int bound_checker;
int ii;
int nminx2 = 6;
int nmaxx2 = (nmax - nmin) + 6;
if ((nmin == 0) || (nmax == (x - 1))) {
bound_checker = 0;
}
if ((nmax - nmin) != (x - 1)) {
bound_checker = 1;
if (nmin == 0) lefter = 1;
if (nmax == (x - 1)) lefter = 2;
if ((nmin != 0) && (nmax != (x - 1))) lefter = 3;
}
ppm_step(i, j, k, direction, flag, nminx2, nmaxx2, a_coef, ai_coef, b_coef, bi_coef, c_coef, ci_coef,
d_x, diffa, da, ar, pl, p6, rl, r6, u6, ul, vl, v6, wl, w6, el,
e6, ql, q6, dp, du, dr, dv, dw, dq, de, scratch1, scratch2, scratch3,
plft, prgh, ulft, urgh, rlft, rrgh, Cdtdx, fCdtdx, steep, flat,
para, clft, crgh, plfti, prghi, pmid, pmold, wlft, wrgh, zlft,
zrgh, umidl, umidr, umid, dm, dtbdm, upmid, xa1, xa2, xa3,
vx_1D_old, dvol, dvol0, dvol1, delta, fluxr, fluxu, fluxv,
fluxw, fluxe, fluxq, dm0, e_int_1D, rho_1D, pre_1D, eng_1D,
vx_1D, vy_1D, vz_1D, marker_1D, pressure_solid_1D,
dx0, xa0, xa, dx, bound_checker, lefter, rhodown, rhoup, rhofront,
rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
for (ii = nmin; ii <= nmax; ii++) {
n = ii + 6 - nmin;
rho[ii][j][k] = rho_1D[n];
pre[ii][j][k] = pre_1D[n];
}
nmin = nmax + 1;
}
}
nmax++;
}
}
}
ppm_free(&rho_1D, &pre_1D, &eng_1D, &vx_1D, &vy_1D, &vz_1D, &marker_1D,
&pressure_solid_1D, &dx0, &xa0, &xa, &dx, &a_coef, &ai_coef,
&b_coef, &bi_coef, &c_coef, &ci_coef, &d_x, &da, &ar,
&dp, &dr, &du, &pl, &p6, &rl, &r6, &ul, &u6, &vl, &v6, &wl, &w6, &el, &e6, &ql,
&q6, &deltaa, &dv, &dw, &dq, &de, &scratch1, &scratch2, &scratch3, &diffa,
&plft, &prgh, &ulft, &urgh, &rlft, &rrgh, &Cdtdx, &fCdtdx, &clft, &crgh,
&plfti, &prghi, &pmid, &pmold, &wlft, &wrgh, &zlft, &zrgh, &umidl, &umidr,
&umid, &dm, &dtbdm, &upmid, &xa1, &xa2, &xa3, &vx_1D_old, &e_int_1D, &dvol,
&dvol0, &dvol1, &delta, &fluxr, &fluxu, &fluxv, &fluxw, &fluxe, &fluxq,
&dm0, &steep, &flat, ¶, &rhodown, &rhoup, &rhofront,
&rhoback, &vxdown, &vxup, &vxfront, &vxback, &vydown, &vyup, &vyfront,
&vyback, &vzdown, &vzup, &vzfront, &vzback,
dimension);
#ifdef _OPENMP
}
#endif
return 0;
}