Skip to content

Commit

Permalink
Merge branch 'development' into LSM
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren authored Jan 31, 2024
2 parents 524753f + 709d24e commit 901e0fa
Show file tree
Hide file tree
Showing 23 changed files with 196 additions and 282 deletions.
6 changes: 1 addition & 5 deletions Exec/DevTests/MovingTerrain/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ public:
const amrex::Real& time) override;

void erf_init_rayleigh (
amrex::Vector<amrex::Real>& tau,
amrex::Vector<amrex::Real>& ubar,
amrex::Vector<amrex::Real>& vbar,
amrex::Vector<amrex::Real>& wbar,
amrex::Vector<amrex::Real>& thetabar,
amrex::Vector<amrex::Vector<amrex::Real> >& rayleigh_ptrs,
amrex::Geometry const& geom,
std::unique_ptr<amrex::MultiFab>& z_phys_cc) override;

Expand Down
45 changes: 20 additions & 25 deletions Exec/DevTests/MovingTerrain/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,34 +132,29 @@ Problem::init_custom_pert(

void
Problem::erf_init_rayleigh(
amrex::Vector<Real>& tau,
amrex::Vector<Real>& ubar,
amrex::Vector<Real>& vbar,
amrex::Vector<Real>& wbar,
amrex::Vector<Real>& thetabar,
amrex::Geometry const& geom,
amrex::Vector<amrex::Vector<amrex::Real> >& rayleigh_ptrs,
amrex::Geometry const& geom,
std::unique_ptr<MultiFab>& /*z_phys_cc*/)
{
// amrex::Error("Should never get here for MovingTerrain problem");
const int khi = geom.Domain().bigEnd()[2];

for (int k = 0; k <= khi; k++)
{
tau[k] = 0.0;
ubar[k] = 0.0;
vbar[k] = 0.0;
wbar[k] = 0.0;
thetabar[k] = 300.0;
}
const int khi = geom.Domain().bigEnd()[2];

// Damping above k = 60
for (int k = 60; k <= khi; k++)
{
tau[k] = 10.; // Remember that this gets multiplied by dt
ubar[k] = 0.0;
vbar[k] = 0.0;
wbar[k] = 0.0;
thetabar[k] = 300.0;
for (int k = 0; k <= khi; k++)
{
rayleigh_ptrs[Rayleigh::tau][k] = 0.0;
rayleigh_ptrs[Rayleigh::ubar][k] = 0.0;
rayleigh_ptrs[Rayleigh::vbar][k] = 0.0;
rayleigh_ptrs[Rayleigh::wbar][k] = 0.0;
rayleigh_ptrs[Rayleigh::thetabar][k] = 300.0;
}

// Damping above k = 60
for (int k = 60; k <= khi; k++)
{
rayleigh_ptrs[Rayleigh::tau][k] = 10.0; // Remember that this gets multiplied by dt
rayleigh_ptrs[Rayleigh::ubar][k] = 2.0;
rayleigh_ptrs[Rayleigh::vbar][k] = 1.0;
rayleigh_ptrs[Rayleigh::wbar][k] = 0.0;
rayleigh_ptrs[Rayleigh::thetabar][k] = 300.0;
}
}

Expand Down
6 changes: 1 addition & 5 deletions Exec/Radiation/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ public:
const SolverChoice& sc) override;

void erf_init_rayleigh (
amrex::Vector<amrex::Real>& tau,
amrex::Vector<amrex::Real>& ubar,
amrex::Vector<amrex::Real>& vbar,
amrex::Vector<amrex::Real>& wbar,
amrex::Vector<amrex::Real>& thetabar,
amrex::Vector<amrex::Vector<amrex::Real> >& rayleigh_ptrs,
amrex::Geometry const& geom,
std::unique_ptr<amrex::MultiFab>& z_phys_cc) override;

Expand Down
18 changes: 7 additions & 11 deletions Exec/Radiation/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,23 +214,19 @@ Problem::init_custom_pert(

void
Problem::erf_init_rayleigh(
amrex::Vector<amrex::Real>& tau,
amrex::Vector<amrex::Real>& ubar,
amrex::Vector<amrex::Real>& vbar,
amrex::Vector<amrex::Real>& wbar,
amrex::Vector<amrex::Real>& thetabar,
amrex::Vector<amrex::Vector<amrex::Real> >& rayleigh_ptrs,
amrex::Geometry const& geom,
std::unique_ptr<amrex::MultiFab>& /*z_phys_cc*/)
std::unique_ptr<MultiFab>& /*z_phys_cc*/)
{
const int khi = geom.Domain().bigEnd()[2];

// We just use these values to test the Rayleigh damping
for (int k = 0; k <= khi; k++)
{
tau[k] = 1.0;
ubar[k] = 2.0;
vbar[k] = 1.0;
wbar[k] = 0.0;
thetabar[k] = parms.T_0;
rayleigh_ptrs[Rayleigh::tau][k] = 1.0;
rayleigh_ptrs[Rayleigh::ubar][k] = 2.0;
rayleigh_ptrs[Rayleigh::vbar][k] = 1.0;
rayleigh_ptrs[Rayleigh::wbar][k] = 0.0;
rayleigh_ptrs[Rayleigh::thetabar][k] = parms.T_0;
}
}
6 changes: 1 addition & 5 deletions Exec/RegTests/ScalarAdvDiff/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ public:
const SolverChoice& sc) override;

void erf_init_rayleigh (
amrex::Vector<amrex::Real>& tau,
amrex::Vector<amrex::Real>& ubar,
amrex::Vector<amrex::Real>& vbar,
amrex::Vector<amrex::Real>& wbar,
amrex::Vector<amrex::Real>& thetabar,
amrex::Vector<amrex::Vector<amrex::Real> >& rayleigh_ptrs,
amrex::Geometry const& geom,
std::unique_ptr<amrex::MultiFab>& z_phys_cc) override;

Expand Down
20 changes: 8 additions & 12 deletions Exec/RegTests/ScalarAdvDiff/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,20 @@ Problem::Problem()

void
Problem::erf_init_rayleigh(
amrex::Vector<Real>& tau,
amrex::Vector<Real>& ubar,
amrex::Vector<Real>& vbar,
amrex::Vector<Real>& wbar,
amrex::Vector<Real>& thetabar,
amrex::Geometry const& geom,
std::unique_ptr<MultiFab>& z_phys_cc)
amrex::Vector<amrex::Vector<amrex::Real> >& rayleigh_ptrs,
amrex::Geometry const& geom,
std::unique_ptr<MultiFab>& /*z_phys_cc*/)
{
const int khi = geom.Domain().bigEnd()[2];

// We just use these values to test the Rayleigh damping
for (int k = 0; k <= khi; k++)
{
tau[k] = 1.0;
ubar[k] = 2.0;
vbar[k] = 1.0;
wbar[k] = 0.0;
thetabar[k] = parms.T_0;
rayleigh_ptrs[Rayleigh::tau][k] = 1.0;
rayleigh_ptrs[Rayleigh::ubar][k] = 2.0;
rayleigh_ptrs[Rayleigh::vbar][k] = 1.0;
rayleigh_ptrs[Rayleigh::wbar][k] = 0.0;
rayleigh_ptrs[Rayleigh::thetabar][k] = parms.T_0;
}
}

Expand Down
6 changes: 1 addition & 5 deletions Exec/SquallLine_2D/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ public:
amrex::Geometry const& geom) override;

void erf_init_rayleigh (
amrex::Vector<amrex::Real>& tau,
amrex::Vector<amrex::Real>& ubar,
amrex::Vector<amrex::Real>& vbar,
amrex::Vector<amrex::Real>& wbar,
amrex::Vector<amrex::Real>& thetabar,
amrex::Vector<amrex::Vector<amrex::Real> >& rayleigh_ptrs,
amrex::Geometry const& geom,
std::unique_ptr<amrex::MultiFab>& z_phys_cc) override;

Expand Down
23 changes: 9 additions & 14 deletions Exec/SquallLine_2D/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,25 +402,20 @@ Problem::init_custom_pert (
}

void
Problem::erf_init_rayleigh (amrex::Vector<amrex::Real>& tau,
amrex::Vector<amrex::Real>& ubar,
amrex::Vector<amrex::Real>& vbar,
amrex::Vector<amrex::Real>& wbar,
amrex::Vector<amrex::Real>& thetabar,
amrex::Geometry const& geom,
std::unique_ptr<amrex::MultiFab>& /*z_phys_cc*/)
Problem::erf_init_rayleigh(
amrex::Vector<amrex::Vector<amrex::Real> >& rayleigh_ptrs,
amrex::Geometry const& geom,
std::unique_ptr<MultiFab>& /*z_phys_cc*/)
{
const int khi = geom.Domain().bigEnd()[2];

// We just use these values to test the Rayleigh damping
for (int k = 0; k <= khi; k++)
{
tau[k] = 1.0;
ubar[k] = 2.0;
vbar[k] = 1.0;
wbar[k] = 0.0;
thetabar[k] = parms.Theta_0;
rayleigh_ptrs[Rayleigh::tau][k] = 1.0;
rayleigh_ptrs[Rayleigh::ubar][k] = 2.0;
rayleigh_ptrs[Rayleigh::vbar][k] = 1.0;
rayleigh_ptrs[Rayleigh::wbar][k] = 0.0;
rayleigh_ptrs[Rayleigh::thetabar][k] = parms.T_0;
}
}


6 changes: 1 addition & 5 deletions Exec/SuperCell/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ public:
const SolverChoice& sc) override;

void erf_init_rayleigh (
amrex::Vector<amrex::Real>& tau,
amrex::Vector<amrex::Real>& ubar,
amrex::Vector<amrex::Real>& vbar,
amrex::Vector<amrex::Real>& wbar,
amrex::Vector<amrex::Real>& thetabar,
amrex::Vector<amrex::Vector<amrex::Real> >& rayleigh_ptrs,
amrex::Geometry const& geom,
std::unique_ptr<amrex::MultiFab>& z_phys_cc) override;

Expand Down
16 changes: 6 additions & 10 deletions Exec/SuperCell/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,7 @@ Problem::init_custom_pert(

void
Problem::erf_init_rayleigh(
amrex::Vector<amrex::Real>& tau,
amrex::Vector<amrex::Real>& ubar,
amrex::Vector<amrex::Real>& vbar,
amrex::Vector<amrex::Real>& wbar,
amrex::Vector<amrex::Real>& thetabar,
amrex::Vector<amrex::Vector<amrex::Real> >& rayleigh_ptrs,
amrex::Geometry const& geom,
std::unique_ptr<MultiFab>& /*z_phys_cc*/)
{
Expand All @@ -227,10 +223,10 @@ Problem::erf_init_rayleigh(
// We just use these values to test the Rayleigh damping
for (int k = 0; k <= khi; k++)
{
tau[k] = 1.0;
ubar[k] = 2.0;
vbar[k] = 1.0;
wbar[k] = 0.0;
thetabar[k] = parms.T_0;
rayleigh_ptrs[Rayleigh::tau][k] = 1.0;
rayleigh_ptrs[Rayleigh::ubar][k] = 2.0;
rayleigh_ptrs[Rayleigh::vbar][k] = 1.0;
rayleigh_ptrs[Rayleigh::wbar][k] = 0.0;
rayleigh_ptrs[Rayleigh::thetabar][k] = parms.T_0;
}
}
4 changes: 4 additions & 0 deletions Source/DataStructs/DataStruct.H
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ enum struct Coord {
x, y, z
};

enum Rayleigh {
tau, ubar, vbar, wbar, thetabar, nvars
};

/**
* Container holding many of the algorithmic options and parameters
*/
Expand Down
5 changes: 1 addition & 4 deletions Source/Diffusion/Diffusion.H
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ void DiffusionSrcForMom_N (const amrex::Box& bxx, const amrex::Box& bxy, const a
const amrex::Array4<const amrex::Real>& tau12 ,
const amrex::Array4<const amrex::Real>& tau13 ,
const amrex::Array4<const amrex::Real>& tau23 ,
const amrex::Array4<const amrex::Real>& cons,
const DiffChoice& diffChoice,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM>& dxInv,
const amrex::Array4<const amrex::Real>& mf_m ,
const amrex::Array4<const amrex::Real>& mf_u ,
Expand All @@ -34,8 +32,7 @@ void DiffusionSrcForMom_T (const amrex::Box& bxx, const amrex::Box& bxy, const a
const amrex::Array4<const amrex::Real>& tau12 , const amrex::Array4<const amrex::Real>& tau13,
const amrex::Array4<const amrex::Real>& tau21 , const amrex::Array4<const amrex::Real>& tau23,
const amrex::Array4<const amrex::Real>& tau31 , const amrex::Array4<const amrex::Real>& tau32,
const amrex::Array4<const amrex::Real>& cons, const amrex::Array4<const amrex::Real>& detJ,
const DiffChoice& diffChoice,
const amrex::Array4<const amrex::Real>& detJ,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM>& dxInv,
const amrex::Array4<const amrex::Real>& mf_m ,
const amrex::Array4<const amrex::Real>& mf_u ,
Expand Down
3 changes: 0 additions & 3 deletions Source/Diffusion/DiffusionSrcForMom_N.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ using namespace amrex;
* @param[in] tau12 12 stress
* @param[in] tau13 13 stress
* @param[in] tau23 23 stress
* @param[in] cons conserved cell center quantities
* @param[in] diffChoice container with diffusion parameters
* @param[in] dxInv inverse cell size array
* @param[in] mf_m map factor at cell center
*/
Expand All @@ -32,7 +30,6 @@ DiffusionSrcForMom_N (const Box& bxx, const Box& bxy , const Box& bxz,
const Array4<const Real>& tau11, const Array4<const Real>& tau22,
const Array4<const Real>& tau33, const Array4<const Real>& tau12,
const Array4<const Real>& tau13, const Array4<const Real>& tau23,
const Array4<const Real>& cons , const DiffChoice& diffChoice,
const GpuArray<Real, AMREX_SPACEDIM>& dxInv,
const Array4<const Real>& mf_m,
const Array4<const Real>& /*mf_u*/,
Expand Down
4 changes: 1 addition & 3 deletions Source/Diffusion/DiffusionSrcForMom_T.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ using namespace amrex;
* @param[in] tau23 23 stress
* @param[in] tau31 31 stress
* @param[in] tau32 32 stress
* @param[in] cons conserved cell center quantities
* @param[in] detJ Jacobian determinant
* @param[in] differChoice container with diffusion parameters
* @param[in] dxInv inverse cell size array
Expand All @@ -37,8 +36,7 @@ DiffusionSrcForMom_T (const Box& bxx, const Box& bxy , const Box& bxz,
const Array4<const Real>& tau12, const Array4<const Real>& tau13,
const Array4<const Real>& tau21, const Array4<const Real>& tau23,
const Array4<const Real>& tau31, const Array4<const Real>& tau32,
const Array4<const Real>& cons , const Array4<const Real>& detJ ,
const DiffChoice& diffChoice,
const Array4<const Real>& detJ ,
const GpuArray<Real, AMREX_SPACEDIM>& dxInv,
const Array4<const Real>& mf_m,
const Array4<const Real>& /*mf_u*/,
Expand Down
18 changes: 6 additions & 12 deletions Source/ERF.H
Original file line number Diff line number Diff line change
Expand Up @@ -758,20 +758,14 @@ private:
static int ng_pres_hse;

// Custom source terms
amrex::Vector<amrex::Vector<amrex::Real> > h_rhotheta_src;
amrex::Vector< amrex::Vector<amrex::Real> > h_rhotheta_src;
amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > d_rhotheta_src;

// Mean quantities and tau for Rayleigh damping
amrex::Vector<amrex::Vector<amrex::Real> > h_rayleigh_tau;
amrex::Vector<amrex::Vector<amrex::Real> > h_rayleigh_ubar;
amrex::Vector<amrex::Vector<amrex::Real> > h_rayleigh_vbar;
amrex::Vector<amrex::Vector<amrex::Real> > h_rayleigh_wbar;
amrex::Vector<amrex::Vector<amrex::Real> > h_rayleigh_thetabar;
amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > d_rayleigh_tau;
amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > d_rayleigh_ubar;
amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > d_rayleigh_vbar;
amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > d_rayleigh_wbar;
amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > d_rayleigh_thetabar;
// This is a vector over levels of vectors across quantities of Vectors
amrex::Vector<amrex::Vector< amrex::Vector<amrex::Real> > > h_rayleigh_ptrs;

// This is a vector over levels of vectors across quantities of DeviceVectors
amrex::Vector<amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real> > > d_rayleigh_ptrs;

amrex::Vector<amrex::Real> h_havg_density;
amrex::Vector<amrex::Real> h_havg_temperature;
Expand Down
Loading

0 comments on commit 901e0fa

Please sign in to comment.