1454 inline double SSP::gibbs(
int ns,
int nt,
int np,
double sa,
double t,
double p)
const
1456 double x2, x, y, z, g03, g08, return_value = 0.0;
1458 x2 = TEO_10_gsw_sfac*sa;
1463 if (ns == 0 && nt == 0 && np == 0) {
1464 g03 = 101.342743139674 + z*(100015.695367145 +
1465 z*(-2544.5765420363 + z*(284.517778446287 +
1466 z*(-33.3146754253611 + (4.20263108803084 -
1467 0.546428511471039*z)*z)))) +
1468 y*(5.90578347909402 + z*(-270.983805184062 +
1469 z*(776.153611613101 + z*(-196.51255088122 +
1470 (28.9796526294175 - 2.13290083518327*z)*z))) +
1471 y*(-12357.785933039 + z*(1455.0364540468 +
1472 z*(-756.558385769359 + z*(273.479662323528 +
1473 z*(-55.5604063817218 + 4.34420671917197*z)))) +
1474 y*(736.741204151612 + z*(-672.50778314507 +
1475 z*(499.360390819152 + z*(-239.545330654412 +
1476 (48.8012518593872 - 1.66307106208905*z)*z))) +
1477 y*(-148.185936433658 + z*(397.968445406972 +
1478 z*(-301.815380621876 + (152.196371733841 -
1479 26.3748377232802*z)*z)) +
1480 y*(58.0259125842571 + z*(-194.618310617595 +
1481 z*(120.520654902025 + z*(-55.2723052340152 +
1482 6.48190668077221*z))) +
1483 y*(-18.9843846514172 + y*(3.05081646487967 -
1484 9.63108119393062*z) +
1485 z*(63.5113936641785 + z*(-22.2897317140459 +
1486 8.17060541818112*z))))))));
1488 g08 = x2*(1416.27648484197 + z*(-3310.49154044839 +
1489 z*(384.794152978599 + z*(-96.5324320107458 +
1490 (15.8408172766824 - 2.62480156590992*z)*z))) +
1491 x*(-2432.14662381794 + x*(2025.80115603697 +
1492 y*(543.835333000098 + y*(-68.5572509204491 +
1493 y*(49.3667694856254 + y*(-17.1397577419788 +
1494 2.49697009569508*y))) - 22.6683558512829*z) +
1495 x*(-1091.66841042967 - 196.028306689776*y +
1496 x*(374.60123787784 - 48.5891069025409*x +
1497 36.7571622995805*y) + 36.0284195611086*z) +
1498 z*(-54.7919133532887 + (-4.08193978912261 -
1499 30.1755111971161*z)*z)) +
1500 z*(199.459603073901 + z*(-52.2940909281335 +
1501 (68.0444942726459 - 3.41251932441282*z)*z)) +
1502 y*(-493.407510141682 + z*(-175.292041186547 +
1503 (83.1923927801819 - 29.483064349429*z)*z) +
1504 y*(-43.0664675978042 + z*(383.058066002476 +
1505 z*(-54.1917262517112 + 25.6398487389914*z)) +
1506 y*(-10.0227370861875 - 460.319931801257*z +
1507 y*(0.875600661808945 + 234.565187611355*z))))) +
1508 y*(168.072408311545 + z*(729.116529735046 +
1509 z*(-343.956902961561 + z*(124.687671116248 +
1510 z*(-31.656964386073 + 7.04658803315449*z)))) +
1511 y*(880.031352997204 + y*(-225.267649263401 +
1512 y*(91.4260447751259 + y*(-21.6603240875311 +
1513 2.13016970847183*y) +
1514 z*(-297.728741987187 + (74.726141138756 -
1515 36.4872919001588*z)*z)) +
1516 z*(694.244814133268 + z*(-204.889641964903 +
1517 (113.561697840594 - 11.1282734326413*z)*z))) +
1518 z*(-860.764303783977 + z*(337.409530269367 +
1519 z*(-178.314556207638 + (44.2040358308 -
1520 7.92001547211682*z)*z))))));
1523 g08 = g08 + x2*(5812.81456626732 +
1524 851.226734946706*y)*log(x);
1526 return_value = g03 + g08;
1528 else if (ns == 1 && nt == 0 && np == 0) {
1529 g08 = 8645.36753595126 + z*(-6620.98308089678 +
1530 z*(769.588305957198 + z*(-193.0648640214916 +
1531 (31.6816345533648 - 5.24960313181984*z)*z))) +
1532 x*(-7296.43987145382 + x*(8103.20462414788 +
1533 y*(2175.341332000392 + y*(-274.2290036817964 +
1534 y*(197.4670779425016 + y*(-68.5590309679152 +
1535 9.98788038278032*y))) - 90.6734234051316*z) +
1536 x*(-5458.34205214835 - 980.14153344888*y +
1537 x*(2247.60742726704 - 340.1237483177863*x +
1538 220.542973797483*y) + 180.142097805543*z) +
1539 z*(-219.1676534131548 + (-16.32775915649044 -
1540 120.7020447884644*z)*z)) +
1541 z*(598.378809221703 + z*(-156.8822727844005 +
1542 (204.1334828179377 - 10.23755797323846*z)*z)) +
1543 y*(-1480.222530425046 + z*(-525.876123559641 +
1544 (249.57717834054571 - 88.449193048287*z)*z) +
1545 y*(-129.1994027934126 + z*(1149.174198007428 +
1546 z*(-162.5751787551336 + 76.9195462169742*z)) +
1547 y*(-30.0682112585625 - 1380.9597954037708*z +
1548 y*(2.626801985426835 + 703.695562834065*z))))) +
1549 y*(1187.3715515697959 + z*(1458.233059470092 +
1550 z*(-687.913805923122 + z*(249.375342232496 +
1551 z*(-63.313928772146 + 14.09317606630898*z)))) +
1552 y*(1760.062705994408 + y*(-450.535298526802 +
1553 y*(182.8520895502518 + y*(-43.3206481750622 +
1554 4.26033941694366*y) +
1555 z*(-595.457483974374 + (149.452282277512 -
1556 72.9745838003176*z)*z)) +
1557 z*(1388.489628266536 + z*(-409.779283929806 +
1558 (227.123395681188 - 22.2565468652826*z)*z))) +
1559 z*(-1721.528607567954 + z*(674.819060538734 +
1560 z*(-356.629112415276 + (88.4080716616 -
1561 15.84003094423364*z)*z)))));
1564 g08 = g08 + (11625.62913253464 + 1702.453469893412*y)*log(x);
1568 return_value = 0.5*TEO_10_gsw_sfac*g08;
1570 else if (ns == 0 && nt == 1 && np == 0) {
1571 g03 = 5.90578347909402 + z*(-270.983805184062 +
1572 z*(776.153611613101 + z*(-196.51255088122 +
1573 (28.9796526294175 - 2.13290083518327*z)*z))) +
1574 y*(-24715.571866078 + z*(2910.0729080936 +
1575 z*(-1513.116771538718 + z*(546.959324647056 +
1576 z*(-111.1208127634436 + 8.68841343834394*z)))) +
1577 y*(2210.2236124548363 + z*(-2017.52334943521 +
1578 z*(1498.081172457456 + z*(-718.6359919632359 +
1579 (146.4037555781616 - 4.9892131862671505*z)*z))) +
1580 y*(-592.743745734632 + z*(1591.873781627888 +
1581 z*(-1207.261522487504 + (608.785486935364 -
1582 105.4993508931208*z)*z)) +
1583 y*(290.12956292128547 + z*(-973.091553087975 +
1584 z*(602.603274510125 + z*(-276.361526170076 +
1585 32.40953340386105*z))) +
1586 y*(-113.90630790850321 + y*(21.35571525415769 -
1587 67.41756835751434*z) +
1588 z*(381.06836198507096 + z*(-133.7383902842754 +
1589 49.023632509086724*z)))))));
1591 g08 = x2*(168.072408311545 + z*(729.116529735046 +
1592 z*(-343.956902961561 + z*(124.687671116248 +
1593 z*(-31.656964386073 + 7.04658803315449*z)))) +
1594 x*(-493.407510141682 + x*(543.835333000098 +
1595 x*(-196.028306689776 + 36.7571622995805*x) +
1596 y*(-137.1145018408982 + y*(148.10030845687618 +
1597 y*(-68.5590309679152 + 12.4848504784754*y))) -
1598 22.6683558512829*z) + z*(-175.292041186547 +
1599 (83.1923927801819 - 29.483064349429*z)*z) +
1600 y*(-86.1329351956084 + z*(766.116132004952 +
1601 z*(-108.3834525034224 + 51.2796974779828*z)) +
1602 y*(-30.0682112585625 - 1380.9597954037708*z +
1603 y*(3.50240264723578 + 938.26075044542*z)))) +
1604 y*(1760.062705994408 + y*(-675.802947790203 +
1605 y*(365.7041791005036 + y*(-108.30162043765552 +
1606 12.78101825083098*y) +
1607 z*(-1190.914967948748 + (298.904564555024 -
1608 145.9491676006352*z)*z)) +
1609 z*(2082.7344423998043 + z*(-614.668925894709 +
1610 (340.685093521782 - 33.3848202979239*z)*z))) +
1611 z*(-1721.528607567954 + z*(674.819060538734 +
1612 z*(-356.629112415276 + (88.4080716616 -
1613 15.84003094423364*z)*z)))));
1616 g08 = g08 + 851.226734946706*x2*log(x);
1618 return_value = (g03 + g08)*0.025;
1620 else if (ns == 0 && nt == 0 && np == 1) {
1621 g03 = 100015.695367145 + z*(-5089.1530840726 +
1622 z*(853.5533353388611 + z*(-133.2587017014444 +
1623 (21.0131554401542 - 3.278571068826234*z)*z))) +
1624 y*(-270.983805184062 + z*(1552.307223226202 +
1625 z*(-589.53765264366 + (115.91861051767 -
1626 10.664504175916349*z)*z)) +
1627 y*(1455.0364540468 + z*(-1513.116771538718 +
1628 z*(820.438986970584 + z*(-222.2416255268872 +
1629 21.72103359585985*z))) +
1630 y*(-672.50778314507 + z*(998.720781638304 +
1631 z*(-718.6359919632359 + (195.2050074375488 -
1632 8.31535531044525*z)*z)) +
1633 y*(397.968445406972 + z*(-603.630761243752 +
1634 (456.589115201523 - 105.4993508931208*z)*z) +
1635 y*(-194.618310617595 + y*(63.5113936641785 -
1636 9.63108119393062*y +
1637 z*(-44.5794634280918 + 24.511816254543362*z)) +
1638 z*(241.04130980405 + z*(-165.8169157020456 +
1639 25.92762672308884*z)))))));
1641 g08 = x2*(-3310.49154044839 + z*(769.588305957198 +
1642 z*(-289.5972960322374 + (63.3632691067296 -
1643 13.1240078295496*z)*z)) +
1644 x*(199.459603073901 + x*(-54.7919133532887 +
1645 36.0284195611086*x - 22.6683558512829*y +
1646 (-8.16387957824522 - 90.52653359134831*z)*z) +
1647 z*(-104.588181856267 + (204.1334828179377 -
1648 13.65007729765128*z)*z) +
1649 y*(-175.292041186547 + (166.3847855603638 -
1650 88.449193048287*z)*z +
1651 y*(383.058066002476 + y*(-460.319931801257 +
1652 234.565187611355*y) +
1653 z*(-108.3834525034224 + 76.9195462169742*z)))) +
1654 y*(729.116529735046 + z*(-687.913805923122 +
1655 z*(374.063013348744 + z*(-126.627857544292 +
1656 35.23294016577245*z))) +
1657 y*(-860.764303783977 + y*(694.244814133268 +
1658 y*(-297.728741987187 + (149.452282277512 -
1659 109.46187570047641*z)*z) +
1660 z*(-409.779283929806 + (340.685093521782 -
1661 44.5130937305652*z)*z)) +
1662 z*(674.819060538734 + z*(-534.943668622914 +
1663 (176.8161433232 - 39.600077360584095*z)*z)))));
1665 return_value = (g03 + g08)*1.0e-8;
1667 else if (ns == 0 && nt == 2 && np == 0) {
1668 g03 = -24715.571866078 + z*(2910.0729080936 + z*
1669 (-1513.116771538718 + z*(546.959324647056 +
1670 z*(-111.1208127634436 + 8.68841343834394*z)))) +
1671 y*(4420.4472249096725 + z*(-4035.04669887042 +
1672 z*(2996.162344914912 + z*(-1437.2719839264719 +
1673 (292.8075111563232 - 9.978426372534301*z)*z))) +
1674 y*(-1778.231237203896 + z*(4775.621344883664 +
1675 z*(-3621.784567462512 + (1826.356460806092 -
1676 316.49805267936244*z)*z)) +
1677 y*(1160.5182516851419 + z*(-3892.3662123519 +
1678 z*(2410.4130980405 + z*(-1105.446104680304 +
1679 129.6381336154442*z))) +
1680 y*(-569.531539542516 + y*(128.13429152494615 -
1681 404.50541014508605*z) +
1682 z*(1905.341809925355 + z*(-668.691951421377 +
1683 245.11816254543362*z))))));
1685 g08 = x2*(1760.062705994408 + x*(-86.1329351956084 +
1686 x*(-137.1145018408982 + y*(296.20061691375236 +
1687 y*(-205.67709290374563 + 49.9394019139016*y))) +
1688 z*(766.116132004952 + z*(-108.3834525034224 +
1689 51.2796974779828*z)) +
1690 y*(-60.136422517125 - 2761.9195908075417*z +
1691 y*(10.50720794170734 + 2814.78225133626*z))) +
1692 y*(-1351.605895580406 + y*(1097.1125373015109 +
1693 y*(-433.20648175062206 + 63.905091254154904*y) +
1694 z*(-3572.7449038462437 + (896.713693665072 -
1695 437.84750280190565*z)*z)) +
1696 z*(4165.4688847996085 + z*(-1229.337851789418 +
1697 (681.370187043564 - 66.7696405958478*z)*z))) +
1698 z*(-1721.528607567954 + z*(674.819060538734 +
1699 z*(-356.629112415276 + (88.4080716616 -
1700 15.84003094423364*z)*z))));
1702 return_value = (g03 + g08)*0.000625;
1704 else if (ns == 1 && nt == 0 && np == 1) {
1705 g08 = -6620.98308089678 + z*(1539.176611914396 +
1706 z*(-579.1945920644748 + (126.7265382134592 -
1707 26.2480156590992*z)*z)) +
1708 x*(598.378809221703 + x*(-219.1676534131548 +
1709 180.142097805543*x - 90.6734234051316*y +
1710 (-32.65551831298088 - 362.10613436539325*z)*z) +
1711 z*(-313.764545568801 + (612.4004484538132 -
1712 40.95023189295384*z)*z) +
1713 y*(-525.876123559641 + (499.15435668109143 -
1714 265.347579144861*z)*z +
1715 y*(1149.174198007428 + y*(-1380.9597954037708 +
1716 703.695562834065*y) +
1717 z*(-325.1503575102672 + 230.7586386509226*z)))) +
1718 y*(1458.233059470092 + z*(-1375.827611846244 +
1719 z*(748.126026697488 + z*(-253.255715088584 +
1720 70.4658803315449*z))) +
1721 y*(-1721.528607567954 + y*(1388.489628266536 +
1722 y*(-595.457483974374 + (298.904564555024 -
1723 218.92375140095282*z)*z) +
1724 z*(-819.558567859612 + (681.370187043564 -
1725 89.0261874611304*z)*z)) +
1726 z*(1349.638121077468 + z*(-1069.887337245828 +
1727 (353.6322866464 - 79.20015472116819*z)*z))));
1729 return_value = g08*TEO_10_gsw_sfac*0.5e-8;
1731 else if (ns == 0 && nt == 1 && np == 1) {
1732 g03 = -270.983805184062 + z*(1552.307223226202 +
1733 z*(-589.53765264366 + (115.91861051767 -
1734 10.664504175916349*z)*z)) +
1735 y*(2910.0729080936 + z*(-3026.233543077436 +
1736 z*(1640.877973941168 + z*(-444.4832510537744 +
1737 43.4420671917197*z))) +
1738 y*(-2017.52334943521 + z*(2996.162344914912 +
1739 z*(-2155.907975889708 + (585.6150223126464 -
1740 24.946065931335752*z)*z)) +
1741 y*(1591.873781627888 + z*(-2414.523044975008 +
1742 (1826.356460806092 - 421.9974035724832*z)*z) +
1743 y*(-973.091553087975 + z*(1205.20654902025 +
1744 z*(-829.084578510228 + 129.6381336154442*z)) +
1745 y*(381.06836198507096 - 67.41756835751434*y +
1746 z*(-267.4767805685508 + 147.07089752726017*z))))));
1748 g08 = x2*(729.116529735046 + z*(-687.913805923122 +
1749 z*(374.063013348744 + z*(-126.627857544292 +
1750 35.23294016577245*z))) +
1751 x*(-175.292041186547 - 22.6683558512829*x +
1752 (166.3847855603638 - 88.449193048287*z)*z +
1753 y*(766.116132004952 + y*(-1380.9597954037708 +
1754 938.26075044542*y) +
1755 z*(-216.7669050068448 + 153.8390924339484*z))) +
1756 y*(-1721.528607567954 + y*(2082.7344423998043 +
1757 y*(-1190.914967948748 + (597.809129110048 -
1758 437.84750280190565*z)*z) +
1759 z*(-1229.337851789418 + (1022.055280565346 -
1760 133.5392811916956*z)*z)) +
1761 z*(1349.638121077468 + z*(-1069.887337245828 +
1762 (353.6322866464 - 79.20015472116819*z)*z))));
1764 return_value = (g03 + g08)*2.5e-10;
1766 else if (ns == 1 && nt == 1 && np == 0) {
1767 g08 = 1187.3715515697959 + z*(1458.233059470092 +
1768 z*(-687.913805923122 + z*(249.375342232496 +
1769 z*(-63.313928772146 + 14.09317606630898*z)))) +
1770 x*(-1480.222530425046 + x*(2175.341332000392 +
1771 x*(-980.14153344888 + 220.542973797483*x) +
1772 y*(-548.4580073635929 + y*(592.4012338275047 +
1773 y*(-274.2361238716608 + 49.9394019139016*y))) -
1774 90.6734234051316*z) +
1775 z*(-525.876123559641 + (249.57717834054571 -
1776 88.449193048287*z)*z) +
1777 y*(-258.3988055868252 + z*(2298.348396014856 +
1778 z*(-325.1503575102672 + 153.8390924339484*z)) +
1779 y*(-90.2046337756875 - 4142.8793862113125*z +
1780 y*(10.50720794170734 + 2814.78225133626*z)))) +
1781 y*(3520.125411988816 + y*(-1351.605895580406 +
1782 y*(731.4083582010072 + y*(-216.60324087531103 +
1783 25.56203650166196*y) +
1784 z*(-2381.829935897496 + (597.809129110048 -
1785 291.8983352012704*z)*z)) +
1786 z*(4165.4688847996085 + z*(-1229.337851789418 +
1787 (681.370187043564 - 66.7696405958478*z)*z))) +
1788 z*(-3443.057215135908 + z*(1349.638121077468 +
1789 z*(-713.258224830552 + (176.8161433232 -
1790 31.68006188846728*z)*z))));
1793 g08 = g08 + 1702.453469893412*log(x);
1795 return_value = 0.5*TEO_10_gsw_sfac*0.025*g08;
1797 else if (ns == 2 && nt == 0 && np == 0) {
1798 g08 = 2.0*(8103.20462414788 +
1799 y*(2175.341332000392 + y*(-274.2290036817964 +
1800 y*(197.4670779425016 + y*(-68.5590309679152 +
1801 9.98788038278032*y))) - 90.6734234051316*z) +
1802 1.5*x*(-5458.34205214835 - 980.14153344888*y +
1803 (4.0/3.0)*x*(2247.60742726704 - 340.1237483177863*1.25*x +
1804 220.542973797483*y) + 180.142097805543*z) +
1805 z*(-219.1676534131548 + (-16.32775915649044 -
1806 120.7020447884644*z)*z));
1809 g08 += (-7296.43987145382 + z*(598.378809221703 +
1810 z*(-156.8822727844005 + (204.1334828179377 -
1811 10.23755797323846*z)*z)) +
1812 y*(-1480.222530425046 + z*(-525.876123559641 +
1813 (249.57717834054571 - 88.449193048287*z)*z) +
1814 y*(-129.1994027934126 + z*(1149.174198007428 +
1815 z*(-162.5751787551336 + 76.9195462169742*z)) +
1816 y*(-30.0682112585625 - 1380.9597954037708*z +
1817 y*(2.626801985426835 + 703.695562834065*z)))))/x +
1818 (11625.62913253464 + 1702.453469893412*y)/x2;
1822 return_value = 0.25*TEO_10_gsw_sfac*TEO_10_gsw_sfac*g08;
1824 else if (ns == 0 && nt == 0 && np == 2) {
1825 g03 = -5089.1530840726 + z*(1707.1066706777221 +
1826 z*(-399.7761051043332 + (84.0526217606168 -
1827 16.39285534413117*z)*z)) +
1828 y*(1552.307223226202 + z*(-1179.07530528732 +
1829 (347.75583155301 - 42.658016703665396*z)*z) +
1830 y*(-1513.116771538718 + z*(1640.877973941168 +
1831 z*(-666.7248765806615 + 86.8841343834394*z)) +
1832 y*(998.720781638304 + z*(-1437.2719839264719 +
1833 (585.6150223126464 - 33.261421241781*z)*z) +
1834 y*(-603.630761243752 + (913.178230403046 -
1835 316.49805267936244*z)*z +
1836 y*(241.04130980405 + y*(-44.5794634280918 +
1837 49.023632509086724*z) +
1838 z*(-331.6338314040912 + 77.78288016926652*z))))));
1840 g08 = x2*(769.588305957198 + z*(-579.1945920644748 +
1841 (190.08980732018878 - 52.4960313181984*z)*z) +
1842 x*(-104.588181856267 + x*(-8.16387957824522 -
1843 181.05306718269662*z) +
1844 (408.2669656358754 - 40.95023189295384*z)*z +
1845 y*(166.3847855603638 - 176.898386096574*z +
1846 y*(-108.3834525034224 + 153.8390924339484*z))) +
1847 y*(-687.913805923122 + z*(748.126026697488 +
1848 z*(-379.883572632876 + 140.9317606630898*z)) +
1849 y*(674.819060538734 + z*(-1069.887337245828 +
1850 (530.4484299696 - 158.40030944233638*z)*z) +
1851 y*(-409.779283929806 + y*(149.452282277512 -
1852 218.92375140095282*z) +
1853 (681.370187043564 - 133.5392811916956*z)*z))));
1855 return_value = (g03 + g08)*1e-16 ;
1858 return_value = -HUGE_VAL;
1860 return (return_value);