Exemplo n.º 1
0
    def test_adpac(self):
        # Verify correct metric values for data from real scenario.
        logging.debug("")
        logging.debug("test_adpac")

        domain = restart.read("lpc-test", logging.getLogger())
        surfaces = [("zone_1", 2, 2, 0, -1, 0, -1), ("zone_2", 2, 2, 0, -1, 0, -1)]
        variables = [
            ("area", "inch**2"),
            ("pressure_stagnation", "psi"),
            ("pressure", "psi"),
            ("temperature_stagnation", "degR"),
            ("temperature", "degR"),
            ("mass_flow", "lbm/s"),
            ("corrected_mass_flow", "lbm/s"),
        ]
        metrics = surface_probe(domain, surfaces, variables, "mass")
        logging.debug("lpc-test I face data:")
        for i, (name, units) in enumerate(variables):
            logging.debug("    %s = %g %s" % (name, metrics[i], units))

        # These values have been verified with ADSPIN.
        assert_rel_error(self, metrics[0], 830.494, 0.00001)
        assert_rel_error(self, metrics[1], 8.95658, 0.00001)
        assert_rel_error(self, metrics[2], 6.97191, 0.00001)
        assert_rel_error(self, metrics[3], 547.784, 0.00001)
        assert_rel_error(self, metrics[4], 509.909, 0.00001)
        assert_rel_error(self, metrics[5], 120.092, 0.00001)
        assert_rel_error(self, metrics[6], 202.573, 0.00001)

        surfaces = [("zone_1", 0, -1, 2, 2, 0, -1)]
        metrics = surface_probe(domain, surfaces, variables, "mass")
        logging.debug("lpc-test J face data:")
        for i, (name, units) in enumerate(variables):
            logging.debug("    %s = %g %s" % (name, metrics[i], units))

        assert_rel_error(self, metrics[0], 1089.77, 0.00001)
        assert_rel_error(self, metrics[1], 7.08859, 0.00001)
        assert_rel_error(self, metrics[2], 6.52045, 0.00001)
        assert_rel_error(self, metrics[3], 553.772, 0.00001)
        assert_rel_error(self, metrics[4], 540.711, 0.00001)
        assert_rel_error(self, metrics[5], 0.421583, 0.00001)
        assert_rel_error(self, metrics[6], 0.903318, 0.00001)

        surfaces = [("zone_1", 0, -1, 0, -1, 2, 2)]
        metrics = surface_probe(domain, surfaces, variables, "mass")
        logging.debug("lpc-test K face data:")
        for i, (name, units) in enumerate(variables):
            logging.debug("    %s = %g %s" % (name, metrics[i], units))

        assert_rel_error(self, metrics[0], 2870.64, 0.00001)
        assert_rel_error(self, metrics[1], 8.69595, 0.00001)
        assert_rel_error(self, metrics[2], 6.89906, 0.00001)
        assert_rel_error(self, metrics[3], 546.863, 0.00001)
        assert_rel_error(self, metrics[4], 511.839, 0.00001)
        assert_rel_error(self, metrics[5], -156.175, 0.00001)
        assert_rel_error(self, metrics[6], -271.477, 0.00001)
Exemplo n.º 2
0
    def test_adpac(self):
        # Verify correct metric values for data from real scenario.
        logging.debug('')
        logging.debug('test_adpac')

        domain = restart.read('lpc-test', logging.getLogger())
        regions = [('zone_1', 2, 2, 0, -1, 0, -1),
                   ('zone_2', 2, 2, 0, -1, 0, -1)]
        variables = [('area', 'inch**2'),
                     ('pressure_stagnation', 'psi'),
                     ('pressure', 'psi'),
                     ('temperature_stagnation', 'degR'),
                     ('temperature', 'degR'),
                     ('mass_flow', 'lbm/s'),
                     ('corrected_mass_flow', 'lbm/s')]
        metrics = mesh_probe(domain, regions, variables, 'mass')
        logging.debug('lpc-test I face data:')
        for i, (name, units) in enumerate(variables):
            logging.debug('    %s = %g %s' % (name, metrics[i], units))

        assert_rel_error(self, metrics[0], 830.494, 0.00001)
        assert_rel_error(self, metrics[1], 8.95673, 0.00001)
        assert_rel_error(self, metrics[2], 6.97191, 0.00001)
        assert_rel_error(self, metrics[3], 547.784, 0.00001)
        assert_rel_error(self, metrics[4], 509.909, 0.00001)
        assert_rel_error(self, metrics[5], 120.092, 0.00001)
        assert_rel_error(self, metrics[6], 202.570, 0.00001)

        regions = [('zone_1', 0, -1, 2, 2, 0, -1)]
        metrics = mesh_probe(domain, regions, variables, 'mass')
        logging.debug('lpc-test J face data:')
        for i, (name, units) in enumerate(variables):
            logging.debug('    %s = %g %s' % (name, metrics[i], units))

        assert_rel_error(self, metrics[0],  1089.77, 0.00001)
        assert_rel_error(self, metrics[1],  7.09975, 0.00001)
        assert_rel_error(self, metrics[2],  6.52045, 0.00001)
        assert_rel_error(self, metrics[3],  554.000, 0.00001)
        assert_rel_error(self, metrics[4],  540.770, 0.00001)
        assert_rel_error(self, metrics[5], 0.421583, 0.00001)
        assert_rel_error(self, metrics[6], 0.898204, 0.00001)

        regions = [('zone_1', 0, -1, 0, -1, 2, 2)]
        metrics = mesh_probe(domain, regions, variables, 'mass')
        logging.debug('lpc-test K face data:')
        for i, (name, units) in enumerate(variables):
            logging.debug('    %s = %g %s' % (name, metrics[i], units))

        assert_rel_error(self, metrics[0],  2870.64, 0.00001)
        assert_rel_error(self, metrics[1],  8.70534, 0.00001)
        assert_rel_error(self, metrics[2],  6.89906, 0.00001)
        assert_rel_error(self, metrics[3],  546.989, 0.00001)
        assert_rel_error(self, metrics[4],  511.875, 0.00001)
        assert_rel_error(self, metrics[5], -156.175, 0.00001)
        assert_rel_error(self, metrics[6], -270.858, 0.00001)

        surface = domain.extract([(0, -1, 0, -1, 2, 2)])
        surface.demote()
        regions = [('zone_1', 0, -1, 0, -1)]
        metrics = mesh_probe(surface, regions, variables, 'mass')
        # These are different than the above metrics since the extraction
        # doesn't average cell values on either side of the surface.
        assert_rel_error(self, metrics[0],  2870.64, 0.00001)
        assert_rel_error(self, metrics[1],  8.56340, 0.00001)
        assert_rel_error(self, metrics[2],  6.92024, 0.00001)
        assert_rel_error(self, metrics[3],  541.789, 0.00001)
        assert_rel_error(self, metrics[4],  509.850, 0.00001)
        assert_rel_error(self, metrics[5], -149.525, 0.00001)
        assert_rel_error(self, metrics[6], -262.976, 0.00001)