• # exemple script iapws97

    Posté par . En réponse au message accès aux fonctions iapws. Évalué à 1. Dernière modification le 11 novembre 2021 à 19:36.

    voila un exemple de la fonction dans script iapws97 ( que l'on peut pas importer par la formulation simple import iapws97 * , ca marche pas ?) l'aPPLI IAPWS comprend un folder fait de plusieurs scripts donc un "cache " ......
    voila extrait du script iapws97 con,tenat des fonctiosn non applables de facon simple ..

    def _PSat_T(T):
     """Define the saturated line, P=f(T)
     """
     # Check input parameters
     if T < 273.15 or T > Tc:
     raise NotImplementedError("Incoming out of bound")
     n = [0, 0.11670521452767E+04, -0.72421316703206E+06, -0.17073846940092E+02,
     0.12020824702470E+05, -0.32325550322333E+07, 0.14915108613530E+02,
     -0.48232657361591E+04, 0.40511340542057E+06, -0.23855557567849E+00,
     0.65017534844798E+03]
     tita = T+n[9]/(T-n[10])
     A = tita**2+n[1]*tita+n[2]
     B = n[3]*tita**2+n[4]*tita+n[5]
     C = n[6]*tita**2+n[7]*tita+n[8]
     return (2*C/(-B+(B**2-4*A*C)**0.5))**4
    def _TSat_P(P):
     """Define the saturated line, T=f(P)
     """
     # Check input parameters
     if P < 611.212677/1e6 or P > 22.064:
     raise NotImplementedError("Incoming out of bound")
     n = [0, 0.11670521452767E+04, -0.72421316703206E+06, -0.17073846940092E+02,
     0.12020824702470E+05, -0.32325550322333E+07, 0.14915108613530E+02,
     -0.48232657361591E+04, 0.40511340542057E+06, -0.23855557567849E+00,
     0.65017534844798E+03]
     beta = P**0.25
     E = beta**2+n[3]*beta+n[6]
     F = n[1]*beta**2+n[4]*beta+n[7]
     G = n[2]*beta**2+n[5]*beta+n[8]
     D = 2*G/(-F-(F**2-4*E*G)**0.5)
     return (n[10]+D-((n[10]+D)**2-4*(n[9]+n[10]*D))**0.5)/2