Exemplo n.º 1
0
    def test_integrateWithStep(self):
        tnow = 0.0
        tfinal = 0.25
        self.data = []
        while tnow < tfinal:
            tnow = self.sim.step(tfinal)
            self.data.append([tnow, self.combustor.temperature()] + list(self.combustor.moleFractions()))

        self.assertTrue(tnow >= tfinal)
        bad = utilities.compareTimeSeries(self.referenceFile, self.data, rtol=1e-3, atol=1e-9)
        self.assertFalse(bad, bad)
Exemplo n.º 2
0
    def test_integrateWithAdvance(self, saveReference=False):
        times = np.linspace(0, 0.25, 101)
        self.data = []
        for t in times[1:]:
            self.sim.advance(t)
            self.data.append([t, self.combustor.temperature()] + list(self.combustor.moleFractions()))

        if saveReference:
            np.savetxt(self.referenceFile, np.array(self.data), "%11.6e", ", ")
        else:
            bad = utilities.compareTimeSeries(self.referenceFile, self.data, rtol=1e-6, atol=1e-12)
            self.assertFalse(bad, bad)
Exemplo n.º 3
0
    def test_integrateWithStep(self):
        tnow = 0.0
        tfinal = 0.25
        self.data = []
        while tnow < tfinal:
            tnow = self.sim.step(tfinal)
            self.data.append([tnow, self.combustor.temperature()] +
                             list(self.combustor.moleFractions()))

        self.assertTrue(tnow >= tfinal)
        bad = utilities.compareTimeSeries(self.referenceFile,
                                          self.data,
                                          rtol=1e-3,
                                          atol=1e-9)
        self.assertFalse(bad, bad)
Exemplo n.º 4
0
    def test_integrateWithAdvance(self, saveReference=False):
        times = np.linspace(0, 0.25, 101)
        self.data = []
        for t in times[1:]:
            self.sim.advance(t)
            self.data.append([t, self.combustor.temperature()] +
                             list(self.combustor.moleFractions()))

        if saveReference:
            np.savetxt(self.referenceFile, np.array(self.data), '%11.6e', ', ')
        else:
            bad = utilities.compareTimeSeries(self.referenceFile,
                                              self.data,
                                              rtol=1e-6,
                                              atol=1e-12)
            self.assertFalse(bad, bad)
Exemplo n.º 5
0
    def test_integrateWithStep(self):
        tnow = 0.0
        tfinal = 0.01
        self.data = []
        while tnow < tfinal:
            tnow = self.sim.step(tfinal)
            self.data.append([tnow,
                              self.r1.temperature(),
                              self.r2.temperature(),
                              self.r1.pressure(),
                              self.r2.pressure(),
                              self.r1.volume(),
                              self.r2.volume()])

        self.assertTrue(tnow >= tfinal)
        bad = utilities.compareTimeSeries(self.referenceFile, self.data,
                                          rtol=1e-3, atol=1e-8)
        self.assertFalse(bad, bad)
Exemplo n.º 6
0
    def test_integrateWithAdvance(self, saveReference=False):
        times = np.linspace(0, 0.01, 200)
        self.data = []
        for t in times[1:]:
            self.sim.advance(t)
            self.data.append([t,
                              self.r1.temperature(),
                              self.r2.temperature(),
                              self.r1.pressure(),
                              self.r2.pressure(),
                              self.r1.volume(),
                              self.r2.volume()])

        if saveReference:
            np.savetxt(self.referenceFile, np.array(self.data), '%11.6e', ', ')
        else:
            bad = utilities.compareTimeSeries(self.referenceFile, self.data,
                                              rtol=2e-5, atol=1e-9)
            self.assertFalse(bad, bad)
Exemplo n.º 7
0
    def test_integrateWithStep(self):
        tnow = 0.0
        tfinal = 0.01
        self.data = []
        while tnow < tfinal:
            tnow = self.sim.step(tfinal)
            self.data.append([
                tnow,
                self.r1.temperature(),
                self.r2.temperature(),
                self.r1.pressure(),
                self.r2.pressure(),
                self.r1.volume(),
                self.r2.volume()
            ])

        self.assertTrue(tnow >= tfinal)
        bad = utilities.compareTimeSeries(self.referenceFile,
                                          self.data,
                                          rtol=1e-3,
                                          atol=1e-8)
        self.assertFalse(bad, bad)
Exemplo n.º 8
0
    def test_integrateWithAdvance(self, saveReference=False):
        times = np.linspace(0, 0.01, 200)
        self.data = []
        for t in times[1:]:
            self.sim.advance(t)
            self.data.append([
                t,
                self.r1.temperature(),
                self.r2.temperature(),
                self.r1.pressure(),
                self.r2.pressure(),
                self.r1.volume(),
                self.r2.volume()
            ])

        if saveReference:
            np.savetxt(self.referenceFile, np.array(self.data), '%11.6e', ', ')
        else:
            bad = utilities.compareTimeSeries(self.referenceFile,
                                              self.data,
                                              rtol=2e-5,
                                              atol=1e-9)
            self.assertFalse(bad, bad)