From d4de2ae2076fed1ec726defb2dba1c39afc480fd Mon Sep 17 00:00:00 2001 From: Ilker Topcuoglu Date: Wed, 9 Oct 2024 15:32:53 -0600 Subject: [PATCH] Conditional operator for fstate --- amr-wind/equation_systems/icns/icns.H | 3 ++- amr-wind/incflo_advance.cpp | 21 ++++++++++++--------- amr-wind/utilities/console_io.cpp | 2 -- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/amr-wind/equation_systems/icns/icns.H b/amr-wind/equation_systems/icns/icns.H index 703cdbf5c4..564c222fa4 100644 --- a/amr-wind/equation_systems/icns/icns.H +++ b/amr-wind/equation_systems/icns/icns.H @@ -43,7 +43,8 @@ struct ICNS : VectorTransport static constexpr bool has_diffusion = true; // No n+1/2 state for velocity for now - static constexpr bool need_nph_state = true; + // static constexpr bool need_nph_state = true; + static constexpr bool need_nph_state = false; }; } // namespace amr_wind::pde diff --git a/amr-wind/incflo_advance.cpp b/amr-wind/incflo_advance.cpp index d87bd7d841..7bb05f75fc 100644 --- a/amr-wind/incflo_advance.cpp +++ b/amr-wind/incflo_advance.cpp @@ -354,15 +354,18 @@ void incflo::ApplyPredictor(bool incremental_projection, int inonlin) } // With scalars computed, compute advection of momentum - if (inonlin == 0) { - icns().compute_advection_term(amr_wind::FieldState::Old); - } else { - icns().compute_advection_term(amr_wind::FieldState::NPH); - } - - // ************************************************************************************* - // Define (or if use_godunov, re-define) the forcing terms and viscous terms - // independently for the right hand side, without 1/rho term + // if (inonlin == 0) { + // icns().compute_advection_term(amr_wind::FieldState::Old); + //} else { + // icns().compute_advection_term(amr_wind::FieldState::NPH); + //} + const auto fstate = + (inonlin == 0) ? amr_wind::FieldState::Old : amr_wind::FieldState::NPH; + icns().compute_advection_term(fstate); + + // ************************************************************************************* + // Define (or if use_godunov, re-define) the forcing terms and viscous + // terms independently for the right hand side, without 1/rho term // ************************************************************************************* icns().compute_source_term(amr_wind::FieldState::NPH); icns().compute_diffusion_term(amr_wind::FieldState::Old); diff --git a/amr-wind/utilities/console_io.cpp b/amr-wind/utilities/console_io.cpp index e33653016a..0f37287794 100644 --- a/amr-wind/utilities/console_io.cpp +++ b/amr-wind/utilities/console_io.cpp @@ -224,8 +224,6 @@ void print_nonlinear_residual( const auto& velocity_new = sim.pde_manager().icns().fields().field; const auto& oset_mask = sim.repo().get_int_field("mask_cell"); - const int ncomp = AMREX_SPACEDIM; - for (int lev = 0; lev < nlevels; ++lev) { amrex::iMultiFab level_mask;