Changeset 22330
- Timestamp:
- 01/04/18 15:14:01 (7 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r22326 r22330 690 690 /*Intermediaries*/ 691 691 int domaintype; 692 IssmDouble phi,base_area ;692 IssmDouble phi,base_area,scalefactor,floatingarea; 693 693 IssmDouble xyz_list[NUMVERTICES][3]; 694 694 … … 703 703 base_area= 1./2.*fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1])); 704 704 705 floatingarea=(1-phi)*base_area; 706 707 if(scaled==true){ 708 Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 709 scalefactor_input->GetInputAverage(&scalefactor); 710 floatingarea=floatingarea*scalefactor; 711 } 712 705 713 /*Clean up and return*/ 706 return (1-phi)*base_area;714 return floatingarea; 707 715 } 708 716 /*}}}*/ … … 1164 1172 /*Intermediaries*/ 1165 1173 int domaintype; 1166 IssmDouble phi,base_area ;1174 IssmDouble phi,base_area,scalefactor,groundedarea; 1167 1175 IssmDouble xyz_list[NUMVERTICES][3]; 1168 1176 … … 1177 1185 base_area= 1./2.*fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1])); 1178 1186 1187 groundedarea=phi*base_area; 1188 1189 if(scaled==true){ 1190 Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 1191 scalefactor_input->GetInputAverage(&scalefactor); 1192 groundedarea=groundedarea*scalefactor; 1193 } 1179 1194 /*Clean up and return*/ 1180 return phi*base_area;1195 return groundedarea; 1181 1196 } 1182 1197 /*}}}*/ … … 1184 1199 1185 1200 /*The volume of a troncated prism is base * 1/3 sum(length of edges)*/ 1186 IssmDouble base,height ;1201 IssmDouble base,height,scalefactor; 1187 1202 IssmDouble xyz_list[NUMVERTICES][3]; 1188 1203 … … 1196 1211 base = 1./2.*fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1])); 1197 1212 1213 if(scaled==true){ //scale for area projection correction 1214 Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 1215 scalefactor_input->GetInputAverage(&scalefactor); 1216 base=base*scalefactor; 1217 } 1218 1198 1219 /*Now get the average height*/ 1199 1220 height = 1./3.*((xyz_list[3][2]-xyz_list[0][2])+(xyz_list[4][2]-xyz_list[1][2])+(xyz_list[5][2]-xyz_list[2][2])); … … 1207 1228 /*Volume above floatation: H + rho_water/rho_ice*bathymetry for nodes on the bed*/ 1208 1229 IssmDouble rho_ice,rho_water; 1209 IssmDouble base,bed,surface,bathymetry ;1230 IssmDouble base,bed,surface,bathymetry,scalefactor; 1210 1231 IssmDouble xyz_list[NUMVERTICES][3]; 1211 1232 … … 1220 1241 * base = 1/2 abs((xA-xC)(yB-yA)-(xA-xB)(yC-yA))*/ 1221 1242 base = 1./2.*fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1])); 1243 if(scaled==true){ 1244 Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 1245 scalefactor_input->GetInputAverage(&scalefactor); 1246 base=base*scalefactor; 1247 } 1222 1248 1223 1249 /*Now get the average height above floatation*/ … … 2639 2665 bool mainlyfloating; 2640 2666 IssmDouble fbmb=0; 2641 IssmDouble rho_ice,fraction1,fraction2,floatingmelt,Jdet ;2667 IssmDouble rho_ice,fraction1,fraction2,floatingmelt,Jdet,scalefactor; 2642 2668 IssmDouble Total_Fbmb=0; 2643 2669 IssmDouble xyz_list[NUMVERTICES][3]; … … 2650 2676 Input* floatingmelt_input = this->GetInput(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input); 2651 2677 Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input); 2678 Input* scalefactor_input = NULL; 2679 if(scaled==true){ 2680 scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 2681 } 2652 2682 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 2653 2683 … … 2660 2690 this->JacobianDeterminantBase(&Jdet,&xyz_list[0][0],gauss); 2661 2691 floatingmelt_input->GetInputValue(&floatingmelt,gauss); 2662 fbmb+=floatingmelt*Jdet*gauss->weight; 2692 if(scaled==true){ 2693 scalefactor_input->GetInputValue(&scalefactor,gauss); 2694 } 2695 else scalefactor=1; 2696 fbmb+=floatingmelt*Jdet*gauss->weight*scalefactor; 2663 2697 } 2664 2698 … … 2676 2710 bool mainlyfloating; 2677 2711 IssmDouble gbmb=0; 2678 IssmDouble rho_ice,fraction1,fraction2,groundedmelt,Jdet ;2712 IssmDouble rho_ice,fraction1,fraction2,groundedmelt,Jdet,scalefactor; 2679 2713 IssmDouble Total_Gbmb=0; 2680 2714 IssmDouble xyz_list[NUMVERTICES][3]; … … 2687 2721 Input* groundedmelt_input = this->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input); 2688 2722 Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input); 2723 Input* scalefactor_input = NULL; 2724 if(scaled==true){ 2725 scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 2726 } 2689 2727 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 2690 2728 … … 2697 2735 this->JacobianDeterminantBase(&Jdet,&xyz_list[0][0],gauss); 2698 2736 groundedmelt_input->GetInputValue(&groundedmelt,gauss); 2699 gbmb+=groundedmelt*Jdet*gauss->weight; 2737 if(scaled==true){ 2738 scalefactor_input->GetInputValue(&scalefactor,gauss); 2739 } 2740 else scalefactor=1; 2741 gbmb+=groundedmelt*Jdet*gauss->weight*scalefactor; 2700 2742 } 2701 2743 … … 2710 2752 2711 2753 /*The smb[Gt yr-1] of one element is area[m2] * smb [ m ice yr^-1] * rho_ice [kg m-3] / 1e+10^12 */ 2712 IssmDouble base,smb,rho_ice ;2754 IssmDouble base,smb,rho_ice,scalefactor; 2713 2755 IssmDouble Total_Smb=0; 2714 2756 IssmDouble xyz_list[NUMVERTICES][3]; … … 2730 2772 2731 2773 smb_input->GetInputAverage(&smb); 2732 Total_Smb=rho_ice*base*smb;// smb on element in kg s-1 2774 if(scaled==true){ 2775 Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 2776 scalefactor_input->GetInputAverage(&scalefactor);// average scalefactor on element 2777 } 2778 else{ 2779 scalefactor=1.; 2780 } 2781 Total_Smb=rho_ice*base*smb*scalefactor;// smb on element in kg s-1 2733 2782 2734 2783 /*Return: */ -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r22326 r22330 894 894 /*Intermediaries*/ 895 895 int domaintype; 896 IssmDouble phi ;896 IssmDouble phi,scalefactor,floatingarea; 897 897 IssmDouble *xyz_list = NULL; 898 898 … … 905 905 this->GetVerticesCoordinates(&xyz_list); 906 906 phi=this->GetGroundedPortion(xyz_list); 907 floatingarea=(1-phi)*this->GetArea(); 908 if(scaled==true){ 909 Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 910 scalefactor_input->GetInputAverage(&scalefactor); 911 floatingarea=floatingarea*scalefactor; 912 } 907 913 908 914 /*Clean up and return*/ 909 915 xDelete<IssmDouble>(xyz_list); 910 return (1-phi)*this->GetArea();916 return floatingarea; 911 917 } 912 918 /*}}}*/ … … 1614 1620 /*Intermediaries*/ 1615 1621 int domaintype; 1616 IssmDouble phi ;1622 IssmDouble phi,scalefactor,groundedarea; 1617 1623 IssmDouble *xyz_list = NULL; 1618 1624 … … 1625 1631 this->GetVerticesCoordinates(&xyz_list); 1626 1632 phi=this->GetGroundedPortion(xyz_list); 1633 groundedarea=phi*this->GetArea(); 1634 if(scaled==true){ 1635 Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 1636 scalefactor_input->GetInputAverage(&scalefactor); 1637 groundedarea=groundedarea*scalefactor; 1638 } 1627 1639 1628 1640 /*Clean up and return*/ 1629 1641 xDelete<IssmDouble>(xyz_list); 1630 return phi*this->GetArea();1642 return groundedarea; 1631 1643 } 1632 1644 /*}}}*/ … … 1679 1691 /*Intermediaries*/ 1680 1692 int i, numiceverts; 1681 IssmDouble area_base,surface,base,Haverage ;1693 IssmDouble area_base,surface,base,Haverage,scalefactor; 1682 1694 IssmDouble Haux[NUMVERTICES], surfaces[NUMVERTICES], bases[NUMVERTICES]; 1695 IssmDouble SFaux[NUMVERTICES], scalefactors[NUMVERTICES]; 1683 1696 IssmDouble s[2]; // s:fraction of intersected triangle edges, that lies inside ice 1684 1697 int* indices=NULL; 1685 1698 IssmDouble* H=NULL; 1699 IssmDouble* SF=NULL; 1686 1700 1687 1701 if(!IsIceInElement())return 0.; … … 1691 1705 1692 1706 if(false && IsIcefront()){ 1693 area_base=this->GetAreaIce();1694 1707 //Assumption: linear ice thickness profile on element. 1695 1708 //Hence ice thickness at intersection of levelset function with triangle edge is linear interpolation of ice thickness at vertices. 1696 1709 this->GetLevelsetIntersection(&indices, &numiceverts, s, MaskIceLevelsetEnum, 0.); 1710 int numthk=numiceverts+2; 1711 H=xNew<IssmDouble>(numthk); 1712 //Correct area distortion caused by projection if requestion 1713 area_base=this->GetAreaIce(); 1714 if(scaled==true){ 1715 GetInputListOnVertices(&scalefactors[0],MeshScaleFactorEnum); 1716 for(i=0;i<NUMVERTICES;i++) SFaux[i]= scalefactors[indices[i]]; //sort thicknesses in ice/noice 1717 switch(numiceverts){ 1718 case 1: // average over triangle 1719 SF[0]=SFaux[0]; 1720 SF[1]=SFaux[0]+s[0]*(SFaux[1]-SFaux[0]); 1721 SF[2]=SFaux[0]+s[1]*(SFaux[2]-SFaux[0]); 1722 break; 1723 case 2: // average over quadrangle 1724 SF[0]=SFaux[0]; 1725 SF[1]=SFaux[1]; 1726 SF[2]=SFaux[0]+s[0]*(SFaux[2]-SFaux[0]); 1727 SF[3]=SFaux[1]+s[1]*(SFaux[2]-SFaux[1]); 1728 break; 1729 default: 1730 _error_("Number of ice covered vertices wrong in Tria::IceVolume()"); 1731 break; 1732 } 1733 scalefactor=0.; 1734 for(i=0;i<numthk;i++) scalefactor+=SF[i]; 1735 scalefactor/=IssmDouble(numthk); 1736 area_base=area_base*scalefactor; 1737 } 1697 1738 GetInputListOnVertices(&surfaces[0],SurfaceEnum); 1698 1739 GetInputListOnVertices(&bases[0],BaseEnum); 1699 1740 for(i=0;i<NUMVERTICES;i++) Haux[i]= surfaces[indices[i]]-bases[indices[i]]; //sort thicknesses in ice/noice 1700 int numthk=numiceverts+2;1701 H=xNew<IssmDouble>(numthk);1702 1741 switch(numiceverts){ 1703 1742 case 1: // average over triangle … … 1723 1762 /*First get back the area of the base*/ 1724 1763 area_base=this->GetArea(); 1764 if(scaled==true){ 1765 Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 1766 scalefactor_input->GetInputAverage(&scalefactor); 1767 area_base=area_base*scalefactor; 1768 } 1725 1769 1726 1770 /*Now get the average height*/ … … 1735 1779 xDelete<int>(indices); 1736 1780 xDelete<IssmDouble>(H); 1781 xDelete<IssmDouble>(SF); 1737 1782 1738 1783 if(domaintype==Domain2DverticalEnum){ … … 1748 1793 /*The volume above floatation: H + rho_water/rho_ice * bathymetry */ 1749 1794 IssmDouble rho_ice,rho_water; 1750 IssmDouble base,surface,bed,bathymetry ;1795 IssmDouble base,surface,bed,bathymetry,scalefactor; 1751 1796 IssmDouble xyz_list[NUMVERTICES][3]; 1752 1797 … … 1761 1806 * base = 1/2 abs((xA-xC)(yB-yA)-(xA-xB)(yC-yA))*/ 1762 1807 base = 1./2. * fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1])); 1808 if(scaled==true){ 1809 Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 1810 scalefactor_input->GetInputAverage(&scalefactor); 1811 base=base*scalefactor; 1812 } 1763 1813 1764 1814 /*Now get the average height and bathymetry*/ … … 3121 3171 bool mainlyfloating; 3122 3172 IssmDouble fbmb=0; 3123 IssmDouble rho_ice,fraction1,fraction2,floatingmelt,Jdet ;3173 IssmDouble rho_ice,fraction1,fraction2,floatingmelt,Jdet,scalefactor; 3124 3174 IssmDouble Total_Fbmb=0; 3125 3175 IssmDouble xyz_list[NUMVERTICES][3]; … … 3132 3182 Input* floatingmelt_input = this->GetInput(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input); 3133 3183 Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input); 3184 Input* scalefactor_input = NULL; 3185 if(scaled==true){ 3186 scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 3187 } 3134 3188 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 3135 3189 … … 3142 3196 this->JacobianDeterminant(&Jdet,&xyz_list[0][0],gauss); 3143 3197 floatingmelt_input->GetInputValue(&floatingmelt,gauss); 3144 fbmb+=floatingmelt*Jdet*gauss->weight; 3198 if(scaled==true){ 3199 scalefactor_input->GetInputValue(&scalefactor,gauss); 3200 } 3201 else scalefactor=1; 3202 fbmb+=floatingmelt*Jdet*gauss->weight*scalefactor; 3145 3203 } 3146 3204 … … 3158 3216 bool mainlyfloating; 3159 3217 IssmDouble gbmb=0; 3160 IssmDouble rho_ice,fraction1,fraction2,groundedmelt,Jdet ;3218 IssmDouble rho_ice,fraction1,fraction2,groundedmelt,Jdet,scalefactor; 3161 3219 IssmDouble Total_Gbmb=0; 3162 3220 IssmDouble xyz_list[NUMVERTICES][3]; … … 3169 3227 Input* groundedmelt_input = this->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input); 3170 3228 Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input); 3229 Input* scalefactor_input = NULL; 3230 if(scaled==true){ 3231 scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 3232 } 3171 3233 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 3172 3234 … … 3179 3241 this->JacobianDeterminant(&Jdet,&xyz_list[0][0],gauss); 3180 3242 groundedmelt_input->GetInputValue(&groundedmelt,gauss); 3181 gbmb+=groundedmelt*Jdet*gauss->weight; 3243 if(scaled==true){ 3244 scalefactor_input->GetInputValue(&scalefactor,gauss); 3245 } 3246 else scalefactor=1; 3247 gbmb+=groundedmelt*Jdet*gauss->weight*scalefactor; 3182 3248 } 3183 3249 … … 3192 3258 3193 3259 /*The smb[kg yr-1] of one element is area[m2] * smb [kg m^-2 yr^-1]*/ 3194 IssmDouble base,smb,rho_ice ;3260 IssmDouble base,smb,rho_ice,scalefactor; 3195 3261 IssmDouble Total_Smb=0; 3196 3262 IssmDouble xyz_list[NUMVERTICES][3]; … … 3210 3276 /*Now get the average SMB over the element*/ 3211 3277 Input* smb_input = inputs->GetInput(SmbMassBalanceEnum); _assert_(smb_input); 3212 smb_input->GetInputAverage(&smb); // average smb on element in m ice s-1 3213 Total_Smb=rho_ice*base*smb; // smb on element in kg s-1 3278 smb_input->GetInputAverage(&smb); // average smb on element in m ice s-1 3279 if(scaled==true){ 3280 Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 3281 scalefactor_input->GetInputAverage(&scalefactor);// average scalefactor on element 3282 } 3283 else{ 3284 scalefactor=1.; 3285 } 3286 Total_Smb=rho_ice*base*smb*scalefactor; // smb on element in kg s-1 3214 3287 3215 3288 /*Return: */ -
issm/trunk-jpl/src/m/solve/parseresultsfrombuffer.js
r21674 r22330 99 99 else if (fieldname == 'BasalforcingsFloatingiceMeltingRate') for (var i=0;i<field.length;i++)field[i]= field[i]*yts; 100 100 else if (fieldname == 'TotalSmb') for (var i=0;i<field.length;i++)field[i]= field[i]/Math.pow(10,12)*yts; //(GigaTon/year) 101 else if (fieldname == 'TotalSmbScaled') for (var i=0;i<field.length;i++)field[i]= field[i]/Math.pow(10,12)*yts; //(GigaTon/year) 101 102 else if (fieldname == 'SmbMassBalance') for (var i=0;i<field.length;i++)field[i]= field[i]*yts; 102 103 else if (fieldname == 'SmbPrecipitation') for (var i=0;i<field.length;i++)field[i]= field[i]*yts; -
issm/trunk-jpl/src/m/solve/parseresultsfromdisk.m
r21674 r22330 183 183 elseif strcmp(fieldname,'TotalFloatingBmb'), 184 184 field = field/10.^12*yts; %(GigaTon/year) 185 elseif strcmp(fieldname,'TotalFloatingBmbScaled'), 186 field = field/10.^12*yts; %(GigaTon/year) 185 187 elseif strcmp(fieldname,'TotalGroundedBmb'), 186 188 field = field/10.^12*yts; %(GigaTon/year) 189 elseif strcmp(fieldname,'TotalGroundedBmbScaled'), 190 field = field/10.^12*yts; %(GigaTon/year) 187 191 elseif strcmp(fieldname,'TotalSmb'), 192 field = field/10.^12*yts; %(GigaTon/year) 193 elseif strcmp(fieldname,'TotalSmbScaled'), 188 194 field = field/10.^12*yts; %(GigaTon/year) 189 195 elseif strcmp(fieldname,'SmbMassBalance'), -
issm/trunk-jpl/src/m/solve/parseresultsfromdisk.py
r22267 r22330 193 193 elif fieldname=='TotalFloatingBmb': 194 194 field = field/10.**12*yts #(GigaTon/year) 195 elif fieldname=='TotalFloatingBmbScaled': 196 field = field/10.**12*yts #(GigaTon/year) 195 197 elif fieldname=='TotalGroundedBmb': 196 198 field = field/10.**12*yts #(GigaTon/year) 199 elif fieldname=='TotalGroundedBmbScaled': 200 field = field/10.**12*yts #(GigaTon/year) 197 201 elif fieldname=='TotalSmb': 202 field = field/10.**12*yts #(GigaTon/year) 203 elif fieldname=='TotalSmbScaled': 198 204 field = field/10.**12*yts #(GigaTon/year) 199 205 elif fieldname=='SmbMassBalance':
Note:
See TracChangeset
for help on using the changeset viewer.