Closed ltdeck closed 3 years ago
I think I found the problem. In line 813, the random term is just directly drawn from the normal distribution, but not multiplied with s_sigma_rel. However, I did not figure out yet why it still draws a random number even in case s_sigma_rel = 0.
Hey @ltdeck , problem is fixed.
It still drew a random number because the condition was only on "does this key exist in the dictionary?". There was no condition on the value. I implemented this now and also created a failsafe in case a k_shelf becomes smaller than 0 (non-physical).
There still seems to be an issue in case s_sigma_rel = 0, while it works fine for s_sigma_rel > 0, see the two attached screenshot s.
Unexpected behavior of 'any' created the issue.
any(False)
>>> TypeError: 'bool' object is not iterable
numpy.any behaves as expected
np.any(False)
>>> False
Fixed and created a unit test.
Again need to reopen this; the bug persists in snowfall. Setting s_sigma_rel to 0 leads to the attached error. It does work however, for snowflake.
Code:
from ethz_snow.snowfall import Snowfall
from ethz_snow.operatingConditions import OperatingConditions
d = {"int": 1, "ext": 1, "s0": 60, "s_sigma_rel": 0}
S = Snowfall(k=d,Nrep=10,N_vials=(3,3,1),opcond=OperatingConditions(t_tot=1e4,cooling= {"rate": 1 / 60, "start": 20, "end": -50},holding= {"duration": 1, "temp": -12}) )
Am not able to reproduce the issue. The code works for me. Are you sure you had loaded the updated module, @ltdeck ? Maybe restart the kernel and try again. If the problem does not occur, please close again.
Indeed, I was still working with the old kernel. Restarting solved the issue.
When manually adjusting the heat transfer parameters, the effect on the 'shelf' parameters in k is unclear. Setting s_sigma_rel to 0 or to a value higher than 0.1 has no significant impact. Also, when increasing s0 to 2000, the absolute difference between s0 and the 'shelf' parameters remains the same, while it should increase since it is defined in relation to s0.