Skip to content

Commit

Permalink
Correcting CUDA compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahesh Natarajan committed Nov 29, 2023
1 parent c07e3f8 commit 7efb72c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Exec/SquallLine_2D/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ Problem::init_custom_pert (
Real Rd_by_Cp = sc.rdOcp;
Rd_by_Cp = Rd_by_Cp;

amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
auto lparms = parms;

amrex::ParallelFor(bx, [=, lparms=lparms] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
{
// Geometry (note we must include these here to get the data on device)
const auto prob_lo = geomdata.ProbLo();
Expand All @@ -358,15 +360,15 @@ Problem::init_custom_pert (
theta_total = t[k] + delta_theta;
temperature = compute_temperature(p[k], theta_total);
Real T_b = compute_temperature(p[k], t[k]);
RH = compute_relative_humidity(z, parms.height, parms.z_tr, p[k], T_b);
Real q_v_hot = vapor_mixing_ratio(z, parms.height, p[k], T_b, RH);
RH = compute_relative_humidity(z, lparms.height, lparms.z_tr, p[k], T_b);
Real q_v_hot = vapor_mixing_ratio(z, lparms.height, p[k], T_b, RH);
rho = p[k]/(R_d*temperature*(1.0 + (R_v/R_d)*q_v_hot));

// Compute background quantities
Real temperature_back = compute_temperature(p[k], t[k]);
Real T_back = compute_temperature(p[k], t[k]);
Real RH_back = compute_relative_humidity(z, parms.height, parms.z_tr, p[k], T_back);
Real q_v_back = vapor_mixing_ratio(z, parms.height, p[k], T_back, RH_back);
Real RH_back = compute_relative_humidity(z, lparms.height, lparms.z_tr, p[k], T_back);
Real q_v_back = vapor_mixing_ratio(z, lparms.height, p[k], T_back, RH_back);
Real rho_back = p[k]/(R_d*temperature_back*(1.0 + (R_v/R_d)*q_v_back));

// This version perturbs rho but not p
Expand Down

0 comments on commit 7efb72c

Please sign in to comment.