Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d9500d6
rebase without macro coupling.
AMLattanzi Jul 20, 2026
3b0054d
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Jul 20, 2026
6b81de3
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Jul 20, 2026
7652304
Clean up constants.
AMLattanzi Jul 20, 2026
9a7992c
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Jul 21, 2026
b3037ef
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Jul 21, 2026
598a720
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Jul 22, 2026
47391bd
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Jul 27, 2026
1b28456
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Jul 28, 2026
0d04b2f
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Jul 29, 2026
ae22a3f
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 1, 2026
5bcfb1f
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 3, 2026
8f780b0
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 3, 2026
42a19a0
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 3, 2026
6c786c4
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 4, 2026
448e1b9
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 4, 2026
8b4afca
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 4, 2026
8b3a1f4
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 5, 2026
67c50ec
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 5, 2026
f5a9d7b
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 7, 2026
55d40b3
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 7, 2026
0dafe86
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 10, 2026
45d72dc
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 12, 2026
e558a69
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 12, 2026
fe5c6e7
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 14, 2026
cd6f009
Fix imp diff of qv.
AMLattanzi Aug 14, 2026
36c0313
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 15, 2026
6d669dd
Merge branch 'development' into RebaseMoistAcoustic
AMLattanzi Aug 17, 2026
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
15 changes: 9 additions & 6 deletions Source/Diffusion/ERF_Diffusion.H
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,9 @@ void ComputeStrain_T (amrex::Box bxcc, amrex::Box tbxxy,
void ImplicitDiffForStateLU_N (const amrex::Box& bx,
const amrex::Box& domain,
const int level,
const int n,
const double dt,
const int tmp_index,
const int qty_index,
const amrex::Real dt,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM*2>& bc_neumann_vals,
const amrex::Array4< amrex::Real>& cell_data,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM>& cellSizeInv,
Expand All @@ -499,8 +500,9 @@ void ImplicitDiffForStateLU_N (const amrex::Box& bx,
void ImplicitDiffForStateLU_S (const amrex::Box& bx,
const amrex::Box& domain,
const int level,
const int n,
const double dt,
const int tmp_index,
const int qty_index,
const amrex::Real dt,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM*2>& bc_neumann_vals,
const amrex::Array4< amrex::Real>& cell_data,
const amrex::Gpu::DeviceVector<amrex::Real>& stretched_dz_d,
Expand All @@ -516,8 +518,9 @@ void ImplicitDiffForStateLU_S (const amrex::Box& bx,
void ImplicitDiffForStateLU_T (const amrex::Box& bx,
const amrex::Box& domain,
const int level,
const int n,
const double dt,
const int tmp_index,
const int qty_index,
const amrex::Real dt,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM*2>& bc_neumann_vals,
const amrex::Array4< amrex::Real>& cell_data,
const amrex::Array4<const amrex::Real>& z_nd,
Expand Down
24 changes: 11 additions & 13 deletions Source/Diffusion/ERF_ImplicitDiff_N.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ void
ImplicitDiffForStateLU_N (const Box& bx,
const Box& domain,
const int level,
const int n,
const double dt_d,
const int tmp_index,
const int qty_index,
const Real dt,
const GpuArray<Real, AMREX_SPACEDIM*2>& bc_neumann_vals,
const Array4< Real>& cell_data,
const GpuArray<Real, AMREX_SPACEDIM>& cellSizeInv,
Expand All @@ -46,11 +47,8 @@ ImplicitDiffForStateLU_N (const Box& bx,
{
BL_PROFILE_VAR("ImplicitDiffForState_N()",ImplicitDiffForState_N);

Real dt = static_cast<Real>(dt_d);

// setup quantities for getRhoAlpha()
#include "ERF_SetupVertDiff.H"
const int qty_index = n;
const int prim_index = qty_index - 1;
const int prim_scal_index = (qty_index >= RhoScalar_comp && qty_index < RhoScalar_comp+NSCALARS) ? PrimScalar_comp : prim_index;

Expand Down Expand Up @@ -113,7 +111,7 @@ ImplicitDiffForStateLU_N (const Box& bx,
b_tmp = cell_data(i,j,klo,Rho_comp) - a_tmp - c_tmp;
inv_b2_tmp = one;

RHS_a(i,j,klo) = cell_data(i,j,klo,n); // NOTE: this is rho*phi; solution is phi
RHS_a(i,j,klo) = cell_data(i,j,klo,tmp_index); // NOTE: this is rho*phi; solution is phi
if (use_SurfLayer && scalar_zflux) {
RHS_a(i,j,klo) += Fact * scalar_zflux(i,j,klo); // NOTE: scalar_zflux = -K*d_z(\phi)
} else if (neumann_on_zlo) {
Expand All @@ -122,8 +120,8 @@ ImplicitDiffForStateLU_N (const Box& bx,

// Add countergradient correction to RHS at bottom boundary
// Only upper face contributes (no flux below surface)
if (use_mrf_countergradient && (n == RhoTheta_comp || n == RhoQ1_comp)) {
const int gam_comp = (n == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
if (use_mrf_countergradient && (qty_index == RhoTheta_comp || qty_index == RhoQ1_comp)) {
const int gam_comp = (qty_index == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
const Real gam_hi = myhalf * (mu_turb(i, j, klo, gam_comp) + mu_turb(i, j, klo+1, gam_comp));
RHS_a(i,j,klo) -= Fact * rhoAlpha_hi * gam_hi;
}
Expand All @@ -144,11 +142,11 @@ ImplicitDiffForStateLU_N (const Box& bx,
b_tmp = cell_data(i,j,k,Rho_comp) - a_tmp - c_tmp;
inv_b2_tmp = one / (b_tmp - a_tmp * coeffG_a(i,j,k-1));

RHS_a(i,j,k) = cell_data(i,j,k,n); // NOTE: this is rho*phi; solution is phi
RHS_a(i,j,k) = cell_data(i,j,k,tmp_index); // NOTE: this is rho*phi; solution is phi

// Add countergradient correction to RHS in interior
if (use_mrf_countergradient && (n == RhoTheta_comp || n == RhoQ1_comp)) {
const int gam_comp = (n == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
if (use_mrf_countergradient && (qty_index == RhoTheta_comp || qty_index == RhoQ1_comp)) {
const int gam_comp = (qty_index == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
const Real gam_k = mu_turb(i, j, k, gam_comp);
const Real gam_km1 = mu_turb(i, j, k-1, gam_comp);
const Real gam_kp1 = mu_turb(i, j, k+1, gam_comp);
Expand All @@ -175,7 +173,7 @@ ImplicitDiffForStateLU_N (const Box& bx,
b_tmp = cell_data(i,j,khi,Rho_comp) - a_tmp - c_tmp;
inv_b2_tmp = one / (b_tmp - a_tmp * coeffG_a(i,j,khi-1));

RHS_a(i,j,khi) = cell_data(i,j,khi,n); // NOTE: this is rho*phi; solution is phi
RHS_a(i,j,khi) = cell_data(i,j,khi,tmp_index); // NOTE: this is rho*phi; solution is phi
if (neumann_on_zhi) {
RHS_a(i,j,khi) -= -Fact * rhoAlpha_hi * bc_neumann_vals[5]; // NOTE: N_val = d_z(\phi)
}
Expand All @@ -193,7 +191,7 @@ ImplicitDiffForStateLU_N (const Box& bx,
// Convert back to rho*theta
//===================================================
for (int k(klo); k<=khi; ++k) {
cell_data(i,j,k,n) = cell_data(i,j,k,Rho_comp) * soln_a(i,j,k);
cell_data(i,j,k,tmp_index) = cell_data(i,j,k,Rho_comp) * soln_a(i,j,k);
}

#ifdef AMREX_USE_GPU
Expand Down
24 changes: 11 additions & 13 deletions Source/Diffusion/ERF_ImplicitDiff_S.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ void
ImplicitDiffForStateLU_S (const Box& bx,
const Box& domain,
const int level,
const int n,
const double dt_d,
const int tmp_index,
const int qty_index,
const Real dt,
const GpuArray<Real, AMREX_SPACEDIM*2>& bc_neumann_vals,
const Array4< Real>& cell_data,
const Gpu::DeviceVector<Real>& stretched_dz_d,
Expand All @@ -45,11 +46,8 @@ ImplicitDiffForStateLU_S (const Box& bx,
{
BL_PROFILE_VAR("ImplicitDiffForState_S()",ImplicitDiffForState_S);

Real dt = static_cast<Real>(dt_d);

// setup quantities for getRhoAlpha()
#include "ERF_SetupVertDiff.H"
const int qty_index = n;
const int prim_index = qty_index - 1;
const int prim_scal_index = (qty_index >= RhoScalar_comp && qty_index < RhoScalar_comp+NSCALARS) ? PrimScalar_comp : prim_index;

Expand Down Expand Up @@ -117,16 +115,16 @@ ImplicitDiffForStateLU_S (const Box& bx,
b_tmp = cell_data(i,j,klo,Rho_comp) - a_tmp - c_tmp;
inv_b2_tmp = one;

RHS_a(i,j,klo) = cell_data(i,j,klo,n); // NOTE: this is rho*phi; solution is phi
RHS_a(i,j,klo) = cell_data(i,j,klo,tmp_index); // NOTE: this is rho*phi; solution is phi
if (use_SurfLayer && scalar_zflux) {
RHS_a(i,j,klo) += Fact * dz_inv * scalar_zflux(i,j,klo); // NOTE: scalar_zflux = -K*d_z(\phi)
} else if (neumann_on_zlo) {
RHS_a(i,j,klo) += -Fact * dz_inv * rhoAlpha_lo * bc_neumann_vals[2]; // NOTE: N_val = d_z(\phi)
}

// Add countergradient correction to RHS at bottom boundary
if (use_mrf_countergradient && (n == RhoTheta_comp || n == RhoQ1_comp)) {
const int gam_comp = (n == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
if (use_mrf_countergradient && (qty_index == RhoTheta_comp || qty_index == RhoQ1_comp)) {
const int gam_comp = (qty_index == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
const Real gam_hi = myhalf * (mu_turb(i, j, klo, gam_comp) + mu_turb(i, j, klo+1, gam_comp));
// rhoAlpha*gam is already a flux, so its divergence over cell klo
// is scaled by the *cell* spacing, not the face spacing
Expand All @@ -153,11 +151,11 @@ ImplicitDiffForStateLU_S (const Box& bx,
b_tmp = cell_data(i,j,k,Rho_comp) - a_tmp - c_tmp;
inv_b2_tmp = one / (b_tmp - a_tmp * coeffG_a(i,j,k-1));

RHS_a(i,j,k) = cell_data(i,j,k,n); // NOTE: this is rho*phi; solution is phi
RHS_a(i,j,k) = cell_data(i,j,k,tmp_index); // NOTE: this is rho*phi; solution is phi

// Add countergradient correction to RHS in interior
if (use_mrf_countergradient && (n == RhoTheta_comp || n == RhoQ1_comp)) {
const int gam_comp = (n == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
if (use_mrf_countergradient && (qty_index == RhoTheta_comp || qty_index == RhoQ1_comp)) {
const int gam_comp = (qty_index == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
const Real gam_k = mu_turb(i, j, k, gam_comp);
const Real gam_km1 = mu_turb(i, j, k-1, gam_comp);
const Real gam_kp1 = mu_turb(i, j, k+1, gam_comp);
Expand Down Expand Up @@ -193,7 +191,7 @@ ImplicitDiffForStateLU_S (const Box& bx,
b_tmp = cell_data(i,j,khi,Rho_comp) - a_tmp - c_tmp;
inv_b2_tmp = one / (b_tmp - a_tmp * coeffG_a(i,j,khi-1));

RHS_a(i,j,khi) = cell_data(i,j,khi,n); // NOTE: this is rho*phi; solution is phi
RHS_a(i,j,khi) = cell_data(i,j,khi,tmp_index); // NOTE: this is rho*phi; solution is phi
if (neumann_on_zhi) {
RHS_a(i,j,khi) -= -Fact * dz_inv * rhoAlpha_hi * bc_neumann_vals[5]; // NOTE: N_val = d_z(\phi)
}
Expand All @@ -211,7 +209,7 @@ ImplicitDiffForStateLU_S (const Box& bx,
// Convert back to rho*theta
//===================================================
for (int k(klo); k<=khi; ++k) {
cell_data(i,j,k,n) = cell_data(i,j,k,Rho_comp) * soln_a(i,j,k);
cell_data(i,j,k,tmp_index) = cell_data(i,j,k,Rho_comp) * soln_a(i,j,k);
}

#ifdef AMREX_USE_GPU
Expand Down
24 changes: 11 additions & 13 deletions Source/Diffusion/ERF_ImplicitDiff_T.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ void
ImplicitDiffForStateLU_T (const Box& bx,
const Box& domain,
const int level,
const int n,
const double dt_d,
const int tmp_index,
const int qty_index,
const Real dt,
const GpuArray<Real, AMREX_SPACEDIM*2>& bc_neumann_vals,
const Array4< Real>& cell_data,
const Array4<const Real>& z_nd,
Expand All @@ -49,11 +50,8 @@ ImplicitDiffForStateLU_T (const Box& bx,
{
BL_PROFILE_VAR("ImplicitDiffForState_T()",ImplicitDiffForState_T);

Real dt = static_cast<Real>(dt_d);

// setup quantities for getRhoAlpha()
#include "ERF_SetupVertDiff.H"
const int qty_index = n;
const int prim_index = qty_index - 1;
const int prim_scal_index = (qty_index >= RhoScalar_comp && qty_index < RhoScalar_comp+NSCALARS) ? PrimScalar_comp : prim_index;

Expand Down Expand Up @@ -123,16 +121,16 @@ ImplicitDiffForStateLU_T (const Box& bx,
b_tmp = detJ(i,j,klo) * cell_data(i,j,klo,Rho_comp) - a_tmp - c_tmp;
inv_b2_tmp = one;

RHS_a(i,j,klo) = detJ(i,j,klo) * cell_data(i,j,klo,n); // NOTE: this is rho*phi; solution is phi
RHS_a(i,j,klo) = detJ(i,j,klo) * cell_data(i,j,klo,tmp_index); // NOTE: this is rho*phi; solution is phi
if (use_SurfLayer && scalar_zflux) {
RHS_a(i,j,klo) += Fact * scalar_zflux(i,j,klo); // NOTE: scalar_zflux = -K*d_z(\phi)
} else if (neumann_on_zlo) {
RHS_a(i,j,klo) += -Fact * rhoAlpha_lo * bc_neumann_vals[2]; // NOTE: N_val = d_z(\phi)
}

// Add countergradient correction to RHS at bottom boundary
if (use_mrf_countergradient && (n == RhoTheta_comp || n == RhoQ1_comp)) {
const int gam_comp = (n == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
if (use_mrf_countergradient && (qty_index == RhoTheta_comp || qty_index == RhoQ1_comp)) {
const int gam_comp = (qty_index == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
const Real gam_hi = myhalf * (mu_turb(i, j, klo, gam_comp) + mu_turb(i, j, klo+1, gam_comp));
RHS_a(i,j,klo) -= Fact * rhoAlpha_hi * gam_hi;
}
Expand All @@ -156,11 +154,11 @@ ImplicitDiffForStateLU_T (const Box& bx,
b_tmp = detJ(i,j,k) * cell_data(i,j,k,Rho_comp) - a_tmp - c_tmp;
inv_b2_tmp = one / (b_tmp - a_tmp * coeffG_a(i,j,k-1));

RHS_a(i,j,k) = detJ(i,j,k) * cell_data(i,j,k,n); // NOTE: this is rho*phi; solution is phi
RHS_a(i,j,k) = detJ(i,j,k) * cell_data(i,j,k,tmp_index); // NOTE: this is rho*phi; solution is phi

// Add countergradient correction to RHS in interior
if (use_mrf_countergradient && (n == RhoTheta_comp || n == RhoQ1_comp)) {
const int gam_comp = (n == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
if (use_mrf_countergradient && (qty_index == RhoTheta_comp || qty_index == RhoQ1_comp)) {
const int gam_comp = (qty_index == RhoTheta_comp) ? EddyDiff::HGAMT_v : EddyDiff::HGAMQ_v;
const Real gam_k = mu_turb(i, j, k, gam_comp);
const Real gam_km1 = mu_turb(i, j, k-1, gam_comp);
const Real gam_kp1 = mu_turb(i, j, k+1, gam_comp);
Expand Down Expand Up @@ -190,7 +188,7 @@ ImplicitDiffForStateLU_T (const Box& bx,
b_tmp = detJ(i,j,khi) * cell_data(i,j,khi,Rho_comp) - a_tmp - c_tmp;
inv_b2_tmp = one / (b_tmp - a_tmp * coeffG_a(i,j,khi-1));

RHS_a(i,j,khi) = detJ(i,j,khi) * cell_data(i,j,khi,n); // NOTE: this is rho*phi; solution is phi
RHS_a(i,j,khi) = detJ(i,j,khi) * cell_data(i,j,khi,tmp_index); // NOTE: this is rho*phi; solution is phi
if (neumann_on_zhi) {
RHS_a(i,j,khi) -= -Fact * rhoAlpha_hi * bc_neumann_vals[5]; // NOTE: N_val = d_z(\phi)
}
Expand All @@ -208,7 +206,7 @@ ImplicitDiffForStateLU_T (const Box& bx,
// Convert back to rho*theta
//===================================================
for (int k(klo); k<=khi; ++k) {
cell_data(i,j,k,n) = cell_data(i,j,k,Rho_comp) * soln_a(i,j,k);
cell_data(i,j,k,tmp_index) = cell_data(i,j,k,Rho_comp) * soln_a(i,j,k);
}

#ifdef AMREX_USE_GPU
Expand Down
Loading
Loading