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

Preventing infinite fields?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 17, 2013, 10:43
Default Preventing infinite fields?
  #1
New Member
 
Matt Mosquera
Join Date: Jun 2013
Location: Lewisburg, PA
Posts: 18
Rep Power: 4
mosquera is on a distinguished road
Greetings all,

I'm working on a foam project in which I need to define a new field based on several other parameters (k, e, nut).

I've done this so far using something of the form

volScalarField B ("B", 2*k/(nut*e))

My problem is that there are points in my field inw hcih either nut or e are equal to zero. Therefore, the code compiles but upon running it in my case I receive a core dump. I assume this is due to the computer running out of memory.

What's a good workaround such that I can bound B between, say, 0 and 1 regardless of nut and e?

I've tried to use if-then statements but unfortunately c++ is new to me and I haven't eben able to get good results.

Thanks,

Matt
mosquera is offline   Reply With Quote

Old   June 17, 2013, 12:58
Default
  #2
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 727
Rep Power: 18
mturcios777 will become famous soon enough
Foam has a built in quantity called SMALL that can be added to the denominator that is very near machine zero, but still strictly non-zero. This won't prevent huge values but will keep you from getting NAN errors, and help you track down errors.
mturcios777 is offline   Reply With Quote

Old   June 18, 2013, 04:56
Default
  #3
New Member
 
Matt Mosquera
Join Date: Jun 2013
Location: Lewisburg, PA
Posts: 18
Rep Power: 4
mosquera is on a distinguished road
That was helpful, thanks!

It's running now but I'm still looking for a way to bound the values.
mosquera 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
a reconstructPar issue immortality OpenFOAM Post-Processing 8 June 16, 2013 11:25
an odd(at least for me!) reconstructPar error on a field immortality OpenFOAM Running, Solving & CFD 3 June 3, 2013 22:36
PaSR + infinite reaction rate in reactingFoam --> no reactions occurring tatu OpenFOAM Running, Solving & CFD 1 November 21, 2012 06:02
Missing fields in reconstructPar flowris OpenFOAM 1 July 9, 2010 02:48
PostChannel maka OpenFOAM Post-Processing 5 July 22, 2009 09:15


All times are GMT -4. The time now is 14:12.