mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: use GeometricField clamp_min, clamp_max, clamp_range
- newer naming allows for less confusing code.
Eg,
max(lower) -> clamp_min(lower)
min(upper) -> clamp_max(upper)
- prefer combined method, for few operations.
Eg,
max(lower) + min(upper) -> clamp_range(lower, upper)
The updated naming also helps avoid some obvious coding errors.
Eg,
Re.min(1200.0);
Re.max(18800.0);
instead of
Re.clamp_range(1200.0, 18800.0);
- can also use implicit conversion of zero_one to MinMax<Type> for
this type of code:
lambda_.clamp_range(zero_one{});
This commit is contained in:
@ -48,7 +48,7 @@ if (Y.size())
|
||||
|
||||
fvOptions.correct(Yi);
|
||||
|
||||
Yi.max(0.0);
|
||||
Yi.clamp_min(0);
|
||||
Yt += Yi;
|
||||
}
|
||||
}
|
||||
@ -56,6 +56,6 @@ if (Y.size())
|
||||
if (Y.size())
|
||||
{
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
Y[inertIndex].clamp_min(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user