Esempio n. 1
0
class Iapws95ParameterBlockData(HelmholtzParameterBlockData):
    CONFIG = HelmholtzParameterBlockData.CONFIG()

    def build(self):
        self._set_parameters(
            library=_so,
            eos_tag="iapws95",
            state_block_class=Iapws95StateBlock,
            component_list=Set(initialize=["H2O"]),
            phase_equilibrium_idx=Set(initialize=[1]),
            phase_equilibrium_list={1: ["H2O", ("Vap", "Liq")]},
            mw=Param(initialize=0.01801528,
                     doc="Molecular weight [kg/mol]",
                     units=pyunits.kg / pyunits.mol),
            temperature_crit=Param(initialize=647.096,
                                   doc="Critical temperature [K]",
                                   units=pyunits.K),
            pressure_crit=Param(initialize=2.2064e7,
                                doc="Critical pressure [Pa]",
                                units=pyunits.Pa),
            dens_mass_crit=Param(initialize=322,
                                 doc="Critical density [kg/m3]",
                                 units=pyunits.kg / pyunits.m**3),
            specific_gas_constant=Param(
                initialize=461.51805,
                doc="Water Specific Gas Constant [J/kg/K]",
                units=pyunits.J / pyunits.kg / pyunits.K),
            pressure_bounds=(0.1, 1e9),
            temperature_bounds=(250, 2500),
            enthalpy_bounds=(0, 1e5),
        )
        super().build()
        # Thermal conductivity parameters.
        # "Release on the IAPWS Formulation 2011 for the Thermal Conductivity
        # of Ordinary Water Substance"
        self.tc_L0 = Param(RangeSet(0, 5),
                           initialize={
                               0: 2.443221e0,
                               1: 1.323095e1,
                               2: 6.770357e0,
                               3: -3.454586e0,
                               4: 4.096266e-1,
                           },
                           doc="0th order thermal conductivity parameters",
                           units=pyunits.K * pyunits.m / pyunits.W)

        self.tc_L1 = Param(
            RangeSet(0, 5),
            RangeSet(0, 6),
            initialize={
                (0, 0): 1.60397357,
                (1, 0): 2.33771842,
                (2, 0): 2.19650529,
                (3, 0): -1.21051378,
                (4, 0): -2.7203370,
                (0, 1): -0.646013523,
                (1, 1): -2.78843778,
                (2, 1): -4.54580785,
                (3, 1): 1.60812989,
                (4, 1): 4.57586331,
                (0, 2): 0.111443906,
                (1, 2): 1.53616167,
                (2, 2): 3.55777244,
                (3, 2): -0.621178141,
                (4, 2): -3.18369245,
                (0, 3): 0.102997357,
                (1, 3): -0.463045512,
                (2, 3): -1.40944978,
                (3, 3): 0.0716373224,
                (4, 3): 1.1168348,
                (0, 4): -0.0504123634,
                (1, 4): 0.0832827019,
                (2, 4): 0.275418278,
                (3, 4): 0.0,
                (4, 4): -0.19268305,
                (0, 5): 0.00609859258,
                (1, 5): -0.00719201245,
                (2, 5): -0.0205938816,
                (3, 5): 0.0,
                (4, 5): 0.012913842,
            },
            doc="1st order thermal conductivity parameters",
        )
        # Viscosity parameters
        # "Release on the IAPWS Formulation 2008 for the Viscosity of
        # Ordinary Water Substance "
        self.visc_H0 = Param(RangeSet(0, 4),
                             initialize={
                                 0: 1.67752,
                                 1: 2.20462,
                                 2: 0.6366564,
                                 3: -0.241605
                             },
                             doc="0th order viscosity parameters",
                             units=1 / pyunits.s / pyunits.Pa)

        self.visc_H1 = Param(
            RangeSet(0, 6),
            RangeSet(0, 7),
            initialize={
                (0, 0): 5.20094e-1,
                (1, 0): 8.50895e-2,
                (2, 0): -1.08374,
                (3, 0): -2.89555e-1,
                (4, 0): 0.0,
                (5, 0): 0.0,
                (0, 1): 2.22531e-1,
                (1, 1): 9.99115e-1,
                (2, 1): 1.88797,
                (3, 1): 1.26613,
                (4, 1): 0.0,
                (5, 1): 1.20573e-1,
                (0, 2): -2.81378e-1,
                (1, 2): -9.06851e-1,
                (2, 2): -7.72479e-1,
                (3, 2): -4.89837e-1,
                (4, 2): -2.57040e-1,
                (5, 2): 0.0,
                (0, 3): 1.61913e-1,
                (1, 3): 2.57399e-1,
                (2, 3): 0.0,
                (3, 3): 0.0,
                (4, 3): 0.0,
                (5, 3): 0.0,
                (0, 4): -3.25372e-2,
                (1, 4): 0.0,
                (2, 4): 0.0,
                (3, 4): 6.98452e-2,
                (4, 4): 0.0,
                (5, 4): 0.0,
                (0, 5): 0.0,
                (1, 5): 0.0,
                (2, 5): 0.0,
                (3, 5): 0.0,
                (4, 5): 8.72102e-3,
                (5, 5): 0.0,
                (0, 6): 0.0,
                (1, 6): 0.0,
                (2, 6): 0.0,
                (3, 6): -4.35673e-3,
                (4, 6): 0.0,
                (5, 6): -5.93264e-4,
            },
            doc="1st order viscosity parameters",
        )
        self.set_default_scaling("therm_cond_phase", 1e2, index="Liq")
        self.set_default_scaling("therm_cond_phase", 1e1, index="Vap")
        self.set_default_scaling("visc_d_phase", 1e5, index="Liq")
        self.set_default_scaling("visc_d_phase", 1e6, index="Vap")
        self.set_default_scaling("visc_k_phase", 1e5, index="Liq")
        self.set_default_scaling("visc_k_phase", 1e7, index="Vap")
Esempio n. 2
0
class SWCO2ParameterBlockData(HelmholtzParameterBlockData):
    CONFIG = HelmholtzParameterBlockData.CONFIG()

    def build(self):
        self._set_parameters(
            library=_so,
            eos_tag="swco2",
            state_block_class=SWCO2StateBlock,
            component_list=Set(initialize=["CO2"]),
            phase_equilibrium_idx=Set(initialize=[1]),
            phase_equilibrium_list={1: ["CO2", ("Vap", "Liq")]},
            mw=Param(initialize=0.0440098,
                     doc="Molecular weight [kg/mol]",
                     units=pyunits.kg / pyunits.mol),
            temperature_crit=Param(initialize=304.1282,
                                   doc="Critical temperature [K]",
                                   units=pyunits.K),
            pressure_crit=Param(initialize=7.377e6,
                                doc="Critical pressure [Pa]",
                                units=pyunits.Pa),
            dens_mass_crit=Param(initialize=467.6,
                                 doc="Critical density [kg/m3]",
                                 units=pyunits.kg / pyunits.m**3),
            specific_gas_constant=Param(
                initialize=188.9241,
                doc="CO2 Specific Gas Constant [J/kg/K]",
                units=pyunits.J / pyunits.kg / pyunits.K),
            pressure_bounds=(0.1, 1e9),
            temperature_bounds=(210, 2500),
            enthalpy_bounds=(-2e4, 1e5),
        )

        super().build()

        # Thermal conductivity parameters.
        # Vesovic et al. (1990)
        self.tc_b = Param(
            RangeSet(0, 8),
            initialize={
                0: 0.4226159,
                1: 0.6280115,
                2: -0.5387661,
                3: 0.6735941,
                4: 0,
                5: 0,
                6: -0.4362677,
                7: 0.2255388,
            },
            doc="0 density limit thermal conductivity parameters",
        )

        self.tc_c = Param(
            RangeSet(1, 6),
            initialize={
                1: 2.387869e-2,
                2: 4.350794,
                3: -10.33404,
                4: 7.981590,
                5: -1.940558,
            },
            doc="0 density limit thermal conductivity parameters",
        )

        self.tc_d_1 = Param(initialize=2.447164e-5 * self.dens_mass_crit,
                            doc="Residual thermal conductivity parameter",
                            units=pyunits.W / pyunits.K / pyunits.m)
        self.tc_d_2 = Param(initialize=8.705605e-8 * self.dens_mass_crit**2,
                            doc="Residual thermal conductivity parameter",
                            units=pyunits.W / pyunits.K / pyunits.m)
        self.tc_d_3 = Param(initialize=-6.547950e-11 * self.dens_mass_crit**3,
                            doc="Residual thermal conductivity parameter",
                            units=pyunits.W / pyunits.K / pyunits.m)
        self.tc_d_4 = Param(initialize=6.594919e-14 * self.dens_mass_crit**4,
                            doc="Residual thermal conductivity parameter",
                            units=pyunits.W / pyunits.K / pyunits.m)

        # Viscosity parameters
        # "Fenghour et al. (1998) with critial enhancment Vesovic et al. (1990)
        self.visc_a = Param(
            RangeSet(0, 5),
            initialize={
                0: 0.235156,
                1: -0.491266,
                2: 5.211155e-2,
                3: 5.347906e-2,
                4: -1.537102e-2,
            },
            doc="0 density limit viscosity parameters",
        )

        # The indexing looks a little weird here, but it's from the source
        self.visc_d_1_1 = Param(initialize=0.4071119e-8 * self.dens_mass_crit,
                                doc="Residual viscosity parameter",
                                units=pyunits.Pa * pyunits.s)
        self.visc_d_2_1 = Param(initialize=0.7198037e-10 *
                                self.dens_mass_crit**2,
                                doc="Residual viscosity parameter",
                                units=pyunits.Pa * pyunits.s)
        self.visc_d_6_4 = Param(initialize=0.2411697e-22 *
                                self.dens_mass_crit**6,
                                doc="Residual viscosity parameter",
                                units=pyunits.Pa * pyunits.s)
        self.visc_d_8_1 = Param(initialize=0.2971072e-28 *
                                self.dens_mass_crit**8,
                                doc="Residual viscosity parameter",
                                units=pyunits.Pa * pyunits.s)
        self.visc_d_8_2 = Param(initialize=-0.1627888e-28 *
                                self.dens_mass_crit**8,
                                doc="Residual viscosity parameter",
                                units=pyunits.Pa * pyunits.s)

        self.set_default_scaling("therm_cond_phase", 1e2, index="Liq")
        self.set_default_scaling("therm_cond_phase", 1e1, index="Vap")
        self.set_default_scaling("visc_d_phase", 1e5, index="Liq")
        self.set_default_scaling("visc_d_phase", 1e6, index="Vap")
        self.set_default_scaling("visc_k_phase", 1e5, index="Liq")
        self.set_default_scaling("visc_k_phase", 1e7, index="Vap")