Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 43 additions & 7 deletions Source/MacProj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,16 +689,52 @@ MacProj::mac_sync_compute (int level,
}

}
else // Scalars
else // Scalars. Reconstruct forcing terms as in scalar_advection
{
auto const& visc = scal_visc_terms[Smfi].const_array(comp-AMREX_SPACEDIM);
auto const& S = Smf.const_array(Smfi,comp);
auto const& divu = divu_fp -> const_array(Smfi);
amrex::ParallelFor(gbx, [tf, visc, S, divu]
AMREX_GPU_DEVICE (int i, int j, int k) noexcept
auto const& rho = Smf.const_array(Smfi,Density);

if ( NavierStokesBase::do_temp && comp==NavierStokesBase::Temp )
{
//
// Solving
// dT/dt + U dot del T = ( del dot lambda grad T + H_T ) / (rho c_p)
// with tforces = H_T/c_p (since it's always density-weighted), and
// visc = del dot mu grad T, where mu = lambda/c_p
//
amrex::ParallelFor(gbx, [tf, visc, rho]
AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{ tf(i,j,k) = ( tf(i,j,k) + visc(i,j,k) ) / rho(i,j,k); });
}
else
{
tf(i,j,k) += visc(i,j,k) - S(i,j,k) * divu(i,j,k);
});
if (advectionType[comp] == Conservative)
{
//
// For tracers, Solving
// dS/dt + del dot (U S) = del dot beta grad (S/rho) + rho H_q
// where S = rho q, q is a concentration
// tforces = rho H_q (since it's always density-weighted)
// visc = del dot beta grad (S/rho)
//
amrex::ParallelFor(gbx, [tf, visc]
AMREX_GPU_DEVICE (int i, int j, int k ) noexcept
{ tf(i,j,k) += visc(i,j,k); });
}
else
{
//
// Solving
// dS/dt + U dot del S = del dot beta grad S + H_q
// where S = q, q is a concentration
// tforces = rho H_q (since it's always density-weighted)
// visc = del dot beta grad S
//
amrex::ParallelFor(gbx, [tf, visc, rho]
AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{ tf(i,j,k) = tf(i,j,k) / rho(i,j,k) + visc(i,j,k); });
}
}
}
}

Expand Down
4 changes: 1 addition & 3 deletions Source/NavierStokes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,6 @@ NavierStokes::scalar_advection (Real dt,
auto const& tf = forcing_term.array(S_mfi,n);
auto const& visc = visc_terms.const_array(S_mfi,n);
auto const& rho = Smf.const_array(S_mfi); //Previous time, nghost_state() grow cells filled. It's always true that nghost_state > nghost_force.
auto const& divu = divu_fp -> const_array(S_mfi);
auto const& S = Smf.array(S_mfi);

if ( do_temp && n+fscalar==Temp )
{
Expand All @@ -790,7 +788,7 @@ NavierStokes::scalar_advection (Real dt,
// tforces = rho H_q (since it's always density-weighted)
// visc = del dot beta grad (S/rho)
//
amrex::ParallelFor(force_bx, [tf, visc, S, divu, rho]
amrex::ParallelFor(force_bx, [tf, visc]
AMREX_GPU_DEVICE (int i, int j, int k ) noexcept
{ tf(i,j,k) += visc(i,j,k); });
}
Expand Down