def Diffu(c, T): c = np.array(c) print(f"Type of c: {type(c)}, Value: {c}") return D_coe[W, 0] * np.exp(D_coe[W, 1] * (FSP * (c > FSP) + c * (c <= FSP)) - D_coe[W, 2] / T) Below is the whole code block that includes def Diffu(c,T) def getMC(W, Th, c, Nt, T, RH): # Constants in the diffusion coefficient formula, arranged in rows by wood type. D_coe = np.array([[5.69e-4, 1.06, 5190], [12e-4, 0.01, 5290], [15e-4, 0.6, 5380]]) # Model parameters L = Th * 0.0254 / 2 # Length of the symmetric computational domain (m) nx = 200 # Number of spatial steps dx = L / (nx - 1) # Spatial step size dt = 0.005 * 3600 # Time step (s) nt = Nt * (3600 / dt) # Number of time steps alpha = dt / dx**2 # Precompute constants e = np.zeros((nx, nx)) # Create coefficient matrix for the implicit scheme # Convert temperature from degF to K def FtoK(F): return (F - 32) * 5 / 9 + 273.15 T = FtoK(T) # Define the function for the equilibrium moisture content, EMC(RH, T) k1 = -0.000612 k2 = 2.43 k3 = 0.0577 k4 = 0.430 Tc = 647.1 def EMC(RH, T): return (k1 * T * (1 - T / Tc) ** k2 * np.log(1 - RH)) ** (k3 * T ** k4) # Define the function for the diffusion coefficient, D(c, T) FSP = 0.3 # The fiber saturation point, 30% def Diffu(c, T): c = np.array(c) print(f"Type of c: {type(c)}, Value: {c}") return D_coe[W, 0] * np.exp(D_coe[W, 1] * (FSP * (c > FSP) + c * (c <= FSP)) - D_coe[W, 2] / T) # Numerical scheme (2nd-order in time, and 4th-order in space) for n in range(int(nt)): # Set the surface moisture content to the equilibrium moisture content c[0] = EMC(RH, T) # Calculate diffusion coefficients for the current time step D = Diffu(c, T) # Assemble coefficient matrix for the implicit scheme # 4th-order central difference for i in range(2, nx - 2): A = np.array([[1, -8, -12, 8, -1], [-8, 64, 192, -64, 8], [0, 0, -360, 0, 0], [8, -64, 192, 64, -8], [-1, 8, -12, -8, 1]]) e[i, i - 2:i + 2] = D[i - 2:i + 2] @ A.T # 4th-order scheme at the boundaries B = np.array([[9, 162, -54, 18, -3], [30, -140, -180, 60, -10], [-54, -108, 324, -108, 18], [18, 108, -108, 36, -6], [-3, -22, 18, -6, 1]]) e[1, 0:5] = D[0:5] @ B.T e[-2, -1:-6:-1] = D[-1:-6:-1] @ B.T # Crank–Nicolson method E1 = 2 * np.eye(nx) - alpha * e / 144 E2 = 2 * np.eye(nx) + alpha * e / 144 # Dirichlet boundary condition at the surface E1[0, 0] = 1 E2[0, 0] = 1 # Neumann boundary condition at the symmetry axis, 4th-order E1[nx - 1, nx - 5:nx] = np.array([3, -16, 36, -48, 25]) / 12 * dt / dx E2[-1, -1] = 0 # Solve for the moisture content distribution b = c.copy() c = np.linalg.solve(E1, E2 @ b) MC = c # Compute the average moisture content over the domain MC_avg = (np.sum(c) + np.sum(c[1:-1])) / 2 / (nx - 1) return MC, MC_avg When I run my main code that calls the functions in this code, I get the following error: File ~\Desktop\DK\3.WDHP\HPWoodSim\functions.py:246, in getMC(W, Th, c, Nt, T, RH) 242 for n in range(int(nt)): 243 # Set the surface moisture content to the equilibrium moisture content 244 c[0] = EMC(RH, T) --> 246 # Calculate diffusion coefficients for the current time step 247 D = Diffu(c, T) 249 # Assemble coefficient matrix for the implicit scheme 250 # 4th-order central difference File ~\Desktop\DK\3.WDHP\HPWoodSim\functions.py:238, in Diffu(c, T) 235 # Define the function for the diffusion coefficient, D(c, T) 236 FSP = 0.3 # The fiber saturation point, 30% --> 238 def Diffu(c, T): 239 return D_coe[W, 0] * np.exp(D_coe[W, 1] * (FSP * (c > FSP) + c * (c <= FSP)) - D_coe[W, 2] / T) 241 # Numerical scheme (2nd-order in time, and 4th-order in space) TypeError: '>' not supported between instances of 'list' and 'float' I tried entering c = np.array(c) to make it into an array, but it doesn't seem to solve the issue. Continue reading...