Skip to content

Commit

Permalink
Changed velocity to towards the center
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsexton03 committed Nov 8, 2023
1 parent 7f8855b commit 6e0fcb9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
7 changes: 5 additions & 2 deletions Tests/Particles/Terrain/TerrainFittedPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
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;
});
}
Expand Down
28 changes: 13 additions & 15 deletions Tests/Particles/Terrain/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6e0fcb9

Please sign in to comment.