Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhichen3 committed Dec 3, 2024
1 parent bd282c1 commit 90db818
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Source/hydro/advection_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,17 @@ Castro::divu(const Box& bx,

// Cylindrical R-Z

// These are transverse averages in the y-direction
Real ul = 0.5_rt * (q_arr(i-1,j,k,QU) + q_arr(i-1,j-1,k,QU));
Real ur = 0.5_rt * (q_arr(i,j,k,QU) + q_arr(i,j-1,k,QU));

if (i == 0) {
ux = 0.0_rt;
ux = 2.0_rt * (ur - ul) * dxinv;
} else {
Real rl = (i - 0.5_rt) * dx[0] + problo[0];
Real rr = (i + 0.5_rt) * dx[0] + problo[0];
Real rc = (i) * dx[0] + problo[0];

// These are transverse averages in the y-direction
Real ul = 0.5_rt * (q_arr(i-1,j,k,QU) + q_arr(i-1,j-1,k,QU));
Real ur = 0.5_rt * (q_arr(i,j,k,QU) + q_arr(i,j-1,k,QU));

// Take 1/r d/dr(r*u)
ux = (rr * ur - rl * ul) * dxinv / rc;
}
Expand Down Expand Up @@ -307,18 +307,18 @@ Castro::divu(const Box& bx,
Real ul = 0.5_rt * (q_arr(i-1,j,k,QU) + q_arr(i-1,j-1,k,QU));
Real ur = 0.5_rt * (q_arr(i,j,k,QU) + q_arr(i,j-1,k,QU));

// These are transverse averages in the x-direction
Real vb = 0.5_rt * (q_arr(i,j-1,k,QV) + q_arr(i-1,j-1,k,QV));
Real vt = 0.5_rt * (q_arr(i,j,k,QV) + q_arr(i-1,j,k,QV));

// Finite difference to get divergence. ux = 1/r^2 d/dr(r^2 * u)
ux = (ur * rr * rr - ul * rl * rl) * dxinv / (rc * rc);

// If sinc == 0, then vy goes inf.
// But due to Phi-symmetry, vt*sint = vb*sinb, so set to 0.
if (sinc == 0.0_rt) {
vy = 0.0_rt;
vy = 2.0_rt * (vt - vb) * dxinv / rc;
} else {
// These are transverse averages in the x-direction
Real vb = 0.5_rt * (q_arr(i,j-1,k,QV) + q_arr(i-1,j-1,k,QV));
Real vt = 0.5_rt * (q_arr(i,j,k,QV) + q_arr(i-1,j,k,QV));

// Finite difference to get divergence. vy = 1/(r sin) * d/dtheta(v sin)
vy = (vt * sint - vb * sinb) * dyinv / (rc * sinc);
}
Expand Down

0 comments on commit 90db818

Please sign in to comment.