Hello,
One of my substitutions links viscosity to temperature:
nu_func = lambda T: nu_max * np.tanh(np.exp(Nnu * (NT / T - 1)) / nu_max)
namespace[f'nu'] = nu_func(T)
The issue is that if Nnu * (NT / T - 1) is larger than 1000, the exponential overflows.
Physically, large value of
Nnu * (NT / T - 1 are irrelevant, since the tanh saturates as soon as Nnu * (NT / T - 1) is larger than 10.
Therefore, I would be completely with something like this
def nu_func(T):
if (Nnu * (NT / T - 1) <= 10):
return nu_max * np.tanh(np.exp(Nnu * (NT / T - 1)) / nu_max)
else:
return nu_max
But the if loop is rejected by dedalus, and I get the following error:
TypeError: operand type(s) all returned NotImplemented from __array_ufunc__(<ufunc 'less'>, '__call__', array(13.12236338), Mul(0.1, Add(Mul(2500001.0000000023, Pow(Add(Convert(Convert(<Field 127701709158352>)), Mul(2500000.0000000023, <Field 127701846261968>)), -1)), Convert(Convert(<Field 127701847398800>))))): 'ndarray', 'MultiplyNumberField'
I've tried the equivalent trick using the min function, but got a similar error.
What's the dedalus way to work around this?
Thanks for your help !
Nathan