|
[Sponsors] |
June 17, 2013, 10:43 |
Preventing infinite fields?
|
#1 |
New Member
Matt Mosquera
Join Date: Jun 2013
Location: Lewisburg, PA
Posts: 18
Rep Power: 12 |
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 |
|
June 17, 2013, 12:58 |
|
#2 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
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.
|
|
June 18, 2013, 04:56 |
|
#3 |
New Member
Matt Mosquera
Join Date: Jun 2013
Location: Lewisburg, PA
Posts: 18
Rep Power: 12 |
That was helpful, thanks!
It's running now but I'm still looking for a way to bound the values. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PaSR + infinite reaction rate in reactingFoam --> no reactions occurring | tatu | OpenFOAM Running, Solving & CFD | 2 | November 24, 2016 18:34 |
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 |
Missing fields in reconstructPar | flowris | OpenFOAM | 1 | July 9, 2010 02:48 |
PostChannel | maka | OpenFOAM Post-Processing | 5 | July 22, 2009 09:15 |