On 10/25/23 08:05, Zacharias-Panagiotis Oikonomou wrote:
*The problem seems to be that in a random timestep, the variable named /temp /takes a NaN value, so I solved the problem with the if(isnan()) condition *(as shown below), but I was wondering if anyone has encountered this problem and how they solved it.

Well, you didn't actually *solve* the problem, you just ignored it with the if() statement :-)

The way to debug this is to figure out where the NaN came from. To understand how to do this, note that you end up with a NaN value in your right hand side vector. But you assembled that rhs vector. So in the function that assembles the rhs, check every time you write something (namely, a local contribution) into the vector, whether that something is a NaN -- that's the only way a NaN can have gotten into your rhs vector!

When you have verified that the NaN gets into the vector through the assembly, start looking through your assembly function and try to understand how that NaN got there. Perhaps, you divided by zero somewhere. Or you took the square root of a negative number.

Best
 W.

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/4989a2b9-c207-42e7-bcc2-7859f1f0dbf8%40colostate.edu.

Reply via email to