From a1a96cb4ef7a8ea812003490565bf46ff60eb6f1 Mon Sep 17 00:00:00 2001 From: cgilet Date: Wed, 11 Sep 2024 15:05:29 +0200 Subject: [PATCH] Fix case of multiple tracers with default initial conditions. Issue introduced in PR#131 --- src/setup/init.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/setup/init.cpp b/src/setup/init.cpp index 33a62b0d..2a785bef 100644 --- a/src/setup/init.cpp +++ b/src/setup/init.cpp @@ -123,13 +123,23 @@ void incflo::ReadParameters () amrex::Abort("We currently require cfl <= 1.0 when using this advection scheme"); } + pp.query("ntrac", m_ntrac); + + if (m_ntrac <= 0) m_advect_tracer = false; + + if (m_ntrac < 1) { + amrex::Abort("We currently require at least one tracer"); + } + // Initial conditions pp.query("probtype", m_probtype); pp.query("ic_u", m_ic_u); pp.query("ic_v", m_ic_v); pp.query("ic_w", m_ic_w); pp.query("ic_p", m_ic_p); - pp.queryarr("ic_t", m_ic_t); + if ( !pp.queryarr("ic_t", m_ic_t, 0, m_ntrac) ) { + m_ic_t.resize(m_ntrac, 0.); + } // Viscosity (if constant) pp.query("mu", m_mu); @@ -138,14 +148,6 @@ void incflo::ReadParameters () pp.query("ro_0", m_ro_0); AMREX_ALWAYS_ASSERT(m_ro_0 >= 0.0); - pp.query("ntrac", m_ntrac); - - if (m_ntrac <= 0) m_advect_tracer = false; - - if (m_ntrac < 1) { - amrex::Abort("We currently require at least one tracer"); - } - // Scalar diffusion coefficients m_mu_s.resize(m_ntrac, 0.0); pp.queryarr("mu_s", m_mu_s, 0, m_ntrac );