Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 8 additions & 8 deletions Source/BC.H
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ struct BCFill
amrex::GpuArray<amrex::Real, 6> flux_of_heat_flux = {
rxx_eq, ryy_eq, rzz_eq, rxy_eq, rxz_eq, ryz_eq};

set_extended_grad_expansion_generic(
data(iv, q) = set_extended_grad_expansion_generic(
two_rho_e, heat_flux, flux_of_heat_flux, m_mesh_speed, m_weights[q],
ev, m_theta0, m_zero_vec, 1.0, data(iv, q));
ev, m_theta0, m_zero_vec, 1.0);
}

AMREX_GPU_DEVICE
Expand Down Expand Up @@ -236,8 +236,8 @@ struct BCFill
const amrex::Real rho_bc =
(rho_out + rho_tan) / (1.0 - ndir * vel_bc[idir]);

set_equilibrium_value(
rho_bc, vel_bc, RT, m_mesh_speed, m_weights[q], ev, data(iv, q));
data(iv, q) = set_equilibrium_value(
rho_bc, vel_bc, RT, m_mesh_speed, m_weights[q], ev);

rho_bc_out = rho_bc;
}
Expand Down Expand Up @@ -287,8 +287,8 @@ struct BCFill
amrex::RealVect vel_bc(AMREX_D_DECL(0.0, 0.0, 0.0));
vel_bc[idir] = ndir * (1.0 - (rho_out + rho_tan) / rho_bc);

set_equilibrium_value(
rho_bc, vel_bc, RT, m_mesh_speed, m_weights[q], ev, data(iv, q));
data(iv, q) = set_equilibrium_value(
rho_bc, vel_bc, RT, m_mesh_speed, m_weights[q], ev);

rho_bc_out = rho_out + rho_tan;
}
Expand Down Expand Up @@ -340,9 +340,9 @@ struct BCFill
amrex::GpuArray<amrex::Real, 6> flux_of_heat_flux = {
rxx_eq, ryy_eq, rzz_eq, rxy_eq, rxz_eq, ryz_eq};

set_extended_grad_expansion_generic(
data(iv, q) = set_extended_grad_expansion_generic(
two_rho_e, heat_flux, flux_of_heat_flux, m_mesh_speed, m_weights[q],
ev, m_theta0, m_zero_vec, 1.0, data(iv, q));
ev, m_theta0, m_zero_vec, 1.0);
}

AMREX_GPU_DEVICE
Expand Down
61 changes: 30 additions & 31 deletions Source/IC.H
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct Constant
vel = velocity;
}

AMREX_GPU_DEVICE void thermal_initialise(
AMREX_GPU_DEVICE void thermal_initialize(
const amrex::IntVect& /*iv*/,
amrex::GeometryData const& /*geom*/,
amrex::Real& rho,
Expand Down Expand Up @@ -117,7 +117,7 @@ struct TaylorGreen
}

AMREX_GPU_DEVICE
void thermal_initialise(
void thermal_initialize(
const amrex::IntVect& iv,
amrex::GeometryData const& geom,
amrex::Real& rho,
Expand Down Expand Up @@ -201,13 +201,12 @@ struct ViscosityTest

vel[0] = velocity[0] + a0 * std::sin(2.0 * M_PI * y / wave_length);
vel[1] = velocity[1];
if (AMREX_SPACEDIM == 3) {
vel[2] = velocity[2];
}
#if AMREX_SPACEDIM == 3
vel[2] = velocity[2];
#endif
}

AMREX_GPU_DEVICE
void thermal_initialise(
AMREX_GPU_DEVICE void thermal_initialize(
const amrex::IntVect& iv,
amrex::GeometryData const& geom,
amrex::Real& rho,
Expand All @@ -228,9 +227,9 @@ struct ViscosityTest

vel[0] = velocity[0] + a0 * std::sin(2.0 * M_PI * y / wave_length);
vel[1] = velocity[1];
if (AMREX_SPACEDIM == 3) {
vel[2] = velocity[2];
}
#if AMREX_SPACEDIM == 3
vel[2] = velocity[2];
#endif

temperature = initial_temperature;
R = R_u / m_bar;
Expand Down Expand Up @@ -285,13 +284,13 @@ struct ThermalDiffusivityTest

vel[0] = velocity[0];
vel[1] = velocity[1];
if (AMREX_SPACEDIM == 3) {
vel[2] = velocity[2];
}
#if AMREX_SPACEDIM == 3
vel[2] = velocity[2];
#endif
}

AMREX_GPU_DEVICE
void thermal_initialise(
void thermal_initialize(
const amrex::IntVect& iv,
amrex::GeometryData const& geom,
amrex::Real& rho,
Expand All @@ -314,9 +313,9 @@ struct ThermalDiffusivityTest

vel[0] = velocity[0];
vel[1] = velocity[1];
if (AMREX_SPACEDIM == 3) {
vel[2] = velocity[2];
}
#if AMREX_SPACEDIM == 3
vel[2] = velocity[2];
#endif

gamma = adiabatic_exponent;

Expand Down Expand Up @@ -370,17 +369,16 @@ struct SodTest

vel[0] = velocity[0];
vel[1] = velocity[1];
if (AMREX_SPACEDIM == 3) {
vel[2] = velocity[2];
}

#if AMREX_SPACEDIM == 3
vel[2] = velocity[2];
#endif
rho = density + 0.5 *
(1.0 + std::tanh((x - x_discontinuity) * 3.0)) *
(density_ratio * density - density);
}

AMREX_GPU_DEVICE
void thermal_initialise(
void thermal_initialize(
const amrex::IntVect& iv,
amrex::GeometryData const& geom,
amrex::Real& rho,
Expand All @@ -399,9 +397,9 @@ struct SodTest

vel[0] = velocity[0];
vel[1] = velocity[1];
if (AMREX_SPACEDIM == 3) {
vel[2] = velocity[2];
}
#if AMREX_SPACEDIM == 3
vel[2] = velocity[2];
#endif

gamma = adiabatic_exponent;

Expand Down Expand Up @@ -488,13 +486,13 @@ public:
ic.R_u / constants::AIR_MOLAR_MASS;
amrex::Real gamma = 1.667;

ic.thermal_initialise(
ic.thermal_initialize(
iv, geom, rho, vel, temperature, specific_gas_constant,
gamma);

set_equilibrium_value(
f_arrs[nbx](i, j, k, q) = set_equilibrium_value(
rho, vel, specific_gas_constant * temperature,
l_mesh_speed, wt, ev, f_arrs[nbx](i, j, k, q));
l_mesh_speed, wt, ev);

amrex::Real cv = specific_gas_constant / (gamma - 1.0);

Expand All @@ -514,9 +512,10 @@ public:
amrex::GpuArray<amrex::Real, 6> flux_of_heat_flux = {
rxx_eq, ryy_eq, rzz_eq, rxy_eq, rxz_eq, ryz_eq};

set_extended_grad_expansion_generic(
two_rho_e, heat_flux, flux_of_heat_flux, l_mesh_speed,
wt, ev, theta0, zero_vec, 1.0, g_arrs[nbx](i, j, k, q));
g_arrs[nbx](i, j, k, q) =
set_extended_grad_expansion_generic(
two_rho_e, heat_flux, flux_of_heat_flux,
l_mesh_speed, wt, ev, theta0, zero_vec, 1.0);
});
} else {
amrex::Abort("Invalid model_type");
Expand Down
71 changes: 29 additions & 42 deletions Source/LBM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,34 +669,32 @@ void LBM::macrodata_to_equilibrium(const int lev)

const auto& ev = evs[q];

amrex::Real temperature =
const amrex::Real temperature =
md_arr(iv, constants::TEMPERATURE_IDX);

amrex::Real omega =
const amrex::Real omega =
1.0 /
(nu / (specific_gas_constant * temperature * dt) + 0.5);
amrex::Real omega_one =
const amrex::Real omega_one =
1.0 /
(alpha / (specific_gas_constant * temperature * dt) + 0.5);
amrex::Real omega_one_by_omega = omega_one / omega;
amrex::Real omega_corr = (2.0 - omega) / (2.0 * omega * rho);
const amrex::Real omega_one_by_omega = omega_one / omega;
const amrex::Real omega_corr =
(2.0 - omega) / (2.0 * omega * rho);

amrex::Real pxx_ext =
const amrex::Real pxx_ext =
vel[0] * vel[0] + specific_gas_constant * temperature +
dt * (omega_corr)*d_arr(iv, constants::D_Q_CORR_X_IDX);
amrex::Real pyy_ext =
const amrex::Real pyy_ext =
vel[1] * vel[1] + specific_gas_constant * temperature +
dt * (omega_corr)*d_arr(iv, constants::D_Q_CORR_Y_IDX);
amrex::Real pzz_ext(0.0);
if (AMREX_SPACEDIM == 3) {
pzz_ext =
vel[2] * vel[2] + specific_gas_constant * temperature +
dt * (omega_corr)*d_arr(iv, constants::D_Q_CORR_Z_IDX);
}
const amrex::Real pzz_ext = AMREX_D_PICK(
0.0, 0.0,
vel[2] * vel[2] + specific_gas_constant * temperature +
dt * (omega_corr)*d_arr(iv, constants::D_Q_CORR_Z_IDX));

set_extended_equilibrium_value(
rho, vel, pxx_ext, pyy_ext, pzz_ext, l_mesh_speed, wt, ev,
eq_arr(iv, q));
eq_arr(iv, q) = set_extended_equilibrium_value(
rho, vel, pxx_ext, pyy_ext, pzz_ext, l_mesh_speed, wt, ev);

amrex::Real AMREX_D_DECL(qx_eq = 0.0, qy_eq = 0.0, qz_eq = 0.0);
amrex::Real rxx_eq(0.0), ryy_eq(0.0), rzz_eq(0.0), rxy_eq(0.0),
Expand Down Expand Up @@ -755,9 +753,9 @@ void LBM::macrodata_to_equilibrium(const int lev)
amrex::GpuArray<amrex::Real, 6> flux_of_heat_flux = {
rxx_eq, ryy_eq, rzz_eq, rxy_eq, rxz_eq, ryz_eq};

set_extended_grad_expansion_generic(
eq_arr_g(iv, q) = set_extended_grad_expansion_generic(
two_rho_e, heat_flux_mrt, flux_of_heat_flux, l_mesh_speed,
wt, ev, theta0, zero_vec, 1.0, eq_arr_g(iv, q));
wt, ev, theta0, zero_vec, 1.0);
}
});
amrex::Gpu::synchronize();
Expand Down Expand Up @@ -849,16 +847,12 @@ void LBM::f_to_macrodata(const int lev)

pxx += ev[0] * ev[0] * f_arr(iv, q);
pyy += ev[1] * ev[1] * f_arr(iv, q);
if (AMREX_SPACEDIM == 3) {
pzz += ev[2] * ev[2] * f_arr(iv, q);
}
pxy += ev[0] * ev[1] * f_arr(iv, q);
if (AMREX_SPACEDIM == 3) {
pxz += ev[0] * ev[2] * f_arr(iv, q);
}
if (AMREX_SPACEDIM == 3) {
pyz += ev[1] * ev[2] * f_arr(iv, q);
}
#if AMREX_SPACEDIM == 3
pzz += ev[2] * ev[2] * f_arr(iv, q);
pxz += ev[0] * ev[2] * f_arr(iv, q);
pyz += ev[1] * ev[2] * f_arr(iv, q);
#endif

two_rho_e += g_arr(iv, q);

Expand Down Expand Up @@ -982,22 +976,15 @@ void LBM::compute_q_corrections(const int lev)
const amrex::IntVect iv(AMREX_D_DECL(i, j, k));

if (if_arr(iv, 0) == 1) {
const amrex::Real d_qxxx = gradient(
d_arr(iv, constants::D_Q_CORR_X_IDX) = gradient(
0, constants::Q_CORR_X_IDX, iv, idx, dbox, if_arr, md_arr);
const amrex::Real d_qyyy = gradient(
d_arr(iv, constants::D_Q_CORR_Y_IDX) = gradient(
1, constants::Q_CORR_Y_IDX, iv, idx, dbox, if_arr, md_arr);

amrex::Real d_qzzz = 0.0;

if (AMREX_SPACEDIM == 3) {
d_qzzz = gradient(
2, constants::Q_CORR_Z_IDX, iv, idx, dbox, if_arr,
md_arr);
}

d_arr(iv, constants::D_Q_CORR_X_IDX) = d_qxxx;
d_arr(iv, constants::D_Q_CORR_Y_IDX) = d_qyyy;
d_arr(iv, constants::D_Q_CORR_Z_IDX) = d_qzzz;
#if AMREX_SPACEDIM == 3
d_arr(iv, constants::D_Q_CORR_Z_IDX) = gradient(
2, constants::Q_CORR_Z_IDX, iv, idx, dbox, if_arr, md_arr);
#endif
}
});
amrex::Gpu::synchronize();
Expand Down Expand Up @@ -1302,8 +1289,8 @@ void LBM::fill_f_inside_eb(const int lev)
[=] AMREX_GPU_DEVICE(int nbx, int i, int j, int k, int q) noexcept {
if (is_fluid_arrs[nbx](i, j, k, 0) == 0) {

set_population_zero(f_arrs[nbx](i, j, k, q));
set_population_zero(g_arrs[nbx](i, j, k, q));
f_arrs[nbx](i, j, k, q) = 0.0;
g_arrs[nbx](i, j, k, q) = 0.0;
}
});

Expand Down
Loading