Skip to content

Commit

Permalink
implement 2D
Browse files Browse the repository at this point in the history
  • Loading branch information
Hua Tan committed Sep 19, 2024
1 parent 1789530 commit b9df26d
Show file tree
Hide file tree
Showing 6 changed files with 1,357 additions and 948 deletions.
44 changes: 42 additions & 2 deletions src/convection/incflo_compute_MAC_projected_velocities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ incflo::compute_MAC_projected_velocities (
// Predict normal velocity to faces -- note that the {u_mac, v_mac, w_mac}
// returned from this call are on face CENTROIDS
bool allow_inflow_on_outflow = false;
HydroUtils::ExtrapVelToFaces(*vel[lev], *vel_forces[lev],
/*HydroUtils::ExtrapVelToFaces(*vel[lev], *vel_forces[lev],
AMREX_D_DECL(*u_mac[lev], *v_mac[lev], *w_mac[lev]),
get_velocity_bcrec(), get_velocity_bcrec_device_ptr(),
geom[lev], l_dt,
Expand All @@ -175,12 +175,52 @@ incflo::compute_MAC_projected_velocities (
#endif
m_godunov_ppm, m_godunov_use_forces_in_trans,
l_advection_type, PPM::default_limiter,
allow_inflow_on_outflow, BC_MF.get());
allow_inflow_on_outflow, BC_MF.get());*/

//add surface tension
//if(m_vof_advect_tracer)
// get_volume_of_fluid ()->velocity_face_source(lev,l_dt, AMREX_D_DECL(*u_mac[lev], *v_mac[lev], *w_mac[lev]));


if(0){
//The following is only used for testing the pure advection of VOF algorithm
//Average the cell-centered velocity to face center as MAC velocity
#ifdef _OPENMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
for (MFIter mfi(*vel[lev],TilingIfNotGPU()); mfi.isValid(); ++mfi)
{
// Note nodaltilebox will not include the nodal index beyond boundaries between neighboring
// titles. Therefore,if we want to use face values (i.e., face_val) immediately below (commented
// out), we must create index space for the face-centered values of the tiled region
// (i.e., surroundingNodes()).
Box const& bx = mfi.tilebox();
AMREX_D_TERM(Box const& xbx = mfi.nodaltilebox(0);,
Box const& ybx = mfi.nodaltilebox(1);,
Box const& zbx = mfi.nodaltilebox(2););
Array4<Real const> const& velocity = vel[lev]->const_array(mfi);
AMREX_D_TERM(Array4<Real > const& xfv = u_mac[lev]->array(mfi);,
Array4<Real > const& yfv = v_mac[lev]->array(mfi);,
Array4<Real > const& zfv = w_mac[lev]->array(mfi););
AMREX_D_TERM(
ParallelFor(xbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
xfv(i,j,k) = .5*(velocity(i,j,k,0)+velocity(i-1,j,k,0));
});,
ParallelFor(ybx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
yfv(i,j,k) = .5*(velocity(i,j,k,1)+velocity(i,j-1,k,1));
});,

ParallelFor(zbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
zfv(i,j,k) = .5*(velocity(i,j,k,2)+velocity(i,j,k-1,2));
});
) // end AMREX_D_TERM

}
return;
}//test
}

Vector<Array<MultiFab*,AMREX_SPACEDIM> > mac_vec(finest_level+1);
Expand Down
Loading

0 comments on commit b9df26d

Please sign in to comment.