ENH: Adding lower and upper bounds to nonUniformTable index

This commit is contained in:
sergio
2022-03-03 09:16:19 -08:00
parent 3c2db201b7
commit b94ffe93f1

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenFOAM Foundation Copyright (C) 2020 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,15 +36,16 @@ inline Foam::label Foam::nonUniformTable::index
scalar T scalar T
) const ) const
{ {
if (T < Trange_.min() || T > Trange_.max()) scalar nd = 0;
if (T > Trange_.min() || T < Trange_.max())
{ {
FatalErrorInFunction nd = (T - Trange_.min())/deltaT_;
<< "Temperature " << T << " out of range " << Trange_ << nl }
<< " for nonUniformTable " << name_ else if (T > Trange_.max())
<< exit(FatalError); {
nd = (Trange_.max() - Trange_.min())/deltaT_;
} }
const scalar nd = (T - Trange_.min())/deltaT_;
const label j = nd; const label j = nd;
label i = jumpTable_[j]; label i = jumpTable_[j];