diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.C b/src/OpenFOAM/dimensionSet/dimensionSet.C index 584889e3c1..4dddfb7a69 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSet.C +++ b/src/OpenFOAM/dimensionSet/dimensionSet.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2021 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -518,6 +518,21 @@ Foam::dimensionSet Foam::hypot(const dimensionSet& ds1, const dimensionSet& ds2) } +Foam::dimensionSet Foam::stabilise +( + const dimensionSet& ds1, + const dimensionSet& ds2 +) +{ + if (dimensionSet::checking()) + { + checkDims("stabilise(a, b)", ds1, ds2); + } + + return ds1; +} + + Foam::dimensionSet Foam::transform(const dimensionSet& ds) { return ds; diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.H b/src/OpenFOAM/dimensionSet/dimensionSet.H index 10d91eef57..d64d343668 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSet.H +++ b/src/OpenFOAM/dimensionSet/dimensionSet.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2021 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -397,6 +397,9 @@ dimensionSet atan2(const dimensionSet& ds1, const dimensionSet& ds2); //- Arguments need the same dimensions. Does not change the dimension. dimensionSet hypot(const dimensionSet& ds1, const dimensionSet& ds2); +//- Arguments need the same dimensions. Does not change the dimension. +dimensionSet stabilise(const dimensionSet& ds1, const dimensionSet& ds2); + //- Return the argument; transformations do not change the dimensions dimensionSet transform(const dimensionSet& ds); diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C b/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C index b592d6aea1..2dbe387c51 100644 --- a/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C +++ b/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -338,6 +338,21 @@ dimensionedScalar hypot } +dimensionedScalar stabilise +( + const dimensionedScalar& x, + const dimensionedScalar& y +) +{ + return dimensionedScalar + ( + "stabilise(" + x.name() + ',' + y.name() + ')', + stabilise(x.dimensions(), y.dimensions()), + stabilise(x.value(), y.value()) + ); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.H b/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.H index 94b7648796..820374df8e 100644 --- a/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.H +++ b/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -102,6 +102,7 @@ dimensionedScalar jn(const int, const dimensionedScalar&); dimensionedScalar y0(const dimensionedScalar&); dimensionedScalar y1(const dimensionedScalar&); dimensionedScalar yn(const int, const dimensionedScalar&); +dimensionedScalar stabilise(const dimensionedScalar&, const dimensionedScalar&); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //