CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   How to limit a variable (https://www.cfd-online.com/Forums/openfoam-solving/58773-how-limit-variable.html)

 ash June 26, 2008 10:43

Hi, i wanted to know how to li

Hi, i wanted to know how to limit a variable between the limits...

I know that my solution for the differential equation, which i am going to solve is piece wise continuous... or rather i am interested in the variable within the specifed limit....

Lets take for example... Temperature -> is my variable to be limited.... I am interested in solution within some temperature range, say from 300K to 2000K... So what i wanted to do is this.. If my differential equation predicts a temperature above 2000K, i want to limit that to 2000K and if the temperature goes below 300K, i want to limit that to 300K...

So, lets say that, i have incorporated this temperature variable in my differential equation and solved. Moreover I write this variable for each time step.... But before this variable is being used, i want to limit tha values of this variable...

Someone please give me C++ snippet, which openfoam can understand

 su_junwei June 26, 2008 20:32

Hi Arun try Temperature.m

Hi Arun

try
Temperature.max(dimensionedScalar("t",Temperature. dimensions(),300));

Temperature.min(dimensionedScalar("t",Temperature. dimensions(),2000));

Junwei

 All times are GMT -4. The time now is 16:51.