replace analytical integration with numerical#110
Conversation
|
@mamattern, could you please check this branch, if it still works without analytical integration? |
|
Here are some comparisons for different types of temperature dependence of the heat capacity using |
|
Following this thread Using In general the interpolation of experimental data should be avoided and a fit function should be used instead. |
|
instead of using def my_heat_capacity(T):
T = np.array(T)
res = np.ones_like(T, dtype=float)
select = T>=634
res[select] = -0.775/0.0718*np.abs((T[select]-634)/634)**0.0718 + 13.5+3.03*(T[select]-634)/634
select = T<634
res[select] =-2.46/0.0718*np.abs((T[select]-634)/634)**0.0718+37+3.03*(T[select]-634)/634
return res |
|
Using the numerical integration branch and the above defined heat capacity by: does not work and produces the following error: |
|
the problem is raised by |
|
removing the vectorization of the def my_heat_capacity(t):
if t >= 634:
return -0.775/0.0718*np.abs((t-634)/634)**0.0718 + 13.5+3.03*(t-634)/634
else:
return -2.46/0.0718*np.abs((t-634)/634)**0.0718+37+3.03*(t-634)/634 |
|
another option with vectorization would be using Ni_layer.heat_capacity = '(0.5*erf(634-T)+1)*(-2.46/0.0718*abs((T-634)/634)**0.0718+37+3.03*(T-634)/634) + (0.5*erf(T-634)+1)*(-0.775/0.0718*abs((T-634)/634)**0.0718 + 13.5+3.03*(T-634)/634)'this again works with the |
|
This does not work for me. I import If I use the private setting: |
|
I just fixed the errors from the Would be very interesting for the |
|
Now it works for me. I tested for numeric integration both possibilities: and the difference in the results is of the order e-10 and the calculation of the temperature after delta excitation took 7.4/7.2s, the calculation of the heat diffusion took 189/179s and the calculation of the strain map took 3.0/2.9s. As a comparison I also tested the analytic integration possibility by giving the heat capacity and linear thermal expansion coefficient and their integrals by |
|
okay, so without referring to the large difference in the To that I end, I would stick to the analytical integration of the |










following #109 the analytical integration can be replaced by numerical integration using
scipy.integrate.quad.This avoids doing the symbolig integration of the heat capacities and lin_therm_exp coefficients