Skip to content

Commit

Permalink
Merge pull request #23 from AMReX-Fluids/development
Browse files Browse the repository at this point in the history
Improve diffuse tensor velocity (AMReX-Fluids#160)
  • Loading branch information
ruohai0925 authored Apr 24, 2024
2 parents b5ed568 + 17cb508 commit bd46fa3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/Diffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ Diffusion::diffuse_tensor_velocity (Real dt,
const Box& bx = mfi.tilebox();
auto const& rhs = Rhs.array(mfi);
auto const& unew = U_new.array(mfi,Xvel);
auto const& rho = (rho_flag == 1) ? rho_half.array(mfi) : navier_stokes->get_old_data(State_Type).array(mfi,Density);
auto const& rho = (rho_flag == 1) ? rho_half.array(mfi) : navier_stokes->get_new_data(State_Type).array(mfi,Density);
auto const& deltarhs = (has_delta_rhs) ? delta_rhs->array(mfi,rhsComp) : U_new.array(mfi);
amrex::ParallelFor(bx, [rhs, unew, rho, deltarhs, has_delta_rhs, dt]
AMREX_GPU_DEVICE(int i, int j, int k) noexcept
Expand All @@ -827,6 +827,9 @@ Diffusion::diffuse_tensor_velocity (Real dt,
if ( has_delta_rhs ) {
rhs(i,j,k,n) += deltarhs(i,j,k,n) * dt;
}
// Put unew back since it's a reference to the MF that
// ultimately gets used as an initial guess for the solve
unew(i,j,k,n) /= rho(i,j,k);
}
});
}
Expand Down

0 comments on commit bd46fa3

Please sign in to comment.