|
[Sponsors] |
How to limit min and max values in scalarCodedSource |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 18, 2021, 12:32 |
How to limit min and max values in scalarCodedSource
|
#1 |
Member
Jonathan Wells
Join Date: Oct 2020
Location: Indiana
Posts: 44
Rep Power: 6 |
Hello,
I am writing my own scalarCodedSource term, and I need to clamp the value of a calculated variable between a min and max value. I've seen in the tutorial here: http://https://develop.openfoam.com/...anopyTSource.C the use of the method scalarMinMax, but I cannot find that in the source code guide. Even if I could, I am unsure how to implement it into my code. Basically, I am wanting to do something like: Code:
const scalarField A = (B*C)/D; clamp(A, min, max); Code:
A = min(A, minValue) |
|
March 18, 2021, 18:25 |
|
#2 |
Senior Member
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 18 |
try:
A=max(min(A,maxval),minval). max clips the minimum value and min clips the maximum value |
|
March 19, 2021, 17:23 |
|
#3 | |
Member
Jonathan Wells
Join Date: Oct 2020
Location: Indiana
Posts: 44
Rep Power: 6 |
Quote:
Code:
fvOptions.energySource.scalarCodedSourceCoeffs(46): error: no instance of overloaded function "Foam::min" matches the argument list argument types are: (Foam::scalarField, int) mach = max(min(mach,1),0.1); |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
y+ and u+ values with low-Re RANS turbulence models: utility + testcase | florian_krause | OpenFOAM | 114 | August 23, 2023 05:37 |
Converging Diverging Nozzle with dbnsTurbFoam | Saleh Abuhanieh | OpenFOAM Running, Solving & CFD | 4 | December 13, 2019 10:26 |
Near wall treatment in k-omega SST | Arnoldinho | OpenFOAM Running, Solving & CFD | 38 | March 8, 2017 13:48 |
Problem of simulating of small droplet with radius of 2mm | liguifan | OpenFOAM Running, Solving & CFD | 5 | June 3, 2014 02:53 |
On the damBreak4phaseFine cases | paean | OpenFOAM Running, Solving & CFD | 0 | November 14, 2008 21:14 |