Beispiel #1
0
    def test_setBCData(self):
        "Test if bcdata is correctly set to data arrays"
        
        


        CFDSolver = ADFLOW(options=self.options)
        CFDSolver.addFamilyGroup('upstream',['inlet'])
        CFDSolver.addFamilyGroup('downstream',['outlet'])
        bc_data = CFDSolver.getBCData(groupNames=self.set_dvs.keys())
        
        for patch in bc_data:
            if patch.fam in self.set_dvs: 
                for arr in patch:
                    if arr.name in self.set_dvs[patch.fam]:
                        arr.data = self.set_dvs[patch.fam][arr.name]
        
        CFDSolver.setBCData(bc_data)
        # CFDSolver.setAeroProblem(self.ap)

        new_bc_data = CFDSolver.getBCData(groupNames=self.set_dvs.keys())

        ## check that the mesh bc match 
        for patch in new_bc_data:
            for arr in patch:
                np.testing.assert_array_equal(arr.data,
                 np.array(self.set_dvs[patch.fam][arr.name])
                 , err_msg=arr.name)
Beispiel #2
0
    def test_setBCData_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'])

        bc_data = CFDSolver.getBCData(groupNames=self.set_dvs.keys())
        for patch in bc_data:
            if patch.fam in self.set_dvs: 
                for arr in patch:
                    if arr.name in self.set_dvs[patch.fam]:
                        arr.data = self.set_dvs[patch.fam][arr.name]*np.ones(arr.size)
        
        CFDSolver.setBCData(bc_data)
        bc_data = CFDSolver.getBCData(groupNames=self.set_dvs.keys())

        for patch in bc_data:
            for arr in patch:
                np.testing.assert_array_equal(arr.data, np.ones(arr.size)*
                                                self.set_dvs[patch.fam][arr.name])