Changeset 16816
- Timestamp:
- 11/18/13 00:55:32 (11 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Element.h
r16813 r16816 192 192 virtual void UpdateBasalConstraintsEnthalpy(void)=0; 193 193 virtual void ComputeBasalMeltingrate(void)=0; 194 virtual void DrainWaterfraction( void)=0;194 virtual void DrainWaterfraction(IssmDouble* drainrate_element)=0; 195 195 #endif 196 196 -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r16813 r16816 4750 4750 /* Intermediaries */ 4751 4751 bool isenthalpy, checkpositivethickness, istemperatelayer; 4752 int i,j, analysis_type;4752 int i,j,iv,analysis_type; 4753 4753 IssmDouble xyz_list[NUMVERTICES][3]; 4754 4754 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; … … 4764 4764 IssmDouble geothermalflux[NUMVERTICES]; 4765 4765 IssmDouble dt, yts; 4766 IssmDouble melting_overshoot,meltingrate_enthalpy; 4767 IssmDouble lambda,heating; 4766 IssmDouble melting_overshoot,meltingrate_enthalpy[NUMVERTICES2D]; 4767 IssmDouble drainrate_element[NUMVERTICES2D],drainrate_column[NUMVERTICES2D]; 4768 IssmDouble lambda,heating[NUMVERTICES2D]; 4768 4769 Friction *friction = NULL; 4770 Penta *penta = NULL; 4769 4771 4770 4772 /* Only compute melt rates at the base of grounded ice*/ … … 4795 4797 friction=new Friction("3d",inputs,matpar,analysis_type); 4796 4798 4797 /* Ok, get meltingrates now from basal conditions*/4799 /******** MELTING RATES ************************************/ 4798 4800 GaussPenta* gauss=new GaussPenta(); 4799 for(i nt iv=0;iv<3;iv++){4801 for(iv=0;iv<NUMVERTICES2D;iv++){ 4800 4802 4801 4803 gauss->GaussVertex(iv); … … 4805 4807 4806 4808 /*Calculate basal meltingrate after Fig.5 of A.Aschwanden 2012*/ 4807 meltingrate_enthalpy =0.;4808 heating =0.;4809 meltingrate_enthalpy[iv]=0.; 4810 heating[iv]=0.; 4809 4811 if((watercolumn[iv]>0.) && (enthalpy[iv]<matpar->PureIceEnthalpy(pressure[iv]))){ 4810 4812 /*ensure that no ice is at T<Tm(p), if water layer present*/ … … 4820 4822 /*ok, from here on all basal ice is temperate. Check for positive thickness of layer of temperate ice. */ 4821 4823 istemperatelayer=false; 4822 if(enthalpy[iv+ 3]>=matpar->PureIceEnthalpy(pressure[iv+3])) istemperatelayer=true;4824 if(enthalpy[iv+NUMVERTICES2D]>=matpar->PureIceEnthalpy(pressure[iv+NUMVERTICES2D])) istemperatelayer=true; 4823 4825 if(istemperatelayer) for(i=0;i<3;i++) vec_heatflux[i]=0.; // TODO: add -k*nabla T_pmp 4824 4826 else{ … … 4839 4841 matpar->EnthalpyToThermal(&temperature, &waterfraction, enthalpy[iv],pressure[iv]); 4840 4842 // -Mb= Fb-(q-q_geo)/((1-w)*L), cf Aschwanden 2012, eq.66 4841 heating=(heatflux+basalfriction+geothermalflux[iv]); 4842 meltingrate_enthalpy=heating/((1-waterfraction)*latentheat*rho_ice); // m/s water equivalent 4843 } 4844 4845 /*Update water column, basal meltingrate*/ 4846 this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); 4843 heating[iv]=(heatflux+basalfriction+geothermalflux[iv]); 4844 meltingrate_enthalpy[iv]=heating[iv]/((1-waterfraction)*latentheat*rho_ice); // m/s water equivalent 4845 } 4846 } 4847 // enthalpy might have been changed, update 4848 this->inputs->AddInput(new PentaInput(EnthalpyEnum,enthalpy,P1Enum)); 4849 4850 /******** DRAINAGE *****************************************/ 4851 for(iv=0; iv<NUMVERTICES2D; iv++) 4852 drainrate_column[iv]=0.; 4853 penta=this; 4854 4855 for(;;){ 4856 for(iv=0; iv<NUMVERTICES2D; iv++) drainrate_element[iv]=0.; 4857 penta->DrainWaterfraction(&drainrate_element[0]); // TODO: make sure every vertex is only drained once 4858 for(iv=0; iv<NUMVERTICES2D; iv++) drainrate_column[iv]+=drainrate_element[iv]; 4859 4860 if(penta->IsOnSurface()) break; 4861 penta=penta->GetUpperElement(); 4862 } 4863 // add drained water to melting rate 4864 for(iv=0; iv<NUMVERTICES2D;iv++) 4865 meltingrate_enthalpy[iv]+=drainrate_column[iv]; 4866 4867 /******** UPDATE MELTINGRATES AND WATERCOLUMN **************/ 4868 this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); 4869 for(iv=0;iv<NUMVERTICES2D;iv++){ 4847 4870 if(reCast<bool,IssmDouble>(dt)){ 4848 if(watercolumn[iv]+meltingrate_enthalpy *dt<0.){4849 melting_overshoot=watercolumn[iv]+meltingrate_enthalpy *dt;4850 lambda=melting_overshoot/(meltingrate_enthalpy *dt); _assert_(lambda>0); _assert_(lambda<1);4851 basalmeltingrate[iv]=(1.-lambda)*meltingrate_enthalpy ;4871 if(watercolumn[iv]+meltingrate_enthalpy[iv]*dt<0.){ 4872 melting_overshoot=watercolumn[iv]+meltingrate_enthalpy[iv]*dt; 4873 lambda=melting_overshoot/(meltingrate_enthalpy[iv]*dt); _assert_(lambda>0); _assert_(lambda<1); 4874 basalmeltingrate[iv]=(1.-lambda)*meltingrate_enthalpy[iv]; 4852 4875 watercolumn[iv]=0.; 4853 4876 yts=365*24*60*60; 4854 enthalpy[iv]+=dt/yts*lambda*heating ;4877 enthalpy[iv]+=dt/yts*lambda*heating[iv]; 4855 4878 } 4856 4879 else{ 4857 basalmeltingrate[iv]=meltingrate_enthalpy ;4858 watercolumn[iv]+=dt*meltingrate_enthalpy ;4880 basalmeltingrate[iv]=meltingrate_enthalpy[iv]; 4881 watercolumn[iv]+=dt*meltingrate_enthalpy[iv]; 4859 4882 } 4860 4883 } 4861 4884 else{ 4862 basalmeltingrate[iv]=meltingrate_enthalpy ;4863 watercolumn[iv]+=meltingrate_enthalpy ;4885 basalmeltingrate[iv]=meltingrate_enthalpy[iv]; 4886 watercolumn[iv]+=meltingrate_enthalpy[iv]; 4864 4887 } 4865 } 4888 4889 _assert_(watercolumn[iv]>=0.); 4890 } 4891 4866 4892 /*feed updated variables back into model*/ 4867 4893 this->inputs->AddInput(new PentaInput(EnthalpyEnum,enthalpy,P1Enum)); … … 4875 4901 /*}}}*/ 4876 4902 /*FUNCTION Penta::DrainWaterfraction{{{*/ 4877 void Penta::DrainWaterfraction( void){4903 void Penta::DrainWaterfraction(IssmDouble* drainrate_element){ 4878 4904 4879 4905 /*Intermediaries*/ 4880 4906 bool isenthalpy; 4907 int iv, index0; 4881 4908 IssmDouble waterfraction[NUMVERTICES], temperature[NUMVERTICES]; 4882 IssmDouble watercolumnbase[NUMVERTICES];4909 IssmDouble dw[NUMVERTICES]; 4883 4910 IssmDouble enthalpy[NUMVERTICES], pressure[NUMVERTICES]; 4884 IssmDouble latentheat, dt;4885 IssmDouble dw, dwc;4886 Penta *pentabase = NULL;4911 IssmDouble dt, height_element; 4912 IssmDouble xyz_list[NUMVERTICES][3]; 4913 IssmDouble rho_water, rho_ice; 4887 4914 4888 4915 /*Check wether enthalpy is activated*/ … … 4890 4917 if(!isenthalpy) return; 4891 4918 4892 /*get basal element, needed for basal watercolumn*/ 4893 pentabase=(Penta*)this->GetBasalElement(); 4894 4919 rho_ice=matpar->GetRhoIce(); 4920 rho_water=matpar->GetRhoFreshwater(); 4921 4922 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 4895 4923 this->GetInputListOnVertices(&enthalpy[0],EnthalpyEnum); 4896 4924 this->GetInputListOnVertices(&pressure[0],PressureEnum); 4897 pentabase->GetInputListOnVertices(&watercolumnbase[0], WatercolumnEnum);4898 4925 4899 4926 this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); 4900 latentheat=matpar->GetLatentHeat(); 4901 4902 for(int iv=0;iv<NUMVERTICES;iv++){ 4927 for(iv=0;iv<NUMVERTICES;iv++){ 4903 4928 matpar->EnthalpyToThermal(&temperature[iv],&waterfraction[iv], enthalpy[iv],pressure[iv]); 4904 dw=DrainageFunctionWaterfraction(waterfraction[iv], dt); 4905 /*drain water fraction & update enthalpy*/ 4906 waterfraction[iv]-=dw; 4907 matpar->ThermalToEnthalpy(&enthalpy[iv], temperature[iv], waterfraction[iv], pressure[iv]); 4908 /*add drained water to watercolumn at base*/ 4909 dwc=dw*this->IceVolume(); 4910 watercolumnbase[iv%NUMVERTICES2D]+=dwc; 4911 } 4912 4913 /*feed updated results back into model*/ 4929 dw[iv]=DrainageFunctionWaterfraction(waterfraction[iv], dt); 4930 } 4931 4932 /*drain waterfraction, feed updated variables back into model*/ 4933 for(iv=0;iv<NUMVERTICES;iv++){ 4934 if(reCast<bool,IssmDouble>(dt)) 4935 waterfraction[iv]-=dw[iv]*dt; 4936 else 4937 waterfraction[iv]-=dw[iv]; 4938 matpar->ThermalToEnthalpy(&enthalpy[iv], temperature[iv], waterfraction[iv], pressure[iv]); 4939 } 4914 4940 this->inputs->AddInput(new PentaInput(EnthalpyEnum,enthalpy,P1Enum)); 4915 4941 this->inputs->AddInput(new PentaInput(WaterfractionEnum,waterfraction,P1Enum)); 4916 pentabase->inputs->AddInput(new PentaInput(WatercolumnEnum, watercolumnbase,P1Enum)); 4917 4942 4943 /*return meltwater column equivalent to drained water*/ 4944 for(iv=0;iv<NUMVERTICES2D;iv++){ 4945 index0=(iv+NUMVERTICES2D); 4946 height_element=fabs(xyz_list[index0][2]-xyz_list[iv][2]); 4947 drainrate_element[iv]=(dw[iv]+dw[index0])/2.*rho_water/rho_ice*height_element; 4948 } 4918 4949 } 4919 4950 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r16813 r16816 378 378 void UpdateBasalConstraintsEnthalpy(void); 379 379 void ComputeBasalMeltingrate(void); 380 void DrainWaterfraction( void);380 void DrainWaterfraction(IssmDouble* drainrate_element); 381 381 #endif 382 382 -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r16813 r16816 142 142 void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");}; 143 143 void ComputeBasalMeltingrate(void){_error_("not implemented yet");}; 144 void DrainWaterfraction( void){_error_("not implemented yet");};144 void DrainWaterfraction(IssmDouble* drainrate_element){_error_("not implemented yet");}; 145 145 #endif 146 146 #ifdef _HAVE_HYDROLOGY_ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r16813 r16816 327 327 void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");}; 328 328 void ComputeBasalMeltingrate(void){_error_("not implemented yet");}; 329 void DrainWaterfraction( void){_error_("not implemented yet");};329 void DrainWaterfraction(IssmDouble* drainrate_element){_error_("not implemented yet");}; 330 330 #endif 331 331 -
issm/trunk-jpl/src/c/shared/Elements/DrainageFunctionWaterfraction.cpp
r16360 r16816 14 14 15 15 IssmDouble w0=0.01, w1=0.02, w2=0.03; 16 IssmDouble Dret, D0=0, D1=0.005, D2=0.05; 17 IssmDouble yts=365*24*60*60; 18 dt/=yts; 16 IssmDouble yts=365.*24.*60.*60.; 17 IssmDouble Dret, D0=0., D1=0.005/yts, D2=0.05/yts; 19 18 20 19 /*get drainage function value*/ 21 20 if((w0==w1)||(w1==w2)||(w0==w2)) 22 21 _error_("Error: equal ordinates in DrainageFunctionWaterfraction -> division by zero. Abort"); 22 23 23 if(waterfraction<=w0) 24 24 Dret=D0; 25 if((waterfraction>w0) && (waterfraction<=w1))25 else if((waterfraction>w0) && (waterfraction<=w1)) 26 26 Dret=(D1-D0)/(w1-w0)*(waterfraction-w0)+D0; 27 if((waterfraction>w1) && (waterfraction<=w2))27 else if((waterfraction>w1) && (waterfraction<=w2)) 28 28 Dret=(D2-D1)/(w2-w1)*(waterfraction-w1)+D1; 29 29 else 30 30 Dret=D2; 31 31 32 /* check if dt*Dret>waterfraction. If so, drain whole waterfraction*/32 /*drain only up to w0*/ 33 33 if(dt==0.){ 34 if(Dret>waterfraction) 35 return waterfraction; 34 if((waterfraction>w0) && (waterfraction-Dret*yts<w0)) 35 return waterfraction-w0; 36 else 37 return Dret*yts; 38 } 39 else{ 40 if((waterfraction>w0) && (waterfraction-dt*Dret<w0)) 41 return (waterfraction-w0)/dt; 36 42 else 37 43 return Dret; 38 44 } 39 else{40 if(dt*Dret>waterfraction)41 return waterfraction;42 else43 return dt*Dret;44 }45 45 } -
issm/trunk-jpl/src/c/shared/Elements/LliboutryDuval.cpp
r16322 r16816 36 36 37 37 /*check feasibility*/ 38 _assert_(pressure> 0);38 _assert_(pressure>=0); 39 39 _assert_(n>0); 40 _assert_(betaCC> 0);41 _assert_(referencetemperature> 0);40 _assert_(betaCC>=0); 41 _assert_(referencetemperature>=0); 42 42 _assert_(heatcapacity>0); 43 43 _assert_(latentheat>0); … … 58 58 Tstar=Tpmp; 59 59 waterfraction=(enthalpy - H_sp)/latentheat; 60 if (waterfraction > 0.01) 61 waterfraction = 0.01; 60 62 } 61 63 … … 75 77 return B; 76 78 } 77 78 // /*Get stiffness from temperature, waterfraction and depth*/79 // IssmDouble LliboutryDuval(IssmDouble temperature, IssmDouble waterfraction, IssmDouble depth,IssmDouble n){80 // /*Use parameterization for the rheology: Greve and Blatter 200981 // * get enthalpy from temperature and water fraction,82 // * and use LliboutryDuval(IssmDouble enthalpy, IssmDouble pressure,IssmDouble n) */83 //84 // /*TODO: update params from model*/85 // IssmDouble rho_ice=910; // kg/m^386 // IssmDouble g=9.81; //kg*m/s^287 // IssmDouble heatcapacity=2009; // J/kg/K88 // IssmDouble referencetemperature=253.15;89 // IssmDouble betaCC=7.9*pow(10.,-8.);90 // IssmDouble latentheat=3.34*pow(10,5.); // from Aschwanden 201291 //92 // IssmDouble Tstar, enthalpy, pressure, B;93 // _assert_(temperature>0);94 // _assert_(waterfraction>0);95 // _assert_(depth>0);96 //97 // /*get pressure*/98 // pressure= rho_ice*g*depth;99 // Tstar=temperature-betaCC*pressure; // TODO: check whether plus or minus100 // /*get enthalpy*/101 // if (Tstar < 273.15){102 // enthalpy=heatcapacity*(Tstar - referencetemperature);103 // }104 // else{105 // enthalpy=heatcapacity*(273.15 - referencetemperature) + waterfraction*latentheat;106 // }107 //108 // B=LliboutryDuval(enthalpy, pressure, n, betaCC, referencetemperature, heatcapacity, latentheat);109 //110 // return B;111 // }
Note:
See TracChangeset
for help on using the changeset viewer.