@@ -651,7 +651,7 @@ def viscosity_kinematic(self) -> Quantity:
651651 a0 = a1 = b0 = b1 = 0
652652
653653 # retrieve the parameters for the delta G equations
654- params = self .get_property (salt .formula , "model_parameters.viscosity_eyring" )
654+ params = None if salt is None else self .get_property (salt .formula , "model_parameters.viscosity_eyring" )
655655 if params is not None :
656656 a0 = ureg .Quantity (params ["a0" ]["value" ]).magnitude
657657 a1 = ureg .Quantity (params ["a1" ]["value" ]).magnitude
@@ -662,11 +662,16 @@ def viscosity_kinematic(self) -> Quantity:
662662 temperature = self .temperature .to ("degC" ).magnitude
663663 G_123 = a0 + a1 * (temperature ) ** 0.75
664664 G_23 = b0 + b1 * (temperature ) ** 0.5
665+
666+ # calculate the cation mole fraction
667+ # x_cat = self.get_amount(cation, "fraction")
668+ x_cat = self .get_amount (salt .cation , "fraction" ).magnitude
665669 else :
666670 # TODO - fall back to the Jones-Dole model! There are currently no eyring parameters in the database!
667671 # proceed with the coefficients equal to zero and log a warning
668- self .logger .warning (f"Viscosity coefficients for { salt . formula } not found. Viscosity will be approximate." )
672+ self .logger .warning (f"Appropriate viscosity coefficients werenot found. Viscosity will be approximate." )
669673 G_123 = G_23 = 0
674+ x_cat = 0
670675
671676 # get the kinematic viscosity of water, returned by IAPWS in m2/s
672677 nu_w = self .water_substance .nu
@@ -678,10 +683,6 @@ def viscosity_kinematic(self) -> Quantity:
678683 # get the MW of water
679684 MW_w = self .get_property (self .solvent , "molecular_weight" ).magnitude
680685
681- # calculate the cation mole fraction
682- # x_cat = self.get_amount(cation, "fraction")
683- x_cat = self .get_amount (salt .cation , "fraction" ).magnitude
684-
685686 # calculate the kinematic viscosity
686687 nu = np .log (nu_w * MW_w / MW ) + 15 * x_cat ** 2 + x_cat ** 3 * G_123 + 3 * x_cat * G_23 * (1 - 0.05 * x_cat )
687688
0 commit comments