Skip to content

Commit

Permalink
Implement default init_custom_terrain() consistent with flat terrain …
Browse files Browse the repository at this point in the history
…defintions in most prob.cpps
  • Loading branch information
ewquon committed Jan 4, 2024
1 parent 3334f3d commit f9082de
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions Source/prob_common.H
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,26 @@ public:
amrex::MultiFab& z_phys_nd,
const amrex::Real& /*time*/)
{
amrex::Print() << "Initialized flat terrain at z=0" << std::endl;
z_phys_nd.setVal(0.0);
amrex::Print() << "Initializing flat terrain at z=0" << std::endl;

// Number of ghost cells
int ngrow = z_phys_nd.nGrow();

// Bottom of domain
int k0 = 0;

for ( amrex::MFIter mfi(z_phys_nd, amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi )
{
// Grown box with no z range
amrex::Box xybx = mfi.growntilebox(ngrow);
xybx.setRange(2,0);

amrex::Array4<amrex::Real> const& z_arr = z_phys_nd.array(mfi);

ParallelFor(xybx, [=] AMREX_GPU_DEVICE (int i, int j, int) {
z_arr(i,j,k0) = 0.0;
});
}
}

#ifdef ERF_USE_TERRAIN_VELOCITY
Expand Down

0 comments on commit f9082de

Please sign in to comment.