CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   define sign scalar (https://www.cfd-online.com/Forums/openfoam-programming-development/103548-define-sign-scalar.html)

zxj160 June 20, 2012 10:41

define sign scalar
 
Hi,

I set up a passive scalar. But when calculating, the negative values come out. Actually, the passive can not be negative. How to set the scalar to be sign type (only positive or zero value)?

niaz June 20, 2012 15:25

Dear zx
you can do like this
rho == max(rho, rhoMin);
you should insert your value in rhoMin position.

zxj160 June 21, 2012 15:42

Quote:

Originally Posted by niaz (Post 367510)
Dear zx
you can do like this
rho == max(rho, rhoMin);
you should insert your value in rhoMin position.

Many thanks. It works.

Jonas Ansoni August 25, 2014 15:06

1 Attachment(s)
Hello zx and niaz!!

I'm facing the same problem. I'm simulating the transport of a passive scalar (C) in a biphasic flow by interDymFoam and the values are negatives.
I created a new solver based on interDyFoam (interDyMScalarFoam.C) as can seen on the attached files. The solver works fine, however the values of the passive scalar are negatives.

I tried to use other numerical schemes such as suggested by Jasak on post #13, but without success.

You could give me more details of how you solved this problem. Where do you set rho == max(rho, rhoMin);?

Link to download the files (interDyMScalarFoam.C, C, fvSchemes, fvSolutions)
https://dl.dropboxusercontent.com/u/...onForum.tar.gz

Thanks a lot.

zxj160 August 25, 2014 17:46

You may try C==max(C,0.0) after you solve the scalar transport equation.

Thanks,
Jian


All times are GMT -4. The time now is 22:00.