diff --git a/Tests/Particles/Terrain/TerrainFittedPC.cpp b/Tests/Particles/Terrain/TerrainFittedPC.cpp index b598d933ba..741335a538 100644 --- a/Tests/Particles/Terrain/TerrainFittedPC.cpp +++ b/Tests/Particles/Terrain/TerrainFittedPC.cpp @@ -186,13 +186,16 @@ TerrainFittedPC::InitUmac (MultiFab* umac, int lev, Real dt, const MultiFab& a_z const Box tile_box101 = makeSlab(mfi.growntilebox(),1,0); const Box tile_box011 = makeSlab(mfi.growntilebox(),0,0); const Real pi=amrex::Math::pi(); + Real cx =problo[0]+0.5*(probhi[0]-problo[0]); + Real cy =problo[1]+0.5*(probhi[1]-problo[1]); amrex::ParallelFor( tile_box, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { Real x = problo[0]+(r[0]+i)*dx[0]; Real y = problo[1]+(r[1]+j)*dx[1]; Real z = problo[2]+(r[2]+k)*dx[2]; - umac_x_arr(i,j,k,0)=-y; - umac_y_arr(i,j,k,0)=x; + Real theta=atan((y-cy)/(x-cx)); + umac_x_arr(i,j,k,0)=cos(theta);//probhi[1]; + umac_y_arr(i,j,k,0)=sin(theta);//probhi[0]; umac_z_arr(i,j,k,0)=0; }); } diff --git a/Tests/Particles/Terrain/main.cpp b/Tests/Particles/Terrain/main.cpp index 6d4e72e3e0..32b03e65d8 100644 --- a/Tests/Particles/Terrain/main.cpp +++ b/Tests/Particles/Terrain/main.cpp @@ -231,43 +231,41 @@ void testRedistribute () umac[0].define(pc.amrex::ParticleContainerBase::ParticleBoxArray(0),pc.amrex::ParticleContainerBase::ParticleDistributionMap(0),3,0); umac[1].define(pc.amrex::ParticleContainerBase::ParticleBoxArray(0),pc.amrex::ParticleContainerBase::ParticleDistributionMap(0),3,0); umac[2].define(pc.amrex::ParticleContainerBase::ParticleBoxArray(0),pc.amrex::ParticleContainerBase::ParticleDistributionMap(0),3,0); - umac[0].setVal(0.5); - umac[1].setVal(10.0); - umac[2].setVal(1.0); + umac[0].setVal(0.0); + umac[1].setVal(0.0); + umac[2].setVal(0.0); pc.InitUmac(&umac[0], 0, 1.0, a_z_height); pc.InitParticles(a_z_height); pc.WritePlotFile("plot", "particles"); pc.WritePlotFile("plot0", "particles"); pc.AdvectWithUmac(&umac[0], 0, 1.0, a_z_height); - pc.RedistributeLocal(false); + pc.WritePlotFile("plot", "particles"); pc.WritePlotFile("plot1", "particles"); pc.AdvectWithUmac(&umac[0], 0, 1.0, a_z_height); - pc.RedistributeLocal(false); + pc.WritePlotFile("plot2", "particles"); pc.AdvectWithUmac(&umac[0], 0, 1.0, a_z_height); - pc.RedistributeLocal(false); + pc.WritePlotFile("plot3", "particles"); - umac[1].setVal(2.0); pc.AdvectWithUmac(&umac[0], 0, 1.0, a_z_height); - pc.RedistributeLocal(false); + pc.WritePlotFile("plot4", "particles"); pc.AdvectWithUmac(&umac[0], 0, 0.5, a_z_height); - pc.RedistributeLocal(false); + pc.WritePlotFile("plot5", "particles"); pc.AdvectWithUmac(&umac[0], 0, -0.5, a_z_height); - pc.RedistributeLocal(false); + pc.WritePlotFile("plot6", "particles"); pc.AdvectWithUmac(&umac[0], 0, -1.0, a_z_height); - pc.RedistributeLocal(false); + pc.WritePlotFile("plot7", "particles"); - umac[1].setVal(10.0); pc.AdvectWithUmac(&umac[0], 0, -1.0, a_z_height); - pc.RedistributeLocal(false); + pc.AdvectWithUmac(&umac[0], 0, -1.0, a_z_height); - pc.RedistributeLocal(false); + pc.AdvectWithUmac(&umac[0], 0, -1.0, a_z_height); - pc.RedistributeLocal(false); + pc.WritePlotFile("plot8", "particles"); /* pc.checkAnswer();