def optim(apar): # unpack guess vector apar=np.asarray(apar) hx.te_pair.leg_ratio = apar[0] hx.te_pair.fill_fraction = apar[1] hx.te_pair.length = apar[2] hx.te_pair.I = apar[3] # reset surrogate variables hx.te_pair.Ntype.area = hx.te_pair.leg_ratio*hx.te_pair.Ptype.area hx.te_pair.area_void = ( (1. - hx.te_pair.fill_fraction) / hx.te_pair.fill_fraction * (hx.te_pair.Ptype.area + hx.te_pair.Ntype.area) ) hx.set_constants() hx.solve_hx() # 1/power_net -- fmin is a minimization routine return 1./(hx.power_net)
hx.te_pair.length = length hx.te_pair.Ntype.material = 'MgSi' hx.te_pair.Ntype.area = area hx.te_pair.Ptype.material = 'HMS' hx.te_pair.Ptype.area = area * 2. hx.te_pair.area_void = 25. * area hx.type = 'parallel' hx.exh.enhancement = "straight fins" hx.exh.fin.thickness = 5.e-3 hx.exh.fins = 10 hx.exh.T_inlet = 800. hx.exh.P = 100. hx.cool.T_inlet = 300. hx.solve_hx() currents = sp.linspace(2., 6., 25) area_voids = sp.linspace(15., 75., 25) * area hx.power_net_array = sp.zeros([sp.size(currents), sp.size(area_voids)]) for i in sp.arange(sp.size(currents)): for j in sp.arange(sp.size(area_voids)): hx.te_pair.I = currents[i] hx.te_pair.area_void = area_voids[j] hx.solve_hx() hx.power_net_array[i,j] = hx.power_net print "\nProgram finished."
hx.te_pair.Ntype.area = area hx.te_pair.Ptype.material = 'HMS' hx.te_pair.Ptype.area = area * 2. hx.te_pair.area_void = 150. * area hx.te_pair.method = 'analytical' hx.type = 'parallel' # hx.exh.enhancement = "straight fins" # hx.exh.fin.thickness = 5.e-3 # hx.exh.fins = 22 # 22 fins seems to be best. hx.exh.T_inlet = 800. hx.exh.P = 100. hx.cool.T_inlet = 300. hx.set_mdot_charge() hx.solve_hx() # solving once to initialize variables that are used # later ducts = np.array([2.]) hx.Qdot_array = np.zeros(np.size(ducts)) hx.te_pair.power_array = np.zeros(np.size(ducts)) hx.power_net_array = np.zeros(np.size(ducts)) hx.Wdot_pumping_array = np.zeros(np.size(ducts)) hx.exh.height_array = 3.5e-2 / ducts hx.cool.height_array = 1.e-2 / ducts hx.length_array = hx.length * ducts for i in np.arange(np.size(ducts)): hx.exh.height = hx.exh.height_array[i] hx.cool.height = hx.cool.height_array[i]