Skip to content

Commit

Permalink
Replaced only_spatial statements with fstate checks for dt_arg
Browse files Browse the repository at this point in the history
  • Loading branch information
itopcuoglu committed Sep 2, 2024
1 parent 21b6fb6 commit 1932905
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion amr-wind/equation_systems/AdvOp_Godunov.H
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ struct AdvectionOp<
(godunov_scheme == godunov::scheme::WENO_JS)) {
m_allow_inflow_on_outflow = true;
}
amrex::Real dt_arg = (only_spatial) ? 0.0 : dt;
// if state is NPH, then n and n+1 are known, and only
// spatial extrapolation is performed
amrex::Real dt_arg = (fstate == FieldState::NPH) ? 0.0 : dt;

HydroUtils::ComputeFluxesOnBoxFromState(
bx, PDE::ndim, mfi,
Expand Down
12 changes: 9 additions & 3 deletions amr-wind/equation_systems/icns/icns_advection.H
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,14 @@ struct AdvectionOp<ICNS, fvm::Godunov>
m_allow_inflow_on_outflow = true;
}

// if state is NPH, then n and n+1 are known, and only
// spatial extrapolation is performed
amrex::Real dt_arg = (fstate == FieldState::NPH) ? 0.0 : dt;
for (int lev = 0; lev < repo.num_active_levels(); ++lev) {
HydroUtils::ExtrapVelToFaces(
dof_field(lev), src_term(lev), u_mac(lev), v_mac(lev),
w_mac(lev), dof_field.bcrec(), bcrec_device.data(),
repo.mesh().Geom(lev), dt, godunov_use_ppm,
repo.mesh().Geom(lev), dt_arg, godunov_use_ppm,
godunov_use_forces_in_trans, premac_advection_type,
limiter_type, m_allow_inflow_on_outflow);
}
Expand Down Expand Up @@ -240,7 +243,6 @@ struct AdvectionOp<ICNS, fvm::Godunov>
// cppcheck-suppress constVariableReference
auto& conv_term = fields.conv_term;
const auto& dof_field = fields.field.state(fstate);
bool only_spatial = (fstate == FieldState::NPH);

auto flux_x =
repo.create_scratch_field(ICNS::ndim, 0, amr_wind::FieldLoc::XFACE);
Expand Down Expand Up @@ -333,6 +335,10 @@ struct AdvectionOp<ICNS, fvm::Godunov>
#ifdef AMREX_USE_OMP
#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
#endif

// if state is NPH, then n and n+1 are known, and only
// spatial extrapolation is performed
amrex::Real dt_arg = (fstate == FieldState::NPH) ? 0.0 : dt;
for (amrex::MFIter mfi(dof_field(lev), mfi_info); mfi.isValid();
++mfi) {
const auto& bx = mfi.tilebox();
Expand All @@ -347,7 +353,7 @@ struct AdvectionOp<ICNS, fvm::Godunov>
known_edge_state, u_mac(lev).const_array(mfi),
v_mac(lev).const_array(mfi),
w_mac(lev).const_array(mfi), divu, fq.const_array(mfi),
geom[lev], dt, dof_field.bcrec(),
geom[lev], dt_arg, dof_field.bcrec(),
dof_field.bcrec_device().data(), iconserv.data(),
godunov_use_ppm, godunov_use_forces_in_trans,
is_velocity, fluxes_are_area_weighted,
Expand Down
3 changes: 0 additions & 3 deletions amr-wind/incflo_advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,6 @@ void incflo::ApplyPredictorNonLinear(bool incremental_projection)
}

// Extrapolate and apply MAC projection for advection velocities
// icns().nonlinear_advection_actions(amr_wind::FieldState::Old);
// icns().nonlinear_advection_actions(amr_wind::FieldState::NPH);
//icns().nonlinear_advection_actions(amr_wind::FieldState::New);
icns().pre_advection_actions(amr_wind::FieldState::NPH);

// For scalars only first
Expand Down

0 comments on commit 1932905

Please sign in to comment.