Esempio n. 1
0
    def test_fluid_heat_transfer_rate(self):
        """ Tests the value of the fluid heat transfer rate for a single U-tube
            borehole.
        """
        from pygfunction.pipes import SingleUTube
        from pygfunction.boreholes import Borehole

        # Reference solution (Cimmino, 2016)
        # Fluid mass flow rate [kg/s]
        m_flow = np.array([0.2, 0.3])
        T_b = 1.0               # Borehole wall temperature [degC]
        # Outlet fluid temperature [degC]
        Tf_out = np.array([2.2161, 2.8394])
        # Inlet fluid temperature [degC]
        Tf_in = np.array([5.0, 5.0])
        # Total heat transfer rate [W]
        Qf_ref = m_flow*self.cp*(Tf_out - Tf_in)
        borehole = Borehole(self.H, 0., self.r_b, 0., 0.)

        # Calculate using pipes.SingleUTube()
        Qf = np.zeros_like(Qf_ref)
        for i in range(len(m_flow)):
            pos = [(-self.D_s, 0.), (self.D_s, 0.)]
            UTube = SingleUTube(pos, 0., self.r_out, borehole,
                                self.k_s, self.k_g, self.Rfp, J=0)
            # Obtain fluid heat transfer rate
            Qf[i] = UTube.get_fluid_heat_extraction_rate(Tf_in[i], T_b,
                                                        m_flow[i], self.cp)
        self.assertTrue(np.allclose(Qf, Qf_ref, rtol=1e-4, atol=1e-10),
                        msg='Incorrect value of fluid heat extraction rate.')
Esempio n. 2
0
    def test_outlet_fluid_temperature(self):
        """ Tests the value of the outlet fluid temperature for a single U-tube
            borehole.
        """
        from pygfunction.pipes import SingleUTube
        from pygfunction.boreholes import Borehole

        # Reference solution (Cimmino, 2016)
        # Fluid mass flow rate [kg/s]
        m_flow = np.array([0.2, 0.3])
        T_b = 1.0               # Borehole wall temperature [degC]
        Tf_in = 5.0             # Inlet fluid temperature [degC]
        borehole = Borehole(self.H, 0., self.r_b, 0., 0.)

        Tf_out_ref = np.array([2.2161, 2.8394])
        # Calculate using pipes.SingleUTube()
        Tf_out = np.zeros_like(Tf_out_ref)
        for i in range(len(m_flow)):
            pos = [(-self.D_s, 0.), (self.D_s, 0.)]
            UTube = SingleUTube(pos, 0., self.r_out, borehole,
                                self.k_s, self.k_g, self.Rfp, J=0)
            # Obtain outlet fluid temperature
            Tf_out[i] = UTube.get_outlet_temperature(Tf_in, T_b,
                                                     m_flow[i], self.cp)
        self.assertTrue(np.allclose(Tf_out, Tf_out_ref, rtol=1e-4, atol=1e-10),
                        msg='Incorrect value of outlet fluid temperatures.')
Esempio n. 3
0
    def test_one_borehole_twenty_four_segments(self, rel_tol=1.0e-4):
        """ Tests the value of the g-function of one borehole.
        """
        from pygfunction.pipes import SingleUTube
        from pygfunction.gfunction import equal_inlet_temperature
        from pygfunction.boreholes import rectangle_field

        # Pipe characteristics (will be overwritten by thermal resistances)
        r_out = 0.01
        r_in = 0.0075
        Ds = 0.06
        pos = [(-Ds, 0.), (Ds, 0.)]
        k_g = 1.5

        # Results of Cimmino (2015)
        # Number of line source segments per borehole
        nSegments = 24
        # Very large time values to approximate steady-state
        time = 1.0e20
        # Borehole thermal resistances [m.K/W]
        Rb = np.array([0.1, 0.3])
        # Borehole short-circuit resistance [m.K/W]
        Ra = 0.25
        g_ref = np.array([6.63770426518980, 6.65263629558422])

        # Calculation of the g-function at the same time values
        N_1 = 1
        N_2 = 1
        boreField = rectangle_field(N_1, N_2, self.B, self.B, self.H, self.D,
                                    self.r_b)
        g = np.zeros_like(g_ref)
        for i in range(len(Rb)):
            UTubes = [
                SingleUTube(pos, r_in, r_out, borehole, self.k_s, k_g, 0., J=0)
                for borehole in boreField
            ]
            # Overwrite borehole resistances
            Rd_00 = 2 * Rb[i]
            Rd_01 = 2 * Ra * Rd_00 / (2 * Rd_00 - Ra)
            for UTube in UTubes:
                UTube._Rd[0, 0] = Rd_00
                UTube._Rd[1, 1] = Rd_00
                UTube._Rd[0, 1] = Rd_01
                UTube._Rd[1, 0] = Rd_01
                UTube._update_model_variables(self.m_flow, self.cp, nSegments)
            g[i] = equal_inlet_temperature(boreField,
                                           UTubes,
                                           self.m_flow,
                                           self.cp,
                                           time,
                                           self.alpha,
                                           nSegments=nSegments)

        self.assertTrue(np.allclose(g, g_ref, rtol=rel_tol, atol=1e-10),
                        msg='Incorrect values of the g-function of one '
                        'borehole for equal inlet fluid temperature '
                        '(24 segments).')