diff --git a/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.C b/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.C
new file mode 100644
index 0000000000..8578cec6b7
--- /dev/null
+++ b/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.C
@@ -0,0 +1,87 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2020 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "LimitRange.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+template
+void Foam::Function1Types::LimitRange::read(const dictionary& coeffs)
+{
+ min_ = coeffs.get("min");
+ max_ = coeffs.get("max");
+ value_ = Function1::New("value", coeffs);
+}
+
+
+template
+Foam::Function1Types::LimitRange::LimitRange
+(
+ const word& entryName,
+ const dictionary& dict
+)
+:
+ Function1(entryName)
+{
+ read(dict);
+}
+
+
+template
+Foam::Function1Types::LimitRange::LimitRange(const LimitRange& rhs)
+:
+ Function1(rhs),
+ min_(rhs.min_),
+ max_(rhs.max_),
+ value_(rhs.value_.clone())
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+template
+void Foam::Function1Types::LimitRange::writeEntries(Ostream& os) const
+{
+ os.writeEntry("min", min_);
+ os.writeEntry("max", max_);
+ value_->writeData(os);
+}
+
+
+template
+void Foam::Function1Types::LimitRange::writeData(Ostream& os) const
+{
+ Function1::writeData(os);
+ os << token::END_STATEMENT << nl;
+
+ os.beginBlock(word(this->name() + "Coeffs"));
+ writeEntries(os);
+ os.endBlock();
+}
+
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.H b/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.H
new file mode 100644
index 0000000000..b580f90d10
--- /dev/null
+++ b/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.H
@@ -0,0 +1,179 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2020 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::Function1Types::LimitRange
+
+Description
+ Function1 wrapper that limits the input range of another Function1
+
+ Example usage for limiting a polynomial:
+ \verbatim
+ limitedPolyTest limitRange;
+ limitedPolyTestCoeffs
+ {
+ min 0.4;
+ max 1.4;
+
+ value polynomial
+ (
+ (5 1)
+ (-2 2)
+ (-2 3)
+ (1 4)
+ );
+ }
+ \endverbatim
+
+ Here the return value will be:
+ - poly(0.4) for x <= 0.4;
+ - poly(1.4) for x >= 1.4; and
+ - poly(x) for 0.4 < x < 1.4.
+
+
+ Example usage for limiting a table
+ \verbatim
+ limitedTableFileTest limitRange;
+ limitedTableFileTestCoeffs
+ {
+ min 0.4;
+ max 1.4;
+
+ value tableFile;
+ file "/fanCurve.txt";
+ }
+ \endverbatim
+
+ Where:
+ \table
+ Property | Description | Required
+ min | Minimum input value | yes
+ max | Maximum input value | yes
+ value | Function of type Function1 | yes
+ \endtable
+
+SourceFiles
+ LimitRange.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef LimitRange_H
+#define LimitRange_H
+
+#include "Function1.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace Function1Types
+{
+
+/*---------------------------------------------------------------------------*\
+ Class LimitRange Declaration
+\*---------------------------------------------------------------------------*/
+
+template
+class LimitRange
+:
+ public Function1
+{
+ // Private Data
+
+ //- Minimum input value
+ scalar min_;
+
+ //- Maximum input value
+ scalar max_;
+
+ //- Value function
+ autoPtr> value_;
+
+
+ // Private Member Functions
+
+ //- Read the coefficients from the given dictionary
+ void read(const dictionary& coeffs);
+
+
+public:
+
+ //- Runtime type information
+ TypeName("limitRange");
+
+
+ // Generated Methods
+
+ //- No copy assignment
+ void operator=(const LimitRange&) = delete;
+
+
+ // Constructors
+
+ //- Construct from entry name and dictionary
+ LimitRange(const word& entryName, const dictionary& dict);
+
+ //- Copy construct
+ explicit LimitRange(const LimitRange& rhs);
+
+
+ //- Destructor
+ virtual ~LimitRange() = default;
+
+
+ // Member Functions
+
+ //- Return value for time t
+ virtual inline Type value(const scalar t) const;
+
+ //- Integrate between two (scalar) values
+ virtual inline Type integrate(const scalar x1, const scalar x2) const;
+
+ //- Write in dictionary format
+ virtual void writeData(Ostream& os) const;
+
+ //- Write coefficient entries in dictionary format
+ void writeEntries(Ostream& os) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Function1Types
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "LimitRangeI.H"
+
+#ifdef NoRepository
+ #include "LimitRange.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRangeI.H b/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRangeI.H
new file mode 100644
index 0000000000..640a02c388
--- /dev/null
+++ b/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRangeI.H
@@ -0,0 +1,67 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2020 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "LimitRange.H"
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+template
+inline Type Foam::Function1Types::LimitRange::value(const scalar t) const
+{
+ scalar tlim = min(max(t, min_), max_);
+
+ return value_->value(tlim);
+}
+
+
+template
+Type Foam::Function1Types::LimitRange::integrate
+(
+ const scalar x1,
+ const scalar x2
+) const
+{
+ scalar xlim0 = min(max(x1, min_), max_);
+ scalar xlim1 = min(max(x2, min_), max_);
+
+ Type intValue = value_->integrate(xlim0, xlim1);
+
+ if (x1 < min_)
+ {
+ intValue += (min(min_, x2) - x1)*this->value(min_);
+ }
+
+ if (x2 > max_)
+ {
+ intValue += (x2 - max(max_, x1))*this->value(max_);
+ }
+
+ return intValue;
+}
+
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C b/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C
index ee4681df2b..3ecf9c0e12 100644
--- a/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C
+++ b/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C
@@ -38,7 +38,7 @@ License
#include "Table.H"
#include "TableFile.H"
#include "Scale.H"
-
+#include "LimitRange.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -56,7 +56,8 @@ License
makeFunction1Type(CSV, Type); \
makeFunction1Type(Table, Type); \
makeFunction1Type(TableFile, Type); \
- makeFunction1Type(Scale, Type);
+ makeFunction1Type(Scale, Type); \
+ makeFunction1Type(LimitRange, Type);
namespace Foam
{