[22755] | 1 | Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/c/classes/Elements/Tria.cpp (revision 22469)
|
---|
| 4 | +++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp (revision 22470)
|
---|
| 5 | @@ -811,7 +811,7 @@
|
---|
| 6 |
|
---|
| 7 | /*Update signed distance*/
|
---|
| 8 | dmin = sqrt(dmin);
|
---|
| 9 | - if(dmin>10000) dmin=10000;
|
---|
| 10 | + // if(dmin>10000) dmin=10000;
|
---|
| 11 | if(ls[j]>0){
|
---|
| 12 | ls[j] = dmin;
|
---|
| 13 | }
|
---|
| 14 | @@ -2736,6 +2736,99 @@
|
---|
| 15 | return TriaRef::NumberofNodes(this->VelocityInterpolation());
|
---|
| 16 | }
|
---|
| 17 | /*}}}*/
|
---|
| 18 | +void Tria::PicoUpdateBoxid(int* pmax_boxid_basin){/*{{{*/
|
---|
| 19 | +
|
---|
| 20 | + if(!this->IsIceInElement() || !this->IsFloating()) return;
|
---|
| 21 | +
|
---|
| 22 | + //Load inputs and params
|
---|
| 23 | + int i, boxid;
|
---|
| 24 | + int basin_id, boxid_max;
|
---|
| 25 | + IssmDouble dist_gl;
|
---|
| 26 | + IssmDouble dist_cf;
|
---|
| 27 | + IssmDouble rel_dist_gl;
|
---|
| 28 | +
|
---|
| 29 | + inputs->GetInputValue(&basin_id,BasalforcingsPicoBasinIdEnum);
|
---|
| 30 | + boxid_max=pmax_boxid_basin[basin_id]; //0-based
|
---|
| 31 | +
|
---|
| 32 | + Input* dist_gl_input=NULL;
|
---|
| 33 | + Input* dist_cf_input=NULL;
|
---|
| 34 | + dist_gl_input=inputs->GetInput(DistanceToGroundinglineEnum); _assert_(dist_gl_input);
|
---|
| 35 | + dist_cf_input=inputs->GetInput(DistanceToCalvingfrontEnum); _assert_(dist_cf_input);
|
---|
| 36 | +
|
---|
| 37 | + Gauss* gauss=this->NewGauss(1); gauss->GaussPoint(0);
|
---|
| 38 | + dist_gl_input->GetInputValue(&dist_gl,gauss);
|
---|
| 39 | + dist_cf_input->GetInputValue(&dist_cf,gauss);
|
---|
| 40 | +
|
---|
| 41 | + rel_dist_gl=dist_gl/(dist_gl+dist_cf);
|
---|
| 42 | +
|
---|
| 43 | + boxid=-1;
|
---|
| 44 | + for(i=0;i<boxid_max;i++){
|
---|
| 45 | + if(rel_dist_gl>=(1-sqrt((boxid_max-i)/boxid_max)) && rel_dist_gl<=(1-sqrt((boxid_max-i-1)/boxid_max))){
|
---|
| 46 | + boxid=i; break;
|
---|
| 47 | + }
|
---|
| 48 | + }
|
---|
| 49 | + if(boxid==-1){_error_("no boxid found for element" << this->Sid());}
|
---|
| 50 | +
|
---|
| 51 | + this->inputs->AddInput(new IntInput(BasalforcingsPicoBoxIdEnum, boxid));
|
---|
| 52 | +
|
---|
| 53 | + /*Cleanup & return: */
|
---|
| 54 | + delete gauss;
|
---|
| 55 | +}
|
---|
| 56 | +/*}}}*/
|
---|
| 57 | +void Tria::PicoUpdateFirstBox(){/*{{{*/
|
---|
| 58 | +
|
---|
| 59 | + IssmDouble rhoi, rhow, earth_grav, rho_star, nu, latentheat, c_p_ocean, lambda, a, b, c;
|
---|
| 60 | + IssmDouble alpha, Beta, gamma_T, overturning_coeff, t_farocean, s_farocean;
|
---|
| 61 | + IssmDouble basinid, boxid, thickness, toc_farocean, soc_farocean, area_box1;
|
---|
| 62 | + IssmDouble pressure, T_star, g1, s1, p_coeff, q_coeff, Toc, Soc, potential_pressure_melting_point;
|
---|
| 63 | + IssmDouble basalmeltrate_shelf, overturning, maxbox;
|
---|
| 64 | +
|
---|
| 65 | + //Get variables
|
---|
| 66 | + rhoi = this->GetMaterialParameter(MaterialsRhoIceEnum);
|
---|
| 67 | + rhow = this->GetMaterialParameter(MaterialsRhoSeawaterEnum);
|
---|
| 68 | + earth_grav = this->GetMaterialParameter(ConstantsGEnum);
|
---|
| 69 | + rho_star = 1033; //kg/m^3
|
---|
| 70 | + nu = rhoi/rhow;
|
---|
| 71 | + latentheat = this->GetMaterialParameter(MaterialsLatentheatEnum);
|
---|
| 72 | + c_p_ocean = this->GetMaterialParameter(MaterialsThermalExchangeVelocityEnum);
|
---|
| 73 | + lambda = latentheat/c_p_ocean;
|
---|
| 74 | + a = -0.0572; //K/psu
|
---|
| 75 | + b = 0.0788 + this->GetMaterialParameter(MaterialsMeltingpointEnum); //K
|
---|
| 76 | + c = this->GetMaterialParameter(MaterialsBetaEnum);
|
---|
| 77 | + alpha = 0.000075; //1/K
|
---|
| 78 | + Beta = 0.00077; //K
|
---|
| 79 | +
|
---|
| 80 | + this->parameters->FindParam(&gamma_T,BasalforcingsPicoGammaTEnum);
|
---|
| 81 | + this->parameters->FindParam(&overturning_coeff,BasalforcingsPicoOverturningCoeffEnum);
|
---|
| 82 | + this->parameters->FindParam(&t_farocean,BasalforcingsPicoFarOceanTemperatureEnum);
|
---|
| 83 | + this->parameters->FindParam(&s_farocean,BasalforcingsPicoFarOceanSalinityEnum);
|
---|
| 84 | +
|
---|
| 85 | + this->inputs->GetInputValue(&basinid,BasalforcingsPicoBasinIdEnum);
|
---|
| 86 | + this->inputs->GetInputValue(&boxid,BasalforcingsPicoBoxIdEnum);
|
---|
| 87 | + this->inputs->GetInputValue(&maxbox,BasalforcingsPicoMaxboxcountEnum);
|
---|
| 88 | + this->inputs->GetInputValue(&thickness,ThicknessEnum);
|
---|
| 89 | +
|
---|
| 90 | + toc_farocean = t_farocean[basinid];
|
---|
| 91 | + soc_farocean = s_farocean[basinid];
|
---|
| 92 | + area_box1 = areas[basinid*maxbox+boxid];
|
---|
| 93 | + pressure = (rhoi*earth_grav)*thickness;
|
---|
| 94 | + T_star = a*soc_farocean+b-c*pressure-toc_farocean;
|
---|
| 95 | + g1 = area_box1*gamma_T;
|
---|
| 96 | + s1 = soc_farocean/(nu*lambda);
|
---|
| 97 | + p_coeff = g1/(overturning_coeff*rho_star*(Beta*s1-alpha));
|
---|
| 98 | + q_coeff = T_star*(g1/(overturning_coeff*rho_star*(Beta*s1-alpha)));
|
---|
| 99 | + if ((0.25*(p_coeff)^(2) - q_coeff) < 0)
|
---|
| 100 | + {q_coeff = (0.25*(p_coeff)^(2))}
|
---|
| 101 | + Toc = toc_farocean-(-0.5*p_coeff+sqrt(0.25*p_coeff^(2)-q_coeff));
|
---|
| 102 | + Soc = soc_farocean-(soc_farocean/(nu*lambda))*(toc_farocean-Toc);
|
---|
| 103 | + potential_pressure_melting_point = a*Soc+b-c*pressure;
|
---|
| 104 | + basalmeltrate_shelf = (-gamma_T/(nu*lambda))*(potential_pressure_melting_point-Toc);
|
---|
| 105 | + overturning = overturning_coeff*rho_star*(Beta*(soc_farocean-Soc)-alpha*(toc_farocean-Toc));
|
---|
| 106 | +
|
---|
| 107 | + this->AddInput(BasalforcingsGroundediceMeltingRateEnum,basalmeltingrates,this->GetElementType());
|
---|
| 108 | +
|
---|
| 109 | +}
|
---|
| 110 | +/*}}}*/
|
---|
| 111 | void Tria::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){/*{{{*/
|
---|
| 112 |
|
---|
| 113 | IssmDouble h[NUMVERTICES],r[NUMVERTICES],gl[NUMVERTICES];
|
---|
| 114 | @@ -2967,7 +3060,7 @@
|
---|
| 115 | /*Get out if this is not an element input*/
|
---|
| 116 | if(!IsInput(control_enum)) return;
|
---|
| 117 |
|
---|
| 118 | - /*Prepare index list*/
|
---|
| 119 | + /*hrepare index list*/
|
---|
| 120 | GradientIndexing(&vertexpidlist[0],control_index);
|
---|
| 121 |
|
---|
| 122 | /*Get values on vertices*/
|
---|