CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   How to let OpenFOAM abort a simulation when values exceed a given range? (https://www.cfd-online.com/Forums/openfoam-solving/103932-how-let-openfoam-abort-simulation-when-values-exceed-given-range.html)

karkar June 29, 2012 07:01

How to let OpenFOAM abort a simulation when values exceed a given range?
 
When the absolute pressure becomes negative or U exceeds the speed of light, things have pretty obviously gone wrong (be that bad boundary conditions, a too coarse mesh, a too large timestep etc.).


So, is there any way to have a simulation abort with an error message when values exceed definable non-physical ranges?


--
I also asked this question at the Computational Science StackExchange (http://scicomp.stackexchange.com/q/2654/1669), please have a look at their Q&A system which offers a more ordered system for answers (none of these <<oh, I haz similar prob, plz send codez>> "answers")

su_junwei June 29, 2012 21:45

Quote:

Originally Posted by karkar (Post 368875)
When the absolute pressure becomes negative or U exceeds the speed of light, things have pretty obviously gone wrong (be that bad boundary conditions, a too coarse mesh, a too large timestep etc.).


So, is there any way to have a simulation abort with an error message when values exceed definable non-physical ranges?


--
I also asked this question at the Computational Science StackExchange (http://scicomp.stackexchange.com/q/2654/1669), please have a look at their Q&A system which offers a more ordered system for answers (none of these <<oh, I haz similar prob, plz send codez>> "answers")


if(max(mag(U)).value()>3e8)
{
FatalErrorIn("Function name")<<"error message"<<abort(FatalError);
}

If the velocity exceed 3e8, there should be a problem, and program should abort after a short time itself.

Regards, Junwei

karkar July 2, 2012 02:10

Quote:

Originally Posted by su_junwei (Post 368962)
if(max(mag(U)).value()>3e8)
{
FatalErrorIn("Function name")<<"error message"<<abort(FatalError);
}

If the velocity exceed 3e8, there should be a problem, and program should abort after a short time itself.

Regards, Junwei

Thanks Junwei,

I assume you mean putting that in the used solver?

But is there any other solution that does not require recompilation? Maybe something like a #codeStream statement in controlDict?

Cheers


All times are GMT -4. The time now is 05:10.