source:
issm/oecreview/Archive/24307-24683/ISSM-24507-24508.diff@
24684
Last change on this file since 24684 was 24684, checked in by , 5 years ago | |
---|---|
File size: 5.4 KB |
-
../trunk-jpl/src/c/modules/SurfaceMassBalancex/Gembx.cpp
493 493 for(int i=0;i<m;i++)a[i] -= d_a[i]; // new albedo 494 494 495 495 // modification of albedo due to thin layer of snow or solid 496 // condensation (deposition) at the surface surface496 // condensation (deposition) at the surface 497 497 498 498 // check if condensation occurs & if it is deposited in solid phase 499 499 if ( EC > 0.0 + Dtol && T[0] < 0.0-Ttol) P = P + (EC/dSnow) * 1000.0; // add cond to precip [mm] … … 1339 1339 1340 1340 /*outputs:*/ 1341 1341 IssmDouble mAdd = 0.0; 1342 IssmDouble surplusE = 0.0; 1343 IssmDouble surplusT = 0.0; 1342 1344 IssmDouble dz_add = 0.0; 1343 1345 IssmDouble Rsum = 0.0; 1344 1346 IssmDouble* T=*pT; … … 1432 1434 1433 1435 int i = 0; 1434 1436 while (cellsum(surpE,n) > 0.0+Ttol && i<n){ 1435 // use surplus energy to increase the temperature of lower cell1436 T[i+1] = surpE[i]/m[i+1]/CI + T[i+1];1437 1437 1438 exsT[i+1] = max(0.0, T[i+1] - CtoK) + exsT[i+1]; 1439 T[i+1] = min(CtoK, T[i+1]); 1438 if (i<n-1){ 1439 // use surplus energy to increase the temperature of lower cell 1440 T[i+1] = surpE[i]/m[i+1]/CI + T[i+1]; 1440 1441 1441 surpT[i+1] = max(0.0, exsT[i+1] - LF/CI);1442 surpE[i+1] = surpT[i+1] * CI * m[i+1];1442 exsT[i+1] = max(0.0, T[i+1] - CtoK) + exsT[i+1]; 1443 T[i+1] = min(CtoK, T[i+1]); 1443 1444 1445 surpT[i+1] = max(0.0, exsT[i+1] - LF/CI); 1446 surpE[i+1] = surpT[i+1] * CI * m[i+1]; 1447 } 1448 else{ 1449 surplusT=max(0.0, exsT[i] - LF/CI); 1450 surplusE=surpE[i]; 1451 if(VerboseSmb() && sid==0 && IssmComm::GetRank()==0){ 1452 _printf0_(" WARNING: surplus energy at the base of GEMB column\n"); 1453 } 1454 } 1455 1444 1456 // adjust current cell properties (again 159.1342 is the max T) 1445 1457 exsT[i] = LF/CI; 1446 1458 surpE[i] = 0.0; … … 1648 1660 W[i+1] = W[i+1] + W[i]; // combine liquid water 1649 1661 m[i+1] = m_new; // combine top masses 1650 1662 1651 // set cell to 99999 for deletion1663 // set cell to -99999 for deletion 1652 1664 m[i] = Delflag; 1653 1665 } 1654 1666 } … … 1655 1667 1656 1668 //If last cell has to be merged 1657 1669 if(lastCellFlag){ 1658 1670 //find closest cell to merge with 1659 1671 for(int i=n-2;i>=0;i--){ 1660 1672 if(m[i]!=Delflag){ 1661 1673 X2=i; … … 1678 1690 W[X1] = W[X1] + W[X2]; // combine liquid water 1679 1691 m[X1] = m_new; // combine top masses 1680 1692 1681 // set cell to 99999 for deletion1693 // set cell to -99999 for deletion 1682 1694 m[X2] = Delflag; 1683 1695 } 1684 1696 … … 1703 1715 1704 1716 // check if any of the top 10 cell depths are too large 1705 1717 X=0; 1706 for(int i= 9;i>=0;i--){1718 for(int i=min(9,n-1);i>=0;i--){ 1707 1719 if(dz[i]> 2.0*dzMin+Dtol){ 1708 1720 X=i; 1709 1721 break; … … 1714 1726 while(j<=X){ 1715 1727 if (dz[j] > dzMin*2.0+Dtol){ 1716 1728 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1729 // _printf_("dz > dzMin * 2"); 1730 // split in two 1731 cellsplit(&dz, n, j,.5); 1732 cellsplit(&W, n, j,.5); 1733 cellsplit(&m, n, j,.5); 1734 cellsplit(&T, n, j,1.0); 1735 cellsplit(&d, n, j,1.0); 1736 cellsplit(&a, n, j,1.0); 1737 cellsplit(&EI, n, j,.5); 1738 cellsplit(&EW, n, j,.5); 1739 cellsplit(&re, n, j,1.0); 1740 cellsplit(&gdn, n, j,1.0); 1741 cellsplit(&gsp, n, j,1.0); 1742 n++; 1743 X=X+1; 1732 1744 } 1733 1745 else j++; 1734 1746 } … … 1816 1828 /*only in forward mode! avoid round in AD mode as it is not differentiable: */ 1817 1829 #ifndef _HAVE_AD_ 1818 1830 dm = round((mSum0 - mSum1 + mAdd)*100.0)/100.0; 1819 dE = round(sumE0 - sumE1 - sumER + addE );1831 dE = round(sumE0 - sumE1 - sumER + addE - surplusE); 1820 1832 if (dm !=0 || dE !=0) _error_("mass or energy are not conserved in melt equations\n" 1821 1833 << "dm: " << dm << " dE: " << dE << "\n"); 1822 1834 #endif … … 1977 1989 H = exp((-60000.0/(T[i] * R)) + (42400.0/(Tmean * R))) * (C * 9.81); 1978 1990 c0arth = 0.07 * H; 1979 1991 c1arth = 0.03 * H; 1992 //ERA-5 1993 //M0 = max(2.3999 - (0.2610 * log(C)),0.25); 1994 //M1 = max(2.7469 - (0.3228 * log(C)),0.25); 1995 //RACMO 1980 1996 M0 = max(1.6599 - (0.1724 * log(C)),0.25); 1981 1997 M1 = max(2.0102 - (0.2458 * log(C)),0.25); 1998 //From Ligtenberg 1999 //H = exp((-60000.0/(Tmean * R)) + (42400.0/(Tmean * R))) * (C * 9.81); 1982 2000 //M0 = max(1.435 - (0.151 * log(C)),0.25); 1983 2001 //M1 = max(2.366 - (0.293 * log(C)),0.25); 1984 2002 c0 = M0*c0arth; … … 1991 2009 H = exp((-60000.0/(T[i] * R)) + (42400.0/(Tmean * R))) * (C * 9.81); 1992 2010 c0arth = 0.07 * H; 1993 2011 c1arth = 0.03 * H; 2012 // ERA5 2013 //M0 = max(1.8920 - (0.1569 * log(C)),0.25); 2014 //M1 = max(2.5662 - (0.2274 * log(C)),0.25); 2015 // RACMO 2016 M0 = max(1.6201 - (0.1450 * log(C)),0.25); 2017 M1 = max(2.5577 - (0.2899 * log(C)),0.25); 2018 // From Kuipers Munneke 1994 2019 //M0 = max(1.042 - (0.0916 * log(C)),0.25); 1995 2020 //M1 = max(1.734 - (0.2039 * log(C)),0.25); 1996 M0 = max(1.6201 - (0.1450 * log(C)),0.25);1997 M1 = max(2.5577 - (0.2899 * log(C)),0.25);1998 2021 c0 = M0*c0arth; 1999 2022 c1 = M1*c1arth; 2000 2023 break;
Note:
See TracBrowser
for help on using the repository browser.