Changeset 24505
- Timestamp:
- 01/09/20 11:17:17 (5 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/SealevelriseAnalysis.cpp
r24481 r24505 58 58 /*dynamic sea level: */ 59 59 iomodel->FetchData(&dslmodel,"md.dsl.model"); 60 if (dslmodel==1){ 60 if (dslmodel==1){ /*standard dsl model:{{{*/ 61 61 62 62 /*deal with global mean steric rate: */ … … 94 94 95 95 /*deal with dynamic sea level fields: */ 96 97 96 iomodel->FetchDataToInput(inputs2,elements,"md.dsl.sea_surface_height_change_above_geoid", DslSeaSurfaceHeightChangeAboveGeoidEnum); 98 97 iomodel->FetchDataToInput(inputs2,elements,"md.dsl.sea_water_pressure_change_at_sea_floor", DslSeaWaterPressureChangeAtSeaFloor); 99 98 100 //TransientInput2* transientinput=inputs2->SetDatasetTransientInput(DslGlobalAverageThermostericSeaLevelChangeEnum,counter, times,N); 101 } 99 } /*}}}*/ 100 else if (dslmodel==2){ /*multi-model ensemble dsl model:{{{*/ 101 102 /*variables:*/ 103 int nummodels; 104 IssmDouble** pstr=NULL; 105 IssmDouble* str=NULL; 106 IssmDouble* times = NULL; 107 int* pM = NULL; 108 int* pN = NULL; 109 int M,N; 110 111 /*deal with dsl.sea_surface_height_change_above_geoid {{{*/ 112 iomodel->FetchData(&pstr,&pM,&pN,&nummodels,"md.dsl.global_average_thermosteric_sea_level_change"); 113 114 /*go through the mat array and create a dataset of transient inputs:*/ 115 for (int i=0;i<nummodels;i++){ 116 117 M=pM[i]; 118 N=pN[i]; 119 str=pstr[i]; 120 121 //recover time vector: 122 times=xNew<IssmDouble>(N); 123 for(int t=0;t<N;t++) times[t] = str[(M-1)*N+t]; 124 125 TransientInput2* transientinput=inputs2->SetDatasetTransientInput(DslGlobalAverageThermostericSeaLevelChangeEnum,i, times,N); 126 127 for(int j=0;j<elements->Size();j++){ 128 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(j)); 129 130 for(int t=0;t<N;t++){ 131 switch(element->ObjectEnum()){ 132 case TriaEnum: transientinput->AddTriaTimeInput( t,1,&element->lid,&str[t],P0Enum); break; 133 case PentaEnum: transientinput->AddPentaTimeInput(t,1,&element->lid,&str[t],P0Enum); break; 134 default: _error_("Not implemented yet"); 135 } 136 } 137 } 138 xDelete<IssmDouble>(times); 139 } 140 /*Delete data:*/ 141 for(int i=0;i<nummodels;i++){ 142 IssmDouble* str=pstr[i]; 143 xDelete<IssmDouble>(str); 144 } 145 xDelete<IssmDouble*>(pstr); 146 xDelete<int>(pM); 147 xDelete<int>(pN); 148 /*}}}*/ 149 /*now do the same with the dsl.sea_surface_height_change_above_geoid field:{{{ */ 150 iomodel->FetchData(&pstr,&pM,&pN,&nummodels,"md.dsl.sea_surface_height_change_above_geoid"); 151 152 for (int i=0;i<nummodels;i++){ 153 M=pM[i]; 154 N=pN[i]; 155 str=pstr[i]; 156 157 158 //recover time vector: 159 times=xNew<IssmDouble>(N); 160 for(int t=0;t<N;t++) times[t] = str[(M-1)*N+t]; 161 162 TransientInput2* transientinput=inputs2->SetDatasetTransientInput(DslSeaSurfaceHeightChangeAboveGeoidEnum,i, times,N); 163 164 for(int j=0;j<elements->Size();j++){ 165 166 /*Get the right transient input*/ 167 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(j)); 168 169 /*Get values and lid list*/ 170 const int numvertices = element->GetNumberOfVertices(); 171 int *vertexlids = xNew<int>(numvertices); 172 int *vertexsids = xNew<int>(numvertices); 173 174 175 /*Recover vertices ids needed to initialize inputs*/ 176 _assert_(iomodel->elements); 177 for(int k=0;k<numvertices;k++){ 178 vertexsids[k] =reCast<int>(iomodel->elements[numvertices*element->Sid()+k]); //ids for vertices are in the elements array from Matlab 179 vertexlids[k]=iomodel->my_vertices_lids[vertexsids[k]-1]; 180 } 181 182 //element->GetVerticesLidList(vertexlids); 183 //element->GetVerticesSidList(vertexsids); 184 IssmDouble* values=xNew<IssmDouble>(numvertices); 185 186 for(int t=0;t<N;t++){ 187 for (int k=0;k<numvertices;k++)values[k]=str[N*vertexsids[k]+t]; 188 189 switch(element->ObjectEnum()){ 190 case TriaEnum: transientinput->AddTriaTimeInput( t,numvertices,vertexlids,values,P1Enum); break; 191 case PentaEnum: transientinput->AddPentaTimeInput(t,numvertices,vertexlids,values,P1Enum); break; 192 default: _error_("Not implemented yet"); 193 } 194 } 195 xDelete<IssmDouble>(values); 196 xDelete<int>(vertexlids); 197 xDelete<int>(vertexsids); 198 } 199 200 xDelete<IssmDouble>(times); 201 } 202 203 /*Delete data:*/ 204 for(int i=0;i<nummodels;i++){ 205 IssmDouble* str=pstr[i]; 206 xDelete<IssmDouble>(str); 207 } 208 xDelete<IssmDouble*>(pstr); 209 xDelete<int>(pM); 210 xDelete<int>(pN); 211 /*}}}*/ 212 /*now do the same with the dsl.sea_water_pressure_change_at_sea_floor field:{{{ */ 213 iomodel->FetchData(&pstr,&pM,&pN,&nummodels,"md.dsl.sea_water_pressure_change_at_sea_floor"); 214 215 for (int i=0;i<nummodels;i++){ 216 M=pM[i]; 217 N=pN[i]; 218 str=pstr[i]; 219 220 //recover time vector: 221 times=xNew<IssmDouble>(N); 222 for(int t=0;t<N;t++) times[t] = str[(M-1)*N+t]; 223 224 TransientInput2* transientinput=inputs2->SetDatasetTransientInput(DslSeaWaterPressureChangeAtSeaFloor,i, times,N); 225 226 for(int j=0;j<elements->Size();j++){ 227 228 /*Get the right transient input*/ 229 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(j)); 230 231 /*Get values and lid list*/ 232 const int numvertices = element->GetNumberOfVertices(); 233 int *vertexlids = xNew<int>(numvertices); 234 int *vertexsids = xNew<int>(numvertices); 235 236 237 /*Recover vertices ids needed to initialize inputs*/ 238 _assert_(iomodel->elements); 239 for(int k=0;k<numvertices;k++){ 240 vertexsids[k] =reCast<int>(iomodel->elements[numvertices*element->Sid()+k]); //ids for vertices are in the elements array from Matlab 241 vertexlids[k]=iomodel->my_vertices_lids[vertexsids[k]-1]; 242 } 243 //element->GetVerticesLidList(vertexlids); 244 //element->GetVerticesSidList(vertexsids); 245 246 IssmDouble* values=xNew<IssmDouble>(numvertices); 247 248 for(int t=0;t<N;t++){ 249 for (int k=0;k<numvertices;k++)values[k]=str[N*vertexsids[k]+t]; 250 251 switch(element->ObjectEnum()){ 252 case TriaEnum: transientinput->AddTriaTimeInput( t,numvertices,vertexlids,values,P1Enum); break; 253 case PentaEnum: transientinput->AddPentaTimeInput(t,numvertices,vertexlids,values,P1Enum); break; 254 default: _error_("Not implemented yet"); 255 } 256 } 257 xDelete<IssmDouble>(values); 258 xDelete<int>(vertexlids); 259 xDelete<int>(vertexsids); 260 } 261 xDelete<IssmDouble>(times); 262 } 263 264 /*Delete data:*/ 265 for(int i=0;i<nummodels;i++){ 266 IssmDouble* str=pstr[i]; 267 xDelete<IssmDouble>(str); 268 } 269 xDelete<IssmDouble*>(pstr); 270 xDelete<int>(pM); 271 xDelete<int>(pN); 272 /*}}}*/ 273 274 } /*}}}*/ 102 275 else _error_("Dsl model " << dslmodel << " not implemented yet!"); 103 276 … … 157 330 parameters->AddObject(iomodel->CopyConstantObject("md.slr.geodetic",SealevelriseGeodeticEnum)); 158 331 159 332 /*Deal with dsl multi-model ensembles: {{{*/ 333 iomodel->FetchData(&dslmodel,"md.dsl.model"); 334 parameters->AddObject(iomodel->CopyConstantObject("md.dsl.compute_fingerprints",DslComputeFingerprintsEnum)); 335 if(dslmodel==2){ 336 int modelid; 337 int nummodels; 338 339 parameters->AddObject(iomodel->CopyConstantObject("md.dsl.modelid",DslModelidEnum)); 340 parameters->AddObject(iomodel->CopyConstantObject("md.dsl.nummodels",DslNummodelsEnum)); 341 iomodel->FetchData(&modelid,"md.dsl.modelid"); 342 iomodel->FetchData(&nummodels,"md.dsl.nummodels"); 343 344 /*quick checks: */ 345 if(nummodels<=0)_error_("dslmme object in md.dsl field should contain at least 1 ensemble model!"); 346 if(modelid<=0 || modelid>nummodels)_error_("modelid field in dslmme object of md.dsl field should be between 1 and the number of ensemble runs!"); 347 } /*}}}*/ 160 348 /*Deal with elasticity {{{*/ 161 349 iomodel->FetchData(&elastic,"md.slr.elastic"); -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r24481 r24505 5555 5555 void Tria::SealevelriseEustatic(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){ /*{{{*/ 5556 5556 5557 /*Computational flags:*/ 5558 int bp_compute_fingerprints= 0; 5559 5560 /*some paramters first: */ 5561 this->parameters->FindParam(&bp_compute_fingerprints,DslComputeFingerprintsEnum); 5562 5563 if(!IsOceanInElement()){ 5564 /*ok, there is ocean in this element, we should compute eustatic loads for the ocean if we have requested 5565 *bottom pressure fingerprints:*/ 5566 if(bp_compute_fingerprints)this->SealevelriseEustaticBottomPressure(pSgi,peustatic,latitude,longitude,radius,oceanarea,eartharea); 5567 } 5568 if(!IsIceInElement()){ 5569 /*there is ice in this eleemnt, let's compute the eustatic response for ice changes:*/ 5570 this->SealevelriseEustaticIce(pSgi,peustatic,latitude,longitude,radius,oceanarea,eartharea); 5571 } 5572 5573 } 5574 /*}}}*/ 5575 void Tria::SealevelriseEustaticIce(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){ /*{{{*/ 5576 5557 5577 /*diverse:*/ 5558 5578 int gsize; … … 5583 5603 bool computeelastic= true; 5584 5604 bool scaleoceanarea= false; 5585 5605 5586 5606 /*early return if we are not on an ice cap:*/ 5587 5607 if(!IsIceOnlyInElement()){ … … 5591 5611 } 5592 5612 5593 /*early return if we are fully floating: 5613 /*early return if we are fully floating:*/ 5594 5614 Input2* gr_input=this->GetInput2(MaskGroundediceLevelsetEnum); _assert_(gr_input); 5595 5615 if (gr_input->GetInputMax()<=0){ … … 5599 5619 } 5600 5620 5601 /*If we are here, we are on ice that is fully grounded or half-way to floating: 5621 /*If we are here, we are on ice that is fully grounded or half-way to floating:*/ 5602 5622 if ((gr_input->GetInputMin())<0){ 5603 5623 notfullygrounded=true; //used later on. … … 5677 5697 } 5678 5698 5679 /*Compute ice thickness change: */5699 /*Compute ice thickness: */ 5680 5700 Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum); 5681 5701 if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!"); … … 5740 5760 /*Add all components to the pSgi or pSgo solution vectors:*/ 5741 5761 values[i]=3*rho_ice/rho_earth*area/eartharea*I*(G_rigid+G_elastic); 5762 } 5763 pSgi->SetValues(gsize,indices,values,ADD_VAL); 5764 5765 /*free ressources:*/ 5766 xDelete<IssmDouble>(values); 5767 xDelete<int>(indices); 5768 } 5769 5770 /*Assign output pointer:*/ 5771 _assert_(!xIsNan<IssmDouble>(eustatic)); 5772 _assert_(!xIsInf<IssmDouble>(eustatic)); 5773 *peustatic=eustatic; 5774 return; 5775 } 5776 /*}}}*/ 5777 void Tria::SealevelriseEustaticBottomPressure(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){ /*{{{*/ 5778 5779 /*diverse:*/ 5780 int gsize; 5781 bool spherical=true; 5782 IssmDouble llr_list[NUMVERTICES][3]; 5783 IssmDouble area; 5784 IssmDouble I; //change in ice thickness or water level(Farrel and Clarke, Equ. 4) 5785 IssmDouble rho; 5786 IssmDouble late,longe,re; 5787 IssmDouble lati,longi,ri; 5788 5789 /*elastic green function:*/ 5790 IssmDouble* G_elastic_precomputed=NULL; 5791 int M; 5792 5793 /*ice properties: */ 5794 IssmDouble rho_water,rho_earth; 5795 5796 /*constants:*/ 5797 IssmDouble constant=0; 5798 5799 /*Initialize eustatic component: do not skip this step :):*/ 5800 IssmDouble eustatic = 0.; 5801 5802 /*Computational flags:*/ 5803 bool computerigid = true; 5804 bool computeelastic= true; 5805 bool scaleoceanarea= false; 5806 bool bp_compute_fingerprints= false; 5807 5808 /*we are here to compute fingerprints originating fromn bottom pressure loads:*/ 5809 5810 /*Inform mask: */ 5811 constant=1; this->AddInput2(SealevelEustaticMaskEnum,&constant,P0Enum); 5812 5813 /*recover material parameters: */ 5814 rho_water=FindParam(MaterialsRhoFreshwaterEnum); 5815 rho_earth=FindParam(MaterialsEarthDensityEnum); 5816 5817 /*recover love numbers and computational flags: */ 5818 this->parameters->FindParam(&computerigid,SealevelriseRigidEnum); 5819 this->parameters->FindParam(&computeelastic,SealevelriseElasticEnum); 5820 this->parameters->FindParam(&scaleoceanarea,SealevelriseOceanAreaScalingEnum); 5821 5822 /*recover elastic green function:*/ 5823 if(computeelastic){ 5824 DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGElasticEnum)); 5825 _assert_(parameter); 5826 parameter->GetParameterValueByPointer(&G_elastic_precomputed,&M); 5827 } 5828 5829 /*how many dofs are we working with here? */ 5830 this->parameters->FindParam(&gsize,MeshNumberofverticesEnum); 5831 5832 /* Where is the centroid of this element?:{{{*/ 5833 5834 /*retrieve coordinates: */ 5835 ::GetVerticesCoordinates(&llr_list[0][0],this->vertices,NUMVERTICES,spherical); 5836 5837 IssmDouble minlong=400; 5838 IssmDouble maxlong=-20; 5839 for (int i=0;i<NUMVERTICES;i++){ 5840 llr_list[i][0]=(90-llr_list[i][0]); 5841 if(llr_list[i][1]<0)llr_list[i][1]=180+(180+llr_list[i][1]); 5842 if(llr_list[i][1]>maxlong)maxlong=llr_list[i][1]; 5843 if(llr_list[i][1]<minlong)minlong=llr_list[i][1]; 5844 } 5845 if(minlong==0 && maxlong>180){ 5846 if (llr_list[0][1]==0)llr_list[0][1]=360; 5847 if (llr_list[1][1]==0)llr_list[1][1]=360; 5848 if (llr_list[2][1]==0)llr_list[2][1]=360; 5849 } 5850 5851 // correction at the north pole 5852 if(llr_list[0][0]==0)llr_list[0][1]=(llr_list[1][1]+llr_list[2][1])/2.0; 5853 if(llr_list[1][0]==0)llr_list[1][1]=(llr_list[0][1]+llr_list[2][1])/2.0; 5854 if(llr_list[2][0]==0)llr_list[2][1]=(llr_list[0][1]+llr_list[1][1])/2.0; 5855 5856 //correction at the south pole 5857 if(llr_list[0][0]==180)llr_list[0][1]=(llr_list[1][1]+llr_list[2][1])/2.0; 5858 if(llr_list[1][0]==180)llr_list[1][1]=(llr_list[0][1]+llr_list[2][1])/2.0; 5859 if(llr_list[2][0]==180)llr_list[2][1]=(llr_list[0][1]+llr_list[1][1])/2.0; 5860 5861 late=(llr_list[0][0]+llr_list[1][0]+llr_list[2][0])/3.0; 5862 longe=(llr_list[0][1]+llr_list[1][1]+llr_list[2][1])/3.0; 5863 5864 late=90-late; 5865 if(longe>180)longe=(longe-180)-180; 5866 5867 late=late/180*PI; 5868 longe=longe/180*PI; 5869 /*}}}*/ 5870 5871 /*Compute area of element. For now, we dont do partially grounded elements:*/ 5872 area=GetAreaSpherical(); 5873 5874 /*Compute bottom pressure change: */ 5875 Input2* bottompressure_change_input=this->GetInput2(DslSeaWaterPressureChangeAtSeaFloor); 5876 if (!bottompressure_change_input)_error_("bottom pressure input needed to compute sea level rise fingerprint!"); 5877 5878 /*If we are fully grounded, take the average over the element: */ 5879 bottompressure_change_input->GetInputAverage(&I); 5880 5881 /*Compute eustatic compoent:*/ 5882 _assert_(oceanarea>0.); 5883 if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2 5884 5885 /*We do not need to add the bottom pressure component to the eustatic value: */ 5886 eustatic += 0; 5887 5888 if(computeelastic | computerigid){ 5889 int* indices=xNew<int>(gsize); 5890 IssmDouble* values=xNew<IssmDouble>(gsize); 5891 IssmDouble alpha; 5892 IssmDouble delPhi,delLambda; 5893 for(int i=0;i<gsize;i++){ 5894 indices[i]=i; 5895 5896 IssmDouble G_rigid=0; //do not remove =0! 5897 IssmDouble G_elastic=0; //do not remove =0! 5898 5899 /*Compute alpha angle between centroid and current vertex : */ 5900 lati=latitude[i]/180*PI; longi=longitude[i]/180*PI; 5901 5902 delPhi=fabs(lati-late); delLambda=fabs(longi-longe); 5903 alpha=2.*asin(sqrt(pow(sin(delPhi/2),2.0)+cos(lati)*cos(late)*pow(sin(delLambda/2),2))); 5904 5905 //Rigid earth gravitational perturbation: 5906 if(computerigid)G_rigid=1.0/2.0/sin(alpha/2.0); 5907 5908 //Elastic component (from Eq 17 in Adhikari et al, GMD 2015) 5909 if(computeelastic){ 5910 int index=reCast<int,IssmDouble>(alpha/PI*reCast<IssmDouble,int>(M-1)); 5911 G_elastic += G_elastic_precomputed[index]; 5912 } 5913 5914 /*Add all components to the pSgi or pSgo solution vectors:*/ 5915 values[i]=3*rho_water/rho_earth*area/eartharea*I*(G_rigid+G_elastic); 5742 5916 } 5743 5917 pSgi->SetValues(gsize,indices,values,ADD_VAL); -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r24481 r24505 167 167 void SealevelriseMomentOfInertia(IssmDouble* dI_list,IssmDouble* Sg_old,IssmDouble eartharea); 168 168 void SealevelriseEustatic(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea); 169 void SealevelriseEustaticIce(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea); 170 void SealevelriseEustaticBottomPressure(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea); 169 171 void SealevelriseNonEustatic(Vector<IssmDouble>* pSgo,IssmDouble* Sg_old,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble eartharea); 170 172 void SealevelriseGeodetic(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,IssmDouble* Sg,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx,IssmDouble* yy,IssmDouble* zz,IssmDouble eartharea,int horiz); -
issm/trunk-jpl/src/c/cores/sealevelrise_core.cpp
r24481 r24505 8 8 #include "../classes/Inputs2/TriaInput2.h" 9 9 #include "../classes/Inputs2/TransientInput2.h" 10 #include "../classes/Inputs2/DatasetInput2.h" 10 11 #include "../shared/shared.h" 11 12 #include "../modules/modules.h" … … 583 584 femmodel->inputs2->AddInput(tria_input_copy); 584 585 } 586 else if(dslmodel==2){ 587 588 int modelid; 589 590 /*Recover modelid:*/ 591 femmodel->parameters->FindParam(&modelid,DslModelidEnum); 592 modelid--; //from matlab. 593 594 /*find the DslSeaSurfaceHeightChangeAboveGeoidEnum dataset of transient inputs:*/ 595 DatasetInput2* dataset_input=femmodel->inputs2->GetDatasetInput2(DslSeaSurfaceHeightChangeAboveGeoidEnum); 596 597 /*Go find the modelid'th transient input:*/ 598 TriaInput2* tria_input=dataset_input->GetTriaInputByOffset(modelid); 599 600 /*Plug into DslDynamicRate input: */ 601 Input2* tria_input_copy=tria_input->copy(); 602 tria_input_copy->ChangeEnum(DslDynamicRateEnum); 603 femmodel->inputs2->AddInput(tria_input_copy); 604 } 585 605 else _error_("not implemented yet"); 586 606 … … 603 623 TransientInput2* transient_input = femmodel->inputs2->GetTransientInput(DslGlobalAverageThermostericSeaLevelChangeEnum); 604 624 TriaInput2* tria_input=transient_input->GetTriaInput(time); 625 Input2* tria_input_copy=tria_input->copy(); 626 tria_input_copy->ChangeEnum(DslStericRateEnum); 627 femmodel->inputs2->AddInput(tria_input_copy); 628 } 629 else if (dslmodel==2){ 630 int modelid; 631 632 /*Recover modelid:*/ 633 femmodel->parameters->FindParam(&modelid,DslModelidEnum); 634 635 modelid--; //from matlab. 636 637 /*find the DslGlobalAverageThermostericSeaLevelChangeEnum dataset of transient inputs:*/ 638 DatasetInput2* dataset_input=femmodel->inputs2->GetDatasetInput2(DslGlobalAverageThermostericSeaLevelChangeEnum); 639 640 /*Go find the modelid'th transient input:*/ 641 TriaInput2* tria_input=dataset_input->GetTriaInputByOffset(modelid); 642 643 /*Plug into DslStericRate input: */ 605 644 Input2* tria_input_copy=tria_input->copy(); 606 645 tria_input_copy->ChangeEnum(DslStericRateEnum); -
issm/trunk-jpl/src/c/shared/Enum/Enum.vim
r24481 r24505 130 130 syn keyword cConstant DomainTypeEnum 131 131 syn keyword cConstant DslModelEnum 132 syn keyword cConstant DslModelidEnum 133 syn keyword cConstant DslNummodelsEnum 134 syn keyword cConstant DslComputeFingerprintsEnum 132 135 syn keyword cConstant EarthIdEnum 133 136 syn keyword cConstant EplZigZagCounterEnum -
issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
r24481 r24505 124 124 DomainTypeEnum, 125 125 DslModelEnum, 126 DslModelidEnum, 127 DslNummodelsEnum, 128 DslComputeFingerprintsEnum, 126 129 EarthIdEnum, 127 130 EplZigZagCounterEnum, -
issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
r24481 r24505 132 132 case DomainTypeEnum : return "DomainType"; 133 133 case DslModelEnum : return "DslModel"; 134 case DslModelidEnum : return "DslModelid"; 135 case DslNummodelsEnum : return "DslNummodels"; 136 case DslComputeFingerprintsEnum : return "DslComputeFingerprints"; 134 137 case EarthIdEnum : return "EarthId"; 135 138 case EplZigZagCounterEnum : return "EplZigZagCounter"; -
issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
r24481 r24505 132 132 else if (strcmp(name,"DomainType")==0) return DomainTypeEnum; 133 133 else if (strcmp(name,"DslModel")==0) return DslModelEnum; 134 else if (strcmp(name,"DslModelid")==0) return DslModelidEnum; 135 else if (strcmp(name,"DslNummodels")==0) return DslNummodelsEnum; 136 else if (strcmp(name,"DslComputeFingerprints")==0) return DslComputeFingerprintsEnum; 134 137 else if (strcmp(name,"EarthId")==0) return EarthIdEnum; 135 138 else if (strcmp(name,"EplZigZagCounter")==0) return EplZigZagCounterEnum; 136 else if (strcmp(name,"EsaHElastic")==0) return EsaHElasticEnum;137 else if (strcmp(name,"EsaHemisphere")==0) return EsaHemisphereEnum;138 else if (strcmp(name,"EsaRequestedOutputs")==0) return EsaRequestedOutputsEnum;139 139 else stage=2; 140 140 } 141 141 if(stage==2){ 142 if (strcmp(name,"EsaUElastic")==0) return EsaUElasticEnum; 142 if (strcmp(name,"EsaHElastic")==0) return EsaHElasticEnum; 143 else if (strcmp(name,"EsaHemisphere")==0) return EsaHemisphereEnum; 144 else if (strcmp(name,"EsaRequestedOutputs")==0) return EsaRequestedOutputsEnum; 145 else if (strcmp(name,"EsaUElastic")==0) return EsaUElasticEnum; 143 146 else if (strcmp(name,"ExtrapolationVariable")==0) return ExtrapolationVariableEnum; 144 147 else if (strcmp(name,"FemModelComm")==0) return FemModelCommEnum; … … 257 260 else if (strcmp(name,"MaterialsLatentheat")==0) return MaterialsLatentheatEnum; 258 261 else if (strcmp(name,"MaterialsLithosphereDensity")==0) return MaterialsLithosphereDensityEnum; 259 else if (strcmp(name,"MaterialsLithosphereShearModulus")==0) return MaterialsLithosphereShearModulusEnum;260 else if (strcmp(name,"MaterialsMantleDensity")==0) return MaterialsMantleDensityEnum;261 else if (strcmp(name,"MaterialsMantleShearModulus")==0) return MaterialsMantleShearModulusEnum;262 262 else stage=3; 263 263 } 264 264 if(stage==3){ 265 if (strcmp(name,"MaterialsMeltingpoint")==0) return MaterialsMeltingpointEnum; 265 if (strcmp(name,"MaterialsLithosphereShearModulus")==0) return MaterialsLithosphereShearModulusEnum; 266 else if (strcmp(name,"MaterialsMantleDensity")==0) return MaterialsMantleDensityEnum; 267 else if (strcmp(name,"MaterialsMantleShearModulus")==0) return MaterialsMantleShearModulusEnum; 268 else if (strcmp(name,"MaterialsMeltingpoint")==0) return MaterialsMeltingpointEnum; 266 269 else if (strcmp(name,"MaterialsMixedLayerCapacity")==0) return MaterialsMixedLayerCapacityEnum; 267 270 else if (strcmp(name,"MaterialsMuWater")==0) return MaterialsMuWaterEnum; … … 380 383 else if (strcmp(name,"SmbRunoffalti")==0) return SmbRunoffaltiEnum; 381 384 else if (strcmp(name,"SmbRunoffgrad")==0) return SmbRunoffgradEnum; 382 else if (strcmp(name,"SmbRunoffref")==0) return SmbRunoffrefEnum;383 else if (strcmp(name,"SmbSealev")==0) return SmbSealevEnum;384 else if (strcmp(name,"SmbStepsPerStep")==0) return SmbStepsPerStepEnum;385 385 else stage=4; 386 386 } 387 387 if(stage==4){ 388 if (strcmp(name,"SmbSwIdx")==0) return SmbSwIdxEnum; 388 if (strcmp(name,"SmbRunoffref")==0) return SmbRunoffrefEnum; 389 else if (strcmp(name,"SmbSealev")==0) return SmbSealevEnum; 390 else if (strcmp(name,"SmbStepsPerStep")==0) return SmbStepsPerStepEnum; 391 else if (strcmp(name,"SmbSwIdx")==0) return SmbSwIdxEnum; 389 392 else if (strcmp(name,"SmbT0dry")==0) return SmbT0dryEnum; 390 393 else if (strcmp(name,"SmbT0wet")==0) return SmbT0wetEnum; … … 503 506 else if (strcmp(name,"CalvingrateyAverage")==0) return CalvingrateyAverageEnum; 504 507 else if (strcmp(name,"Calvingratey")==0) return CalvingrateyEnum; 505 else if (strcmp(name,"CalvingFluxLevelset")==0) return CalvingFluxLevelsetEnum;506 else if (strcmp(name,"CalvingMeltingFluxLevelset")==0) return CalvingMeltingFluxLevelsetEnum;507 else if (strcmp(name,"Converged")==0) return ConvergedEnum;508 508 else stage=5; 509 509 } 510 510 if(stage==5){ 511 if (strcmp(name,"CrevasseDepth")==0) return CrevasseDepthEnum; 511 if (strcmp(name,"CalvingFluxLevelset")==0) return CalvingFluxLevelsetEnum; 512 else if (strcmp(name,"CalvingMeltingFluxLevelset")==0) return CalvingMeltingFluxLevelsetEnum; 513 else if (strcmp(name,"Converged")==0) return ConvergedEnum; 514 else if (strcmp(name,"CrevasseDepth")==0) return CrevasseDepthEnum; 512 515 else if (strcmp(name,"DamageD")==0) return DamageDEnum; 513 516 else if (strcmp(name,"DamageDOld")==0) return DamageDOldEnum; … … 626 629 else if (strcmp(name,"LevelsetfunctionSlopeX")==0) return LevelsetfunctionSlopeXEnum; 627 630 else if (strcmp(name,"LevelsetfunctionSlopeY")==0) return LevelsetfunctionSlopeYEnum; 628 else if (strcmp(name,"LoadingforceX")==0) return LoadingforceXEnum;629 else if (strcmp(name,"LoadingforceY")==0) return LoadingforceYEnum;630 else if (strcmp(name,"LoadingforceZ")==0) return LoadingforceZEnum;631 631 else stage=6; 632 632 } 633 633 if(stage==6){ 634 if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum; 634 if (strcmp(name,"LoadingforceX")==0) return LoadingforceXEnum; 635 else if (strcmp(name,"LoadingforceY")==0) return LoadingforceYEnum; 636 else if (strcmp(name,"LoadingforceZ")==0) return LoadingforceZEnum; 637 else if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum; 635 638 else if (strcmp(name,"MaskIceLevelset")==0) return MaskIceLevelsetEnum; 636 639 else if (strcmp(name,"MaskLandLevelset")==0) return MaskLandLevelsetEnum; … … 749 752 else if (strcmp(name,"SmbMonthlytemperatures")==0) return SmbMonthlytemperaturesEnum; 750 753 else if (strcmp(name,"SmbNetLW")==0) return SmbNetLWEnum; 751 else if (strcmp(name,"SmbNetSW")==0) return SmbNetSWEnum;752 else if (strcmp(name,"SmbPAir")==0) return SmbPAirEnum;753 else if (strcmp(name,"SmbP")==0) return SmbPEnum;754 754 else stage=7; 755 755 } 756 756 if(stage==7){ 757 if (strcmp(name,"SmbPddfacIce")==0) return SmbPddfacIceEnum; 757 if (strcmp(name,"SmbNetSW")==0) return SmbNetSWEnum; 758 else if (strcmp(name,"SmbPAir")==0) return SmbPAirEnum; 759 else if (strcmp(name,"SmbP")==0) return SmbPEnum; 760 else if (strcmp(name,"SmbPddfacIce")==0) return SmbPddfacIceEnum; 758 761 else if (strcmp(name,"SmbPddfacSnow")==0) return SmbPddfacSnowEnum; 759 762 else if (strcmp(name,"SmbPrecipitation")==0) return SmbPrecipitationEnum; … … 872 875 else if (strcmp(name,"Outputdefinition23")==0) return Outputdefinition23Enum; 873 876 else if (strcmp(name,"Outputdefinition24")==0) return Outputdefinition24Enum; 874 else if (strcmp(name,"Outputdefinition25")==0) return Outputdefinition25Enum;875 else if (strcmp(name,"Outputdefinition26")==0) return Outputdefinition26Enum;876 else if (strcmp(name,"Outputdefinition27")==0) return Outputdefinition27Enum;877 877 else stage=8; 878 878 } 879 879 if(stage==8){ 880 if (strcmp(name,"Outputdefinition28")==0) return Outputdefinition28Enum; 880 if (strcmp(name,"Outputdefinition25")==0) return Outputdefinition25Enum; 881 else if (strcmp(name,"Outputdefinition26")==0) return Outputdefinition26Enum; 882 else if (strcmp(name,"Outputdefinition27")==0) return Outputdefinition27Enum; 883 else if (strcmp(name,"Outputdefinition28")==0) return Outputdefinition28Enum; 881 884 else if (strcmp(name,"Outputdefinition29")==0) return Outputdefinition29Enum; 882 885 else if (strcmp(name,"Outputdefinition2")==0) return Outputdefinition2Enum; … … 995 998 else if (strcmp(name,"CalvingHab")==0) return CalvingHabEnum; 996 999 else if (strcmp(name,"CalvingLevermann")==0) return CalvingLevermannEnum; 997 else if (strcmp(name,"CalvingVonmises")==0) return CalvingVonmisesEnum;998 else if (strcmp(name,"Cfdragcoeffabsgrad")==0) return CfdragcoeffabsgradEnum;999 else if (strcmp(name,"Cfsurfacelogvel")==0) return CfsurfacelogvelEnum;1000 1000 else stage=9; 1001 1001 } 1002 1002 if(stage==9){ 1003 if (strcmp(name,"Cfsurfacesquare")==0) return CfsurfacesquareEnum; 1003 if (strcmp(name,"CalvingVonmises")==0) return CalvingVonmisesEnum; 1004 else if (strcmp(name,"Cfdragcoeffabsgrad")==0) return CfdragcoeffabsgradEnum; 1005 else if (strcmp(name,"Cfsurfacelogvel")==0) return CfsurfacelogvelEnum; 1006 else if (strcmp(name,"Cfsurfacesquare")==0) return CfsurfacesquareEnum; 1004 1007 else if (strcmp(name,"Channel")==0) return ChannelEnum; 1005 1008 else if (strcmp(name,"ChannelArea")==0) return ChannelAreaEnum; … … 1118 1121 else if (strcmp(name,"ElementInput2")==0) return ElementInput2Enum; 1119 1122 else if (strcmp(name,"SegInput2")==0) return SegInput2Enum; 1120 else if (strcmp(name,"TriaInput2")==0) return TriaInput2Enum;1121 else if (strcmp(name,"PentaInput2")==0) return PentaInput2Enum;1122 else if (strcmp(name,"IntMatExternalResult")==0) return IntMatExternalResultEnum;1123 1123 else stage=10; 1124 1124 } 1125 1125 if(stage==10){ 1126 if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum; 1126 if (strcmp(name,"TriaInput2")==0) return TriaInput2Enum; 1127 else if (strcmp(name,"PentaInput2")==0) return PentaInput2Enum; 1128 else if (strcmp(name,"IntMatExternalResult")==0) return IntMatExternalResultEnum; 1129 else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum; 1127 1130 else if (strcmp(name,"IntParam")==0) return IntParamEnum; 1128 1131 else if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum; … … 1241 1244 else if (strcmp(name,"SMBd18opdd")==0) return SMBd18opddEnum; 1242 1245 else if (strcmp(name,"SMBforcing")==0) return SMBforcingEnum; 1243 else if (strcmp(name,"SMBgcm")==0) return SMBgcmEnum;1244 else if (strcmp(name,"SMBgemb")==0) return SMBgembEnum;1245 else if (strcmp(name,"SMBgradients")==0) return SMBgradientsEnum;1246 1246 else stage=11; 1247 1247 } 1248 1248 if(stage==11){ 1249 if (strcmp(name,"SMBgradientscomponents")==0) return SMBgradientscomponentsEnum; 1249 if (strcmp(name,"SMBgcm")==0) return SMBgcmEnum; 1250 else if (strcmp(name,"SMBgemb")==0) return SMBgembEnum; 1251 else if (strcmp(name,"SMBgradients")==0) return SMBgradientsEnum; 1252 else if (strcmp(name,"SMBgradientscomponents")==0) return SMBgradientscomponentsEnum; 1250 1253 else if (strcmp(name,"SMBgradientsela")==0) return SMBgradientselaEnum; 1251 1254 else if (strcmp(name,"SMBhenning")==0) return SMBhenningEnum; -
issm/trunk-jpl/src/m/classes/dsl.m
r24481 r24505 10 10 sea_surface_height_change_above_geoid; %corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr) 11 11 sea_water_pressure_change_at_sea_floor; %corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable rate (in mm/yr equivalent, not in Pa/yr!) for each ensemble 12 compute_fingerprints; %do we use the sea water pressure change to compute fingerprints and correct sea_surface_height_change_above_geoid 12 13 13 14 end … … 32 33 self.sea_surface_height_change_above_geoid=NaN; 33 34 self.sea_water_pressure_change_at_sea_floor=NaN; 35 self.compute_fingerprints=0; 34 36 35 37 end % }}} … … 38 40 %Early return 39 41 if ~ismember('SealevelriseAnalysis',analyses), return; end 42 if (strcmp(solution,'TransientSolution') & md.transient.isslr == 0), return; end 40 43 md = checkfield(md,'fieldname','dsl.global_average_thermosteric_sea_level_change','NaN',1,'Inf',1); 41 44 md = checkfield(md,'fieldname','dsl.sea_surface_height_change_above_geoid','NaN',1,'Inf',1,'timeseries',1); 42 45 md = checkfield(md,'fieldname','dsl.sea_water_pressure_change_at_sea_floor','NaN',1,'Inf',1,'timeseries',1); 46 md = checkfield(md,'fieldname','dsl.compute_fingerprints','NaN',1,'Inf',1,'values',[0,1]); 47 if self.compute_fingerprints, 48 %check geodetic flag of slr is on: 49 if md.slr.geodetic==0, 50 error('DSL checkconsistency error message: if bottom pressure fingerprints computations are requested, slr class should have geodetic flag on'); 51 end 52 end 43 53 44 54 end % }}} … … 49 59 fielddisplay(self,'sea_surface_height_change_above_geoid','corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr)'); 50 60 fielddisplay(self,'sea_water_pressure_change_at_sea_floor','corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable rate (in Pa/yr)'); 61 fielddisplay(self,'compute_fingerprints','%do we use the sea water pressure change to compute fingerprints and correct sea_surface_height_change_above_geoid'); 51 62 52 63 end % }}} … … 54 65 55 66 WriteData(fid,prefix,'name','md.dsl.model','data',1,'format','Integer'); 67 WriteData(fid,prefix,'object',self,'fieldname','compute_fingerprints','format','Integer'); 56 68 WriteData(fid,prefix,'object',self,'fieldname','global_average_thermosteric_sea_level_change','format','DoubleMat','mattype',1,'timeseries',1,'timeserieslength',2,'yts',md.constants.yts,'scale',1e-3/md.constants.yts); 57 69 WriteData(fid,prefix,'object',self,'fieldname','sea_water_pressure_change_at_sea_floor','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1e-3/md.constants.yts); … … 62 74 63 75 writejs1Darray(fid,[modelname '.dsl.global_average_thermosteric_sea_level_change'],self.global_average_thermosteric_sea_level_change); 76 writejs1Darray(fid,[modelname '.dsl.compute_fingerprints'],self.compute_fingerprints); 64 77 writejs1Darray(fid,[modelname '.dsl.sea_surface_height_change_above_geoid'],self.sea_surface_height_change_above_geoid); 65 78 writejs1Darray(fid,[modelname '.dsl.sea_water_pressure_change_at_sea_floor'],self.sea_water_pressure_change_at_sea_floor);
Note:
See TracChangeset
for help on using the changeset viewer.