From b94ffe93f178d2e59e595d306acdee4a8d4e74dc Mon Sep 17 00:00:00 2001 From: sergio Date: Thu, 3 Mar 2022 09:16:19 -0800 Subject: [PATCH] ENH: Adding lower and upper bounds to nonUniformTable index --- .../nonUniformTableThermophysicalFunctionI.H | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunctionI.H b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunctionI.H index c529e1a5da..0e72c64060 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunctionI.H +++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunctionI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2020 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,15 +36,16 @@ inline Foam::label Foam::nonUniformTable::index scalar T ) const { - if (T < Trange_.min() || T > Trange_.max()) + scalar nd = 0; + if (T > Trange_.min() || T < Trange_.max()) { - FatalErrorInFunction - << "Temperature " << T << " out of range " << Trange_ << nl - << " for nonUniformTable " << name_ - << exit(FatalError); + nd = (T - Trange_.min())/deltaT_; + } + else if (T > Trange_.max()) + { + nd = (Trange_.max() - Trange_.min())/deltaT_; } - const scalar nd = (T - Trange_.min())/deltaT_; const label j = nd; label i = jumpTable_[j];