import math def sqrt(num): return num ** 0.5 def CalcCond(Temp, StateV, cmname): #print("StateV in fun CalcCond:" + str(StateV)) cond = 1.0 specht = 439.0 alatht = 276000 Ts = 1260 Tl = 1336 Tsd = (Tl - Ts)/4 Tav = (Tl + Ts)/2 T4sd1 = Tav - 4*Tsd T4sd2 = Tav + 4*Tsd pi = 3.1416 xerf = (Temp - Tav)/sqrt(2)/Tsd phi = (1/2)*(1+math.erf(xerf)) dphidt = (1 / sqrt(2 * pi) / Tsd) * math.exp(-((Temp - Tav) ** 2) / 2 / Tsd ** 2) ''' Define the specific heat capacity of SOLID depending on temperature (J/kg*C) ! Fitting the data of Bo Cheng et al.(2015) ''' '''if (Temp > 25) and (Temp <= T4sd1): specht = 4.48 * Temp * Temp / 10000 - 0.153 * Temp + 498 elif (Temp > T4sd1) and (Temp <= T4sd2): sps = 4.48 * T4sd1 * T4sd1 / 10000 - 0.153 * T4sd1 + 498 spl = 677.0 specht = sps + (spl - sps) * phi + alatht * dphidt elif Temp > T4sd2: specht = 677''' ''' Solid / Powder ''' if cmname == 'SOLID': StateV = 1.0 #if cmname == 'POWDER': # StateV = 0.0 elif StateV == 1.0: StateV = 1.0 elif Temp > Tl: StateV = 1.0 ''' Define the coefficient of heat couduction of SOLID depending on temperature (W/m*C) Fitting the data of Bo Cheng (2015), Johannes Weirather(2018) ''' if (Temp > 20) and (Temp <= T4sd1): cond = 0.0199 * Temp + 9.02 elif (Temp > T4sd1) and (Temp <= T4sd2): cons = 0.0199 * T4sd1 + 9.02 conl = 29.0 cond = cons + (conl - cons) * phi elif Temp > T4sd2: cond = 29.0 ''' The thermal conductivity of POWDER Define the coefficient of heat couduction of POWDER depending on temperature (unit: W/m*K) Bo Cheng (2015) ''' condp = 0 if (StateV == 0.0): if (Temp > 20) and (Temp <= T4sd1): condp = 0.1 * cond elif (Temp > T4sd1) and (Temp <= T4sd2): conps = 0.1 * cond conl = 29.0 condp = conps + (conl - conps) * phi cond = condp print(str(Temp) + " , " + str(cond) + " , " + str(StateV)) return Temp, cond, StateV