def test_ap_bcvar_nodal_array(self): gridFile = os.path.join(baseDir, '../input_files/conic_conv_nozzle_mb_L4_array.cgns') options = copy.deepcopy(self.options) options['gridfile'] = gridFile CFDSolver = ADFLOW(options=options) CFDSolver.addFamilyGroup('upstream',['inlet']) CFDSolver.addFamilyGroup('downstream',['outlet']) ap = self.ap group = 'outlet' BCVar = 'Pressure' # ap.bc_data = bc_data ap.setBCVar(BCVar, 70000.0, group) ap.addDV(BCVar, name='outlet_pressure', familyGroup=group,) # DVs = {'outlet_pressure':123000.0} DVs = {'outlet_pressure':np.arange(1,5*9+1)*10**5} ap.setDesignVars(DVs) assert (ap.getBCData()[group][BCVar] == DVs['outlet_pressure']).all() CFDSolver.setAeroProblem(ap) bc_data = CFDSolver.getBCData(groupNames=[group]) for ii, d in enumerate(bc_data.getBCArraysFlatData(BCVar, familyGroup=group)): assert d == DVs['outlet_pressure'][ii]
def test_ap_bcvar_array(self): CFDSolver = ADFLOW(options=self.options) CFDSolver.addFamilyGroup('upstream',['inlet']) CFDSolver.addFamilyGroup('downstream',['outlet']) ap = self.ap group = 'outlet' BCVar = 'Pressure' # ap.bc_data = bc_data ap.setBCVar(BCVar, 70000.0, group) ap.addDV(BCVar, name='outlet_pressure', familyGroup=group,) # DVs = {'outlet_pressure':123000.0} DVs = {'outlet_pressure':np.arange(1,6)*10**5} ap.setDesignVars(DVs) print(ap.getBCData()[group][BCVar] == DVs['outlet_pressure']) assert (ap.getBCData()[group][BCVar] == DVs['outlet_pressure']).all() CFDSolver.setAeroProblem(ap) bc_data = CFDSolver.getBCData(groupNames=[group]) for ii, d in enumerate(bc_data.getBCArraysFlatData(BCVar, familyGroup=group)): assert d == DVs['outlet_pressure'][ii]
def test_ap_bcvar_scalar(self): CFDSolver = ADFLOW(options=self.options) CFDSolver.addFamilyGroup('upstream',['inlet']) CFDSolver.addFamilyGroup('downstream',['outlet']) ap = self.ap group = 'outlet' BCVar = 'Pressure' # ap.bc_data = bc_data ap.setBCVar(BCVar, 70000.0, group) ap.addDV(BCVar, name='outlet_pressure', familyGroup=group,) DVs = {'outlet_pressure':123000.0} ap.setDesignVars(DVs) assert ap.getBCData()[group][BCVar] == DVs['outlet_pressure'] CFDSolver.setAeroProblem(ap) bc_data = CFDSolver.getBCData(groupNames=[group]) for d in bc_data.getBCArraysFlatData(BCVar, familyGroup=group): assert d == DVs['outlet_pressure']