CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

define sign scalar

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 20, 2012, 10:41
Default define sign scalar
  #1
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
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)?
zxj160 is offline   Reply With Quote

Old   June 20, 2012, 15:25
Default
  #2
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 122
Rep Power: 16
niaz is on a distinguished road
Dear zx
you can do like this
rho == max(rho, rhoMin);
you should insert your value in rhoMin position.
niaz is offline   Reply With Quote

Old   June 21, 2012, 15:42
Default
  #3
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
Quote:
Originally Posted by niaz View Post
Dear zx
you can do like this
rho == max(rho, rhoMin);
you should insert your value in rhoMin position.
Many thanks. It works.
zxj160 is offline   Reply With Quote

Old   August 25, 2014, 15:06
Default
  #4
New Member
 
Jonas L. Ansoni
Join Date: Jun 2011
Location: Brazil
Posts: 22
Rep Power: 14
Jonas Ansoni is on a distinguished road
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.
Attached Files
File Type: c interDyMScalarFoam.C (4.4 KB, 5 views)
Jonas Ansoni is offline   Reply With Quote

Old   August 25, 2014, 17:46
Default
  #5
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
You may try C==max(C,0.0) after you solve the scalar transport equation.

Thanks,
Jian
zxj160 is offline   Reply With Quote

Reply

Tags
sign scalar


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing OF 1.6 on Mac OS X gschaider OpenFOAM Installation 129 June 19, 2010 09:23
Scalar problem! lig FLUENT 0 May 5, 2010 15:16
Missing math.h header Travis FLUENT 4 January 15, 2009 11:48
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 12:24
UDF FOR UNSTEADY TIME STEP mayur FLUENT 3 August 9, 2006 10:19


All times are GMT -4. The time now is 07:59.