Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for terrain / grid stretching #1361

Merged
merged 18 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
3 changes: 2 additions & 1 deletion Docs/sphinx_doc/Inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ This automatically activates **erf.use_terrain**. By default, the
problem-specific terrain is initialized to be flat at an elevation of z=0.
These inputs are used to automatically generate the staggered z levels used to
calculate the grid metric transformation. Alternatively, arbitrary z levels may
be specified with the **erf.terrain_z_levels** parameter.
be specified with the **erf.terrain_z_levels** parameter, which should vary
from 0 (at the surface) to the domain height.

.. _list-of-parameters-3:

Expand Down
5 changes: 0 additions & 5 deletions Exec/ABL/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ public:
amrex::Array4<amrex::Real const> const& mf_v,
const SolverChoice& sc) override;

void init_custom_terrain (
const amrex::Geometry& geom,
amrex::MultiFab& z_phys_nd,
const amrex::Real& time) override;

protected:
std::string name() override { return "ABL"; }

Expand Down
25 changes: 0 additions & 25 deletions Exec/ABL/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,28 +164,3 @@ Problem::init_custom_pert(
}
});
}

void
Problem::init_custom_terrain(
const Geometry& /*geom*/,
MultiFab& z_phys_nd,
const Real& /*time*/)
{
// Number of ghost cells
int ngrow = z_phys_nd.nGrow();

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

Array4<Real> z_arr = z_phys_nd.array(mfi);

ParallelFor(xybx, [=] AMREX_GPU_DEVICE (int i, int j, int) {

// Flat terrain with z = 0 at k = 0
z_arr(i,j,0) = 0.;
});
}
}
5 changes: 0 additions & 5 deletions Exec/ABL_input_sounding/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ public:
amrex::Array4<amrex::Real const> const& mf_v,
const SolverChoice& sc) override;

void init_custom_terrain (
const amrex::Geometry& geom,
amrex::MultiFab& z_phys_nd,
const amrex::Real& time) override;

protected:
std::string name() override { return "ABL with input sounding"; }

Expand Down
25 changes: 0 additions & 25 deletions Exec/ABL_input_sounding/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,28 +157,3 @@ Problem::init_custom_pert(
}
});
}

void
Problem::init_custom_terrain(
const Geometry& /*geom*/,
MultiFab& z_phys_nd,
const Real& /*time*/)
{
// Number of ghost cells
int ngrow = z_phys_nd.nGrow();

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

Array4<Real> z_arr = z_phys_nd.array(mfi);

ParallelFor(xybx, [=] AMREX_GPU_DEVICE (int i, int j, int) {

// Flat terrain with z = 0 at k = 0
z_arr(i,j,0) = 0.;
});
}
}
5 changes: 0 additions & 5 deletions Exec/DevTests/MiguelDev/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ public:
amrex::Array4<amrex::Real const> const& mf_v,
const SolverChoice& sc) override;

void init_custom_terrain (
const amrex::Geometry& geom,
amrex::MultiFab& z_phys_nd,
const amrex::Real& time) override;

protected:
std::string name() override { return "ABL test"; }

Expand Down
28 changes: 0 additions & 28 deletions Exec/DevTests/MiguelDev/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,31 +140,3 @@ Problem::init_custom_pert(
});

}

void
Problem::init_custom_terrain(
const Geometry& /*geom*/,
MultiFab& z_phys_nd,
const Real& /*time*/)
{
// Number of ghost cells
int ngrow = z_phys_nd.nGrow();

// Bottom of domain
int k0 = 0;

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

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

ParallelFor(xybx, [=] AMREX_GPU_DEVICE (int i, int j, int) {

// Flat terrain with z = 0 at k = 0
z_arr(i,j,k0) = 0.0;
});
}
}
5 changes: 0 additions & 5 deletions Exec/DevTests/MultiBlock/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ public:
amrex::Array4<amrex::Real const> const& mf_v,
const SolverChoice& sc) override;

void init_custom_terrain (
const amrex::Geometry& geom,
amrex::MultiFab& z_phys_nd,
const amrex::Real& time) override;

protected:
std::string name() override { return "MultiBlock"; }

Expand Down
28 changes: 0 additions & 28 deletions Exec/DevTests/MultiBlock/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,31 +111,3 @@ Problem::init_custom_pert(

amrex::Gpu::streamSynchronize();
}

void
Problem::init_custom_terrain(
const Geometry& /*geom*/,
MultiFab& z_phys_nd,
const Real& /*time*/)
{
// Number of ghost cells
int ngrow = z_phys_nd.nGrow();

// Bottom of domain
int k0 = 0;

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

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

ParallelFor(xybx, [=] AMREX_GPU_DEVICE (int i, int j, int) {

// Flat terrain with z = 0 at k = 0
z_arr(i,j,k0) = 0.0;
});
}
}
5 changes: 0 additions & 5 deletions Exec/LLJ/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ public:
amrex::Array4<amrex::Real const> const& mf_v,
const SolverChoice& sc) override;

void init_custom_terrain (
const amrex::Geometry& geom,
amrex::MultiFab& z_phys_nd,
const amrex::Real& time) override;

protected:
std::string name() override { return "Low-Level Jet"; }

Expand Down
25 changes: 0 additions & 25 deletions Exec/LLJ/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,3 @@ Problem::init_custom_pert(
{
amrex::Print() << "Dummy function..Needed for linking" << std::endl;
}

void
Problem::init_custom_terrain(
const Geometry& /*geom*/,
MultiFab& z_phys_nd,
const Real& /*time*/)
{
// Number of ghost cells
int ngrow = z_phys_nd.nGrow();

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

Array4<Real> z_arr = z_phys_nd.array(mfi);

ParallelFor(xybx, [=] AMREX_GPU_DEVICE (int i, int j, int) {

// Flat terrain with z = 0 at k = 0
z_arr(i,j,0) = 0.;
});
}
}
5 changes: 0 additions & 5 deletions Exec/Radiation/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ public:
amrex::Array4<amrex::Real const> const& mf_v,
const SolverChoice& sc) override;

void init_custom_terrain (
const amrex::Geometry& geom,
amrex::MultiFab& z_phys_nd,
const amrex::Real& time) override;

void erf_init_rayleigh (
amrex::Vector<amrex::Real>& tau,
amrex::Vector<amrex::Real>& ubar,
Expand Down
28 changes: 0 additions & 28 deletions Exec/Radiation/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,34 +212,6 @@ Problem::init_custom_pert(
amrex::Gpu::streamSynchronize();
}

void
Problem::init_custom_terrain(
const Geometry& /*geom*/,
MultiFab& z_phys_nd,
const Real& /*time*/)
{
// Number of ghost cells
int ngrow = z_phys_nd.nGrow();

// Bottom of domain
int k0 = 0;

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

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

ParallelFor(xybx, [=] AMREX_GPU_DEVICE (int i, int j, int) {

// Flat terrain with z = 0 at k = 0
z_arr(i,j,k0) = 0.0;
});
}
}

void
Problem::erf_init_rayleigh(
amrex::Vector<amrex::Real>& tau,
Expand Down
5 changes: 0 additions & 5 deletions Exec/RegTests/Bubble/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ public:
std::unique_ptr<amrex::MultiFab>& z_phys_nd,
amrex::Geometry const& geom) override;

void init_custom_terrain (
const amrex::Geometry& geom,
amrex::MultiFab& z_phys_nd,
const amrex::Real& time) override;

AMREX_FORCE_INLINE
AMREX_GPU_HOST_DEVICE
amrex::Real compute_theta (const amrex::Real T_b, const amrex::Real p_b);
Expand Down
28 changes: 0 additions & 28 deletions Exec/RegTests/Bubble/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,31 +457,3 @@ Problem::init_custom_pert(

amrex::Gpu::streamSynchronize();
}

void
Problem::init_custom_terrain(
const Geometry& /*geom*/,
MultiFab& z_phys_nd,
const Real& /*time*/)
{
// Number of ghost cells
int ngrow = z_phys_nd.nGrow();

// Bottom of domain
int k0 = 0;

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

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

ParallelFor(xybx, [=] AMREX_GPU_DEVICE (int i, int j, int) {

// Flat terrain with z = 0 at k = 0
z_arr(i,j,k0) = 0.0;
});
}
}
5 changes: 0 additions & 5 deletions Exec/RegTests/CouetteFlow/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ public:
amrex::Array4<amrex::Real const> const& mf_v,
const SolverChoice& sc) override;

void init_custom_terrain (
const amrex::Geometry& geom,
amrex::MultiFab& z_phys_nd,
const amrex::Real& time) override;

protected:
std::string name() override { return "Couette Flow"; }

Expand Down
25 changes: 0 additions & 25 deletions Exec/RegTests/CouetteFlow/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,3 @@ Problem::init_custom_pert(
z_vel(i, j, k) = parms.w_0;
});
}

void
Problem::init_custom_terrain(
const Geometry& /*geom*/,
MultiFab& z_phys_nd,
const Real& /*time*/)
{
// Number of ghost cells
int ngrow = z_phys_nd.nGrow();

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

Array4<Real> z_arr = z_phys_nd.array(mfi);

ParallelFor(xybx, [=] AMREX_GPU_DEVICE (int i, int j, int) {

// Flat terrain with z = 0 at k = 0
z_arr(i,j,0) = 0.;
});
}
}
5 changes: 0 additions & 5 deletions Exec/RegTests/DensityCurrent/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public:
amrex::Array4<amrex::Real const> const& mf_v,
const SolverChoice& sc) override;

void init_custom_terrain (
const amrex::Geometry& geom,
amrex::MultiFab& z_phys_nd,
const amrex::Real& time) override;

protected:
std::string name() override { return "Density Current"; }

Expand Down
29 changes: 0 additions & 29 deletions Exec/RegTests/DensityCurrent/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,32 +148,3 @@ Problem::init_custom_pert(

amrex::Gpu::streamSynchronize();
}

void
Problem::init_custom_terrain(
const Geometry& /*geom*/,
MultiFab& z_phys_nd,
const Real& /*time*/)
{
// Number of ghost cells
int ngrow = z_phys_nd.nGrow();

// Bottom of domain
int k0 = 0;

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

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

ParallelFor(xybx, [=] AMREX_GPU_DEVICE (int i, int j, int) {

// Flat terrain with z = 0 at k = 0
z_arr(i,j,k0) = 0.0;
});
}
}

Loading
Loading