Mar-31-2018, 09:56 AM
I am working on a simple code, for calculating Re number. The problem is that I want to check every number in Re vector, although I do not know how to do it.
The error I am getting is: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The code:
The error I am getting is: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The code:
import numpy as np from CoolProp.CoolProp import PropsSI from numpy import* v = [1,2,3,4,5] Tz = 42 + 273 v = 4e-2 # [m] s = 2e-2 # [m] #------------------------------------------------------------------------------------ npv = np.array(v) A = v*s ob = 2*(s + v) Dh = (4*A)/ ob roZ = PropsSI('D', 'P', 101325, 'T', Tz, 'Air') din_vis= PropsSI('V', 'P', 101325, 'T', Tz, 'Air') kin_vis = din_vis/roZ Re= (npv *Dh )/ kin_vis Pr = PropsSI('PRANDTL', 'P', 101325, 'T', Tz, 'Air') print ('Re:',Re) print ('Pr:',Pr) if Re < 2300: print('Laminar flow, Re = ', Re) elif Re > 10000 and Pr >= 0.6 and Pr <= 160: print('Turbolent flow, Re = ', Re) print('Pr = ', Pr) else: print(' Re = ', Re) print('Pr = ', Pr)Any help is much appreciated.