def get_minpar(apar): """Function for returning parameter to be minimized.""" te_pair.I = apar[0] te_pair.leg_area_ratio = apar[1] te_pair.set_area() te_pair.set_constants() te_pair.solve_te_pair() minpar = 1. / te_pair.P return minpar
te_pair = te_pair.TE_PAIRodule() te_pair.I = current te_pair.Ntype.material = 'MgSi' te_pair.Ptype.material = 'HMS' te_pair.T_h_goal = 500. te_pair.T_c = 300. te_pair.Ptype.node = 0 te_pair.Ntype.node = 0 te_pair.Ptype.area = area te_pair.Ntype.area = te_pair.Ptype.area * area_ratio te_pair.length = length te_pair.area_void = 0. te_pair.method = 'analytical' te_pair.set_constants() te_pair.solve_te_pair() T_props = np.linspace(300,450.,100) T_h_goal = np.linspace(300,600.,100) A_opt = np.empty(np.size(T_props)) xi_opt = np.empty(np.size(T_props)) eta_max = np.empty(np.size(T_props)) abc = np.empty([np.size(T_props),3]) for i in range(np.size(T_props)): te_pair.T_props = T_props[i] te_pair.set_A_opt() A_opt[i] = te_pair.A_opt for i in range(np.size(T_h_goal)): te_pair.T_h_goal = T_h_goal[i]
import te_pair reload(te_pair) te_pair = te_pair.TE_Pair() te_pair.Ntype.material = 'MgSi' te_pair.Ptype.material = 'HMS' te_pair.T_c_conv = 300. te_pair.T_h_conv = 500. te_pair.U_cold = 500. te_pair.U_hot = 500. te_pair.solve_te_pair() R_load_total = np.linspace(0.1, 1.0, 30) R_internal = np.zeros(R_load_total.size) P = np.zeros(R_load_total.size) for i in range(R_load_total.size): te_pair.R_load_total = R_load_total[i] # it has to be called for this to work # te_pair.set_R_load() te_pair.solve_te_pair() P[i] = te_pair.P R_internal[i] = te_pair.R_internal print "\nR_load_total is ", R_load_total[i] print "R_internal is ", R_internal[i] print "Power is ", P[i]