CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

heaviside?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   February 25, 2011, 14:41
Default heaviside?
  #1
New Member
 
Martine Ginette
Join Date: Feb 2011
Posts: 5
Rep Power: 6
ginette is on a distinguished road
Dear Open Foam Community,

I am a brand new to OpenFoam.

I would like to create a field like
Code:
volScalarField toto = toto1 * heaviside(phi) + toto2 * heaviside(-phi);
where toto1 and toto2 are two "constants" and phi is a "volScalarField". Is there a way to do this?

Many thanks in advance,
Martin.
ginette is offline   Reply With Quote

Old   February 25, 2011, 15:00
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,608
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Hi Martine

You could use either of the functions Foam::neg or Foam:os. These functions return 1 if the argument is negative (positive) and 0 if the argument is positive (negative). I do not know how the functions handles 0, however.

Best regards,

Niels
ngj is offline   Reply With Quote

Old   February 25, 2011, 15:24
Default
  #3
New Member
 
Martine Ginette
Join Date: Feb 2011
Posts: 5
Rep Power: 6
ginette is on a distinguished road
Indeed!

Thanks so much, Niels!

Martin.

PS: Is there a way to close the thread and tag is "solved"?
ginette is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Heaviside Function MCDG CFX 1 December 3, 2007 04:32
smoothed interface capturing method: compressible. jinwon Main CFD Forum 0 May 14, 2007 00:20
Heaviside Function? Zhou Hua Main CFD Forum 2 December 8, 2003 06:10


All times are GMT -4. The time now is 20:42.