Why does CalculiX convert very large initial temperatures into negative numbers?

I’m using the following input:
*INITIAL CONDITIONS, TYPE=TEMPERATURE
Nall, 20
20258,3000
20259,3000
20260,3000
20261,3000

However, when I check the .dat file and view the results in ParaView, the temperatures are converted into these values:
20258 -2.147484E+03
20259 -2.147484E+03
20260 -2.147484E+03
20261 -2.147484E+03
What could be causing this behavior? How can I ensure the temperatures remain correctly interpreted in CalculiX?

Use a “.0” at the end of the temperature value. See if that works.

I didn’t think it output the initial values (t=0) so maybe these are the next values after the 1st increment and they’ve already changed.

Please don’t ask me why,
if it could be a bug or for me other unknown kind of limitations,
but from my simple test, an initial temperature of 2147 seems to be the limit before the initial value turns be converted to a negative number

1 Like

It seems to be a really nasty bug. I reported it here: Any initial temperature above 2147 is converted to -2147 · Issue #114 · Dhondtguido/CalculiX · GitHub

1 Like

Wow that’s very clear and strange. It works for very negative temperatures too.

I wonder if it’s caused by this in initialconditionss.f:

        temperature=1.d-6*int(1.d6*temperature+0.5d0)

Maybe int can’t fit 3000 * 1e6 and it overflows.

In which file is .dll located?

You cannot replace a .dll file to resolve this problem. You need to eliminate line

temperature=1.d-6*int(1.d6*temperature+0.5d0)

from the ccx source file initialconditionss.f. Then recompile the file initialconditionss.f and link its compiled counterpart initialconditionss.o to update the ccx executable.

1 Like

Before recompile, should I just delete the line or modify it to allow for a much larger number?

Please delete the line.

Use kind=8 instead. Should work.

I believe the line has been meant to limit the digits of the temperature to 6. Fortran is capable of dealing with 64 bit integers so the int should just be replaced with int8

temperature=1.d-6*int8(1.d6*temperature+0.5d0)

or of course as @jbr mentioned

temperature=1.d-6*int(1.d6*temperature+0.5d0,kind=8)
2 Likes

The line was removed from initialconditionss.f in commit 0173f9d.

Great. Thanks for info. I was going to write to Guido about this.