def setup(self): nn = self.options['num_nodes'] self.add_subsystem('evap', Radial_Stack(n_in=0, n_out=1, num_nodes=nn), promotes_inputs=['D_od', 't_wk', 't_w', 'k_w', 'D_v', 'L_adiabatic', 'alpha']) # promote shared values (geometry, mat props) self.add_subsystem('cond', Radial_Stack(n_in=1, n_out=1, num_nodes=nn), promotes_inputs=['D_od', 't_wk', 't_w', 'k_w', 'D_v', 'L_adiabatic', 'alpha']) self.add_subsystem('cond2', Radial_Stack(n_in=1, n_out=0, num_nodes=nn), promotes_inputs=['D_od', 't_wk', 't_w', 'k_w', 'D_v', 'L_adiabatic', 'alpha']) self.add_subsystem(name='T_rate_cond', subsys=TempRateComp(num_nodes=nn)) self.add_subsystem(name='T_rate_cond2', subsys=TempRateComp(num_nodes=nn)) self.connect('cond.Rex.q', 'T_rate_cond.q') self.connect('cond2.Rex.q', 'T_rate_cond2.q') # self.add_subsystem(name='hp_mass', # subsys=heatPipeMass(num_nodes=nn), # promotes_inputs=['D_od','D_v','L_heatpipe','t_w','t_wk','cu_density',('fill_wk','epsilon'),'liq_density','fill_liq'], # promotes_outputs=['mass_heatpipe', 'mass_wick', 'mass_liquid']) thermal_link(self, 'evap', 'cond', num_nodes=nn) thermal_link(self, 'cond', 'cond2', num_nodes=nn) self.connect('evap_bridge.k_wk', ['evap.k_wk', 'cond.k_wk', 'cond2.k_wk']) load_inputs('boring.input.assumptions', self, nn)
def setUp(self): p = self.prob = om.Problem(model=om.Group()) nn = 1 p.model.add_subsystem( 'cond', Radial_Stack(num_nodes=nn, n_in=0, n_out=1, geom='flat'), promotes_inputs=[ 'T_hp', 'XS:t_w', 'XS:t_wk', 'k_w', 'LW:A_inter', 'alpha' ]) #, 'epsilon', 'XS:A_wk', 'LW:L_flux', 'LW:L_adiabatic', # 'H', 'W' ]) p.model.add_subsystem( 'evap', Radial_Stack(num_nodes=nn, n_in=1, n_out=0, geom='flat'), promotes_inputs=[ 'T_hp', 'XS:t_w', 'XS:t_wk', 'k_w', 'LW:A_inter', 'alpha' ]) #, 'epsilon', 'XS:A_wk', 'LW:L_flux', 'LW:L_adiabatic', # 'H', 'W' ]) thermal_link(p.model, 'cond', 'evap', num_nodes=nn, geom='flat') p.model.connect('cond_bridge.k_wk', ['evap.k_wk', 'cond.k_wk']) p.setup() p['T_hp'] = 300 p['XS:t_w'] = 0.0005 p['XS:t_wk'] = 0.00069 p['W'] = 0.02 p['k_w'] = 11.4 p['LW:A_inter'] = 0.0004 p['alpha'] = 1 p['epsilon'] = 0.46 p['XS:A_w'] = 1E-5 p['XS:A_wk'] = 1.38E-5 p['LW:L_flux'] = .02 p['LW:L_adiabatic'] = .03 p['H'] = .02 p['W'] = .02 p.run_model()
def setup(self): nn = self.options['num_nodes'] self.add_subsystem('evap', Radial_Stack(n_in=0, n_out=1), promotes_inputs=['D_od','t_wk','t_w','k_wk','k_w','D_v','L_adiabatic','alpha']) # promote shared values (geometry, mat props) self.add_subsystem('cond', Radial_Stack(n_in=1, n_out=0), promotes_inputs=['D_od','t_wk','t_w','k_wk','k_w','D_v','L_adiabatic','alpha']) thermal_link(self,'evap','cond') self.set_input_defaults('k_w',11.4) self.set_input_defaults('evap.Rex.R', 0.0000001) self.set_input_defaults('cond.Rex.R', 0.0000001) self.set_input_defaults('cond.L_flux', 0.02) self.set_input_defaults('evap.L_flux', 0.01) self.set_input_defaults('L_adiabatic', 0.03) self.set_input_defaults('t_wk', 0.00069) self.set_input_defaults('t_w', 0.0005) self.set_input_defaults('D_od', 0.006) self.set_input_defaults('k_w', 11.4) self.set_input_defaults('epsilon', 0.46) self.set_input_defaults('D_v', 0.00362) self.set_input_defaults('L_eff', 0.045)
def setup(self): nn = self.options['num_nodes'] n = self.options['num_cells'] pcm_bool = self.options['pcm_bool'] geom = self.options['geom'] n_out = np.append(np.ones(n - 1), 0) n_in = np.append(0, np.ones(n - 1)) for i in np.arange(n): # insantiate the radial stacks based on geometry if geom == 'round': inpts = [ 'T_hp', 'v_fg', 'R_g', 'P_v', 'LW:A_inter', 'k_w', 'k_l', 'epsilon', 'h_fg', 'alpha', 'LW:L_flux', 'XS:D_od', 'XS:r_i', 'XS:D_v' ] if geom == 'flat': inpts = [ 'T_hp', 'v_fg', 'R_g', 'P_v', 'LW:A_inter', 'k_w', 'k_l', 'epsilon', 'h_fg', 'alpha', 'XS:t_w', 'XS:t_wk' ] self.add_subsystem('cell_{}'.format(i), Radial_Stack(n_in=int(n_in[i]), n_out=int(n_out[i]), num_nodes=nn, geom=geom), promotes_inputs=inpts) # add temp rate comps if pcm_bool: self.add_subsystem(name='T_rate_pcm_{}'.format(i), subsys=PCM_Group(num_nodes=nn)) else: self.add_subsystem(name='T_rate_cell_{}'.format(i), subsys=TempRateComp(num_nodes=nn), promotes_inputs=['c_p', 'mass']) # connect external flux if pcm_bool: self.connect('cell_{}.Rex.q'.format(i), 'T_rate_pcm_{}.q'.format(i)) else: self.connect('cell_{}.Rex.q'.format(i), 'T_rate_cell_{}.q'.format(i)) for j in range(n - 1): thermal_link(self, 'cell_{}'.format(j), 'cell_{}'.format(j + 1), num_nodes=nn, geom=geom) self.connect('cell_0.radial.k_wk', 'cell_{}_bridge.k_wk'.format(j)) #self.connect('cell_0.radial.k_wk', 'cell_bridge_{}.k_wk'.format(n-1)) self.set_input_defaults('k_w', 11.4 * np.ones(nn), units='W/(m*K)') self.set_input_defaults('epsilon', 0.46 * np.ones(nn), units=None) self.set_input_defaults('T_hp', 300 * np.ones(nn), units='K') self.set_input_defaults('XS:t_w', 0.0005 * np.ones(nn), units='m') self.set_input_defaults('XS:t_wk', 0.00069 * np.ones(nn), units='m') self.set_input_defaults('LW:A_inter', 0.0004 * np.ones(nn), units='m**2') self.set_input_defaults('alpha', 1 * np.ones(nn), units=None) self.set_input_defaults('XS:A_w', 1E-5 * np.ones(nn), units='m**2') self.set_input_defaults('XS:A_wk', 1.38E-5 * np.ones(nn), units='m**2') # self.set_input_defaults('LW:L_flux', .02 * np.ones(nn), units='m') # self.set_input_defaults('LW:L_adiabatic', .03 * np.ones(nn), units='m') # self.set_input_defaults('H', .02 * np.ones(nn), units='m') # self.set_input_defaults('W', 0.02 * np.ones(nn), units='m') if n > 1: # axial bridge only exists if there are 2 or more cells self.set_input_defaults('LW:L_eff', 0.05 * np.ones(nn), units='m') if pcm_bool: # manually set mass for debugging self.set_input_defaults('T_rate_pcm_1.mass', 0.003 * np.ones(nn), units='kg') self.set_input_defaults('T_rate_pcm_0.mass', 0.003 * np.ones(nn), units='kg') if geom == 'round': self.set_input_defaults('XS:D_od', 6. * np.ones(nn), units='mm') self.set_input_defaults('XS:D_v', 3.62 * np.ones(nn), units='mm') self.set_input_defaults('LW:L_flux', 0.02 * np.ones(nn), units='m')
def test_link(self): p2 = self.prob2 = Problem(model=Group()) p2.model.add_subsystem('evap', Radial_Stack(n_in=0, n_out=1), promotes_inputs=['D_od','t_wk','t_w','k_wk','k_w','D_v','L_adiabatic','alpha']) # promote shared values (geometry, mat props) p2.model.add_subsystem('cond', Radial_Stack(n_in=1, n_out=0), promotes_inputs=['D_od','t_wk','t_w','k_wk','k_w','D_v','L_adiabatic','alpha']) thermal_link(p2.model,'evap','cond') p2.model.set_input_defaults('k_w',11.4) p2.setup(force_alloc_complex=True) Rexe = 0.0000001 Rexc = 0.0000001 # Rwe = 0.2545383947014702 # Rwke = 0.7943030881649811 # Rv = 8.852701208752846e-06 # Rintere = 0.00034794562965549745 # Rinterc = 0.00017397281482774872 # Rwkc = 0.39715154408249054 # Rwka = 744.3007160198263 # Rwa = 456.90414284754644 # Rwc = 0.1272691973507351 self.prob2['evap.Rex.R'] = Rexe # self.prob2['evap.Rw.R'] = Rwe # self.prob2['evap.Rwk.R'] = Rwke # self.prob2['evap.Rinter.R'] = Rintere # self.prob2['cond.Rinter.R'] = Rinterc # self.prob2['cond.Rwk.R'] = Rwkc # self.prob2['cond.Rw.R'] = Rwc self.prob2['cond.Rex.R'] = Rexc self.prob2['cond.L_flux'] = 0.02 self.prob2['evap.L_flux'] = 0.01 self.prob2['L_adiabatic'] = 0.03 # self.prob2['h_fg'] = # self.prob2['T_hp'] = # self.prob2['v_fg'] = # self.prob2['R_g'] = # self.prob2['P_v'] = # self.prob2['k_l'] = self.prob2['t_wk'] = 0.00069 self.prob2['t_w'] = 0.0005 self.prob2['D_od'] = 0.006 self.prob2['k_w'] = 11.4 self.prob2['epsilon'] = 0.46 self.prob2['D_v'] = 0.00362 self.prob2['L_eff'] = (self.prob2['cond.L_flux']+self.prob2['evap.L_flux'])/2.+self.prob2['L_adiabatic'] # self.prob2['k_wk'] = (1-self.prob2['epsilon'])*self.prob2['k_w']+self.prob2['epsilon']*self.prob2['k_l'] # Bridge # self.prob2['A_cond'] = np.pi*self.prob2['D_od']*self.prob2['L_cond'] # self.prob2['A_evap'] = np.pi*self.prob2['D_od']*self.prob2['L_evap'] # self.prob2['A_w'] = np.pi*((self.prob2['D_od']/2.)**2-(self.prob2['D_od']/2.-self.prob2['t_w'])**2) # self.prob2['A_wk'] = np.pi*((self.prob2['D_od']/2.-self.prob2['t_w'])**2-(self.prob2['D_v']/2.)**2) # self.prob2['A_inter'] = np.pi*self.prob2['D_v']*self.prob2['L_evap'] #self.prob2['evap_bridge.Rv.R'] = Rv #self.prob2['evap_bridge.Rwka.R'] = Rwka #self.prob2['evap_bridge.Rwa.R'] = Rwa self.prob2['evap.Rex.T_in'] = 100 self.prob2['cond.Rex.T_in'] = 20 p2.run_model() # p2.model.list_inputs(values=True, prom_name=True) # p2.model.list_outputs(values=True, prom_name=True) # n2(p2) # view_connections(p2) Rtot3 = (self.prob2.get_val('evap.n1.T')-self.prob2.get_val('cond.n1.T'))/np.abs(self.prob2.get_val('cond.Rex.q')) ans = 16731692103737332239244353077427184638278095509511778941./10680954190791611228174081719413008273307025000000000000. assert_near_equal(Rtot3, ans, tolerance=3.0E-5)
def setup(self): nn = self.options['num_nodes'] n = self.options['num_cells'] pcm_bool = self.options['pcm_bool'] geom = self.options['geom'] n_out = np.append(np.ones(n - 1), 0) n_in = np.append(0, np.ones(n - 1)) for i in np.arange(n): if geom == 'ROUND' or geom == 'round': self.add_subsystem('cell_{}'.format(i), Radial_Stack(n_in=int(n_in[i]), n_out=int(n_out[i]), num_nodes=nn, pcm_bool=pcm_bool, geom=geom), promotes_inputs=[ 'D_od', 't_wk', 't_w', 'k_w', 'D_v', 'L_adiabatic', 'alpha' ]) if geom == 'FLAT' or geom == 'flat': self.add_subsystem('cell_{}'.format(i), Radial_Stack(n_in=int(n_in[i]), n_out=int(n_out[i]), num_nodes=nn, pcm_bool=pcm_bool, geom=geom), promotes_inputs=[ 'W', 't_wk', 't_w', 'k_w', 'L_adiabatic', 'alpha' ]) self.add_subsystem(name='T_rate_cell_{}'.format(i), subsys=TempRateComp(num_nodes=nn)) self.connect('cell_{}.Rex.q'.format(i), 'T_rate_cell_{}.q'.format(i)) self.add_subsystem( name='hp_mass', subsys=heatPipeMass(num_nodes=nn), promotes_inputs=[ 'D_od', 'D_v', 'L_heatpipe', 't_w', 't_wk', 'cu_density', ('fill_wk', 'epsilon'), 'liq_density', 'fill_liq' ], promotes_outputs=['mass_heatpipe', 'mass_wick', 'mass_liquid']) for j in range(n - 1): thermal_link(self, 'cell_{}'.format(j), 'cell_{}'.format(j + 1), num_nodes=nn, geom=geom) self.connect('cell_0_bridge.k_wk', 'cell_{}.k_wk'.format(j)) self.connect('cell_0_bridge.k_wk', 'cell_{}.k_wk'.format(n - 1)) self.set_input_defaults('k_w', 11.4 * np.ones(nn), units='W/(m*K)') self.set_input_defaults('epsilon', 0.46 * np.ones(nn), units=None) self.set_input_defaults('L_flux', 0.02 * np.ones(nn), units='m') self.set_input_defaults('L_adiabatic', 0.03 * np.ones(nn), units='m') self.set_input_defaults('t_w', 0.0005 * np.ones(nn), units='m') self.set_input_defaults('t_wk', 0.00069 * np.ones(nn), units='m') if geom == 'ROUND' or geom == 'round': self.set_input_defaults('D_od', 0.006 * np.ones(nn), units='m') self.set_input_defaults('D_v', 0.00362 * np.ones(nn), units='m') elif geom == 'FLAT' or geom == 'flat': self.set_input_defaults('H', 0.02 * np.ones(nn), units='m') self.set_input_defaults('W', 0.02 * np.ones(nn), units='m')