Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ln in for loop
#1
Hi,
I m trying to solve PDE with finite elements method. Problem is, when I put the part, which has ln(x) in it, I get error. I tried np.log() and math.log() but no luck. Can someone help me?

T[0,:] = T_ok
T[:,0] = T_in


for t in range(Nt):
    for z in range(1,Nz+1):
        T[t+1,z] = T[t,z]-(v_avg*dt/dz)*(T[t,z]-T[t,z-1])-(U*2*dt*L/(r_1*dz))*(((T_in-T_h)-(T[t,z]-T_h))/(np.log((T_in-T_h)/(T[t,z]-T_h))))
        
    T[t+1,Nz+1] = T[t+1,Nz]
Reply
#2
(Jun-17-2017, 07:21 AM)pikm57 Wrote: I get error.
Please, post the full Traceback in error tags
Reply
#3
I just solved it. Tnx.
Reply
#4
would be nice to expalin what the problem was for the benefit of other members who may come here searching for solution
Reply
#5
The problem was that some values in ln() were <0.... such a stupid mistake Confused
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020