Changeset 26296
- Timestamp:
- 06/04/21 16:35:40 (4 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/EsaAnalysis.cpp
r26047 r26296 61 61 /*some constant parameters: */ 62 62 parameters->AddObject(iomodel->CopyConstantObject("md.esa.hemisphere",EsaHemisphereEnum)); 63 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings. rigid",SolidearthSettingsRigidEnum));63 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.selfattraction",SolidearthSettingsSelfAttractionEnum)); 64 64 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.horiz",SolidearthSettingsHorizEnum)); 65 65 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.elastic",SolidearthSettingsElasticEnum)); -
issm/trunk-jpl/src/c/analyses/SealevelchangeAnalysis.cpp
r26283 r26296 92 92 int isexternal=0; 93 93 94 IssmDouble* G_ rigid= NULL;95 IssmDouble* G_ rigid_local = NULL;94 IssmDouble* G_gravi = NULL; 95 IssmDouble* G_gravi_local = NULL; 96 96 IssmDouble* G_viscoelastic = NULL; 97 97 IssmDouble* G_viscoelastic_interpolated = NULL; … … 108 108 IssmDouble planetradius=0; 109 109 IssmDouble planetarea=0; 110 bool rigid=false;110 bool selfattraction=false; 111 111 bool elastic=false; 112 112 bool viscous=false; … … 145 145 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.abstol",SolidearthSettingsAbstolEnum)); 146 146 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.maxiter",SolidearthSettingsMaxiterEnum)); 147 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings. rigid",SolidearthSettingsRigidEnum));147 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.selfattraction",SolidearthSettingsSelfAttractionEnum)); 148 148 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.horiz",SolidearthSettingsHorizEnum)); 149 149 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.elastic",SolidearthSettingsElasticEnum)); … … 153 153 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.rotational.polarmoi",RotationalPolarMoiEnum)); 154 154 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.rotational.angularvelocity",RotationalAngularVelocityEnum)); 155 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.grdocean",SolidearthSettingsGrdOceanEnum)); 155 156 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.ocean_area_scaling",SolidearthSettingsOceanAreaScalingEnum)); 156 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings. computesealevelchange",SolidearthSettingsComputesealevelchangeEnum));157 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.sealevelloading",SolidearthSettingsSealevelLoadingEnum)); 157 158 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.isgrd",SolidearthSettingsGRDEnum)); 158 159 parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.compute_bp_grd",SolidearthSettingsComputeBpGrdEnum)); … … 228 229 229 230 parameters->FindParam(&grdmodel,GrdModelEnum); 230 if(grdmodel !=IvinsEnum){231 if(grdmodel==ElasticEnum){ 231 232 /*Deal with elasticity {{{*/ 232 iomodel->FetchData(& rigid,"md.solidearth.settings.rigid");233 iomodel->FetchData(&selfattraction,"md.solidearth.settings.selfattraction"); 233 234 iomodel->FetchData(&elastic,"md.solidearth.settings.elastic"); 234 235 iomodel->FetchData(&viscous,"md.solidearth.settings.viscous"); … … 236 237 iomodel->FetchData(&horiz,"md.solidearth.settings.horiz"); 237 238 238 if( rigid){239 if(selfattraction){ 239 240 /*compute green functions for a range of angles*/ 240 241 iomodel->FetchData(°acc,"md.solidearth.settings.degacc"); … … 271 272 // // Providing "t" will cause ensurecontiguous to be called. 272 273 if(viscous){ 273 IssmDouble* stacktimes=NULL;274 IssmDouble* viscoustimes=NULL; 274 275 ntimesteps=precomputednt; 275 276 nt=reCast<int,IssmDouble>((final_time-start_time)/timeacc)+1; 276 277 277 parameters->AddObject(new IntParam(S tackNumStepsEnum,nt));278 /*Initialize stack times:*/279 stacktimes=xNew<IssmDouble>(nt);278 parameters->AddObject(new IntParam(SealevelchangeViscousNumStepsEnum,nt)); 279 /*Initialize viscous stack times:*/ 280 viscoustimes=xNew<IssmDouble>(nt); 280 281 for(int t=0;t<nt;t++){ 281 stacktimes[t]=start_time+timeacc*t;282 viscoustimes[t]=start_time+timeacc*t; 282 283 } 283 parameters->AddObject(new DoubleVecParam(S tackTimesEnum,stacktimes,nt));284 parameters->AddObject(new IntParam(S tackIndexEnum,0));285 xDelete<IssmDouble>( stacktimes);284 parameters->AddObject(new DoubleVecParam(SealevelchangeViscousTimesEnum,viscoustimes,nt)); 285 parameters->AddObject(new IntParam(SealevelchangeViscousIndexEnum,0)); 286 xDelete<IssmDouble>(viscoustimes); 286 287 } 287 288 else { … … 300 301 #endif 301 302 } 302 if( rigid){303 if(selfattraction){ 303 304 #ifdef _HAVE_AD_ 304 G_ rigid=xNew<IssmDouble>(M,"t");305 G_gravi=xNew<IssmDouble>(M,"t"); 305 306 #else 306 G_ rigid=xNew<IssmDouble>(M);307 G_gravi=xNew<IssmDouble>(M); 307 308 #endif 308 309 } … … 310 311 if(rotation)parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.lovenumbers.tk2secular",TidalLoveK2SecularEnum)); 311 312 312 if( rigid){313 if(selfattraction){ 313 314 314 315 /*compute combined legendre + love number (elastic green function:*/ … … 327 328 #endif 328 329 } 329 if( rigid){330 if(selfattraction){ 330 331 #ifdef _HAVE_AD_ 331 G_ rigid_local=xNew<IssmDouble>(m,"t");332 G_gravi_local=xNew<IssmDouble>(m,"t"); 332 333 #else 333 G_ rigid_local=xNew<IssmDouble>(m);334 G_gravi_local=xNew<IssmDouble>(m); 334 335 #endif 335 336 } 336 337 337 if( rigid){338 if(selfattraction){ 338 339 for(int i=lower_row;i<upper_row;i++){ 339 340 IssmDouble alpha,x; 340 341 alpha= reCast<IssmDouble>(i)*degacc * M_PI / 180.0; 341 G_ rigid_local[i-lower_row]= .5/sin(alpha/2.0);342 G_gravi_local[i-lower_row]= .5/sin(alpha/2.0); 342 343 } 343 344 } … … 348 349 349 350 for(int t=0;t<ntimesteps;t++){ 350 G_viscoelastic_local[(i-lower_row)*ntimesteps+t]= (love_k[(ndeg-1)*precomputednt+t]-love_h[(ndeg-1)*precomputednt+t])*G_ rigid_local[i-lower_row];351 U_viscoelastic_local[(i-lower_row)*ntimesteps+t]= (love_h[(ndeg-1)*precomputednt+t])*G_ rigid_local[i-lower_row];351 G_viscoelastic_local[(i-lower_row)*ntimesteps+t]= (love_k[(ndeg-1)*precomputednt+t]-love_h[(ndeg-1)*precomputednt+t])*G_gravi_local[i-lower_row]; 352 U_viscoelastic_local[(i-lower_row)*ntimesteps+t]= (love_h[(ndeg-1)*precomputednt+t])*G_gravi_local[i-lower_row]; 352 353 if(horiz)H_viscoelastic_local[(i-lower_row)*ntimesteps+t]= 0; 353 354 } … … 392 393 } 393 394 } 394 if( rigid){395 if(selfattraction){ 395 396 396 397 /*merge G_viscoelastic_local into G_viscoelastic; U_viscoelastic_local into U_viscoelastic; H_viscoelastic_local to H_viscoelastic:{{{*/ … … 400 401 int offset; 401 402 402 //deal with rigidfirst:403 //deal with selfattraction first: 403 404 ISSM_MPI_Allgather(&m,1,ISSM_MPI_INT,recvcounts,1,ISSM_MPI_INT,IssmComm::GetComm()); 404 405 … … 407 408 408 409 /*All gather:*/ 409 ISSM_MPI_Allgatherv(G_ rigid_local, m, ISSM_MPI_DOUBLE, G_rigid, recvcounts, displs, ISSM_MPI_DOUBLE,IssmComm::GetComm());410 ISSM_MPI_Allgatherv(G_gravi_local, m, ISSM_MPI_DOUBLE, G_gravi, recvcounts, displs, ISSM_MPI_DOUBLE,IssmComm::GetComm()); 410 411 411 412 if(elastic){ … … 427 428 428 429 /*Avoid singularity at 0: */ 429 G_ rigid[0]=G_rigid[1];430 G_gravi[0]=G_gravi[1]; 430 431 if(elastic){ 431 432 for(int t=0;t<ntimesteps;t++){ … … 486 487 } 487 488 else if(elastic){ 488 nt=1; //in elastic, or if we run only rigid, we need only one step489 nt=1; //in elastic, or if we run only selfattraction, we need only one step 489 490 #ifdef _HAVE_AD_ 490 491 G_viscoelastic_interpolated=G_viscoelastic; … … 499 500 500 501 /*Save our precomputed tables into parameters*/ 501 parameters->AddObject(new DoubleVecParam(SealevelchangeG RigidEnum,G_rigid,M));502 parameters->AddObject(new DoubleVecParam(SealevelchangeGSelfAttractionEnum,G_gravi,M)); 502 503 if(viscous || elastic){ 503 504 parameters->AddObject(new DoubleVecParam(SealevelchangeGViscoElasticEnum,G_viscoelastic_interpolated,M*nt)); … … 507 508 508 509 /*free resources: */ 509 xDelete<IssmDouble>(G_ rigid);510 xDelete<IssmDouble>(G_ rigid_local);510 xDelete<IssmDouble>(G_gravi); 511 xDelete<IssmDouble>(G_gravi_local); 511 512 if(elastic){ 512 513 xDelete<IssmDouble>(love_h); -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r26294 r26296 391 391 virtual void GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,Matlitho* litho, IssmDouble* x,IssmDouble* y)=0; 392 392 393 virtual void SealevelchangeGeometry FractionKernel(SealevelGeometry* slgeom)=0;393 virtual void SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom)=0; 394 394 virtual void SealevelchangeMomentOfInertiaCentroid(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom)=0; 395 395 virtual void SealevelchangeShift(GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom)=0; … … 400 400 virtual void SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom)=0; 401 401 virtual void SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom)=0; 402 virtual void SealevelchangeDeformationConvolution( GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom)=0;402 virtual void SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom)=0; 403 403 virtual void SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom)=0; 404 404 virtual void SealevelchangeUpdateViscousFields()=0; -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r26272 r26296 223 223 #ifdef _HAVE_SEALEVELCHANGE_ 224 224 void GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,Matlitho* litho, IssmDouble* x,IssmDouble* y){_error_("not implemented yet");}; 225 void SealevelchangeGeometry FractionKernel(SealevelGeometry* slgeom){_error_("not implemented yet");};225 void SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom){_error_("not implemented yet");}; 226 226 void SealevelchangeMomentOfInertiaCentroid(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");}; 227 227 void SealevelchangeShift(GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom){_error_("not implemented yet");}; … … 232 232 void SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 233 233 void SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom){_error_("not implemented yet");}; 234 void SealevelchangeDeformationConvolution( GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");};234 void SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 235 235 void SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");}; 236 236 void SealevelchangeUpdateViscousFields(){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r26272 r26296 178 178 #ifdef _HAVE_SEALEVELCHANGE_ 179 179 void GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,Matlitho* litho, IssmDouble* x,IssmDouble* y){_error_("not implemented yet");}; 180 void SealevelchangeGeometry FractionKernel(SealevelGeometry* slgeom){_error_("not implemented yet");};180 void SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom){_error_("not implemented yet");}; 181 181 void SealevelchangeMomentOfInertiaCentroid(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");}; 182 182 void SealevelchangeShift(GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom){_error_("not implemented yet");}; … … 187 187 void SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 188 188 void SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom){_error_("not implemented yet");}; 189 void SealevelchangeDeformationConvolution( GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");};189 void SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 190 190 void SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");}; 191 191 void SealevelchangeUpdateViscousFields(){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Tetra.h
r26272 r26296 185 185 #ifdef _HAVE_SEALEVELCHANGE_ 186 186 void GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt, Matlitho* litho, IssmDouble* x,IssmDouble* y){_error_("not implemented yet");}; 187 void SealevelchangeGeometry FractionKernel(SealevelGeometry* slgeom){_error_("not implemented yet");};187 void SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom){_error_("not implemented yet");}; 188 188 void SealevelchangeMomentOfInertiaCentroid(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");}; 189 189 void SealevelchangeShift(GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom){_error_("not implemented yet");}; … … 194 194 void SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 195 195 void SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom){_error_("not implemented yet");}; 196 void SealevelchangeDeformationConvolution( GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");};196 void SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 197 197 void SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");}; 198 198 void SealevelchangeUpdateViscousFields(){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r26283 r26296 1937 1937 1938 1938 bool istrapeze1, istrapeze2; 1939 IssmDouble phi1,phi2, f11,f12,f21,f22;1939 IssmDouble phi1,phi2, d,e,f,g,h1,h2; 1940 1940 int point1, point2, i0,i1,i2,j0,j1,j2; 1941 1941 IssmDouble weights1[3],weights2[3]; … … 1951 1951 IssmDouble xyz3[3][3]={0}; 1952 1952 IssmDouble xyz[8][3]={0}; 1953 IssmDouble f1o;1954 1953 IssmDouble w[8][NUMVERTICES]={0}; 1955 1954 IssmDouble areasub=0; … … 2019 2018 //If just one levelset is all negative, just take the partitioning of the other, no interaction between them 2020 2019 if (levelset1[0]<=0 && levelset1[1]<=0 && levelset1[2]<=0) { 2021 this->GetFractionGeometry(loadweights,&phi2,&point2,&f 21,&f22,&istrapeze2,levelset2);2022 this->GetBarycenterFromLevelset(platbar,plongbar, phi2, f 21, f22, late, longe, point2,istrapeze2,planetradius);2020 this->GetFractionGeometry(loadweights,&phi2,&point2,&f,&g,&istrapeze2,levelset2); 2021 this->GetBarycenterFromLevelset(platbar,plongbar, phi2, f, g, late, longe, point2,istrapeze2,planetradius); 2023 2022 *ploadarea=area*phi2; 2024 2023 return; 2025 2024 } 2026 2025 if (levelset2[0]<=0 && levelset2[1]<=0 && levelset2[2]<=0) { 2027 this->GetFractionGeometry(loadweights,&phi1,&point1,& f11,&f12,&istrapeze1,levelset1);2028 this->GetBarycenterFromLevelset(platbar,plongbar, phi1, f11, f12, late, longe, point1,istrapeze1,planetradius);2026 this->GetFractionGeometry(loadweights,&phi1,&point1,&d,&e,&istrapeze1,levelset1); 2027 this->GetBarycenterFromLevelset(platbar,plongbar, phi1, d, e, late, longe, point1,istrapeze1,planetradius); 2029 2028 *ploadarea=area*phi1; 2030 2029 return; … … 2032 2031 2033 2032 2034 this->GetFractionGeometry(&weights1[0],&phi1,&point1,& f11,&f12,&istrapeze1,levelset1);2035 this->GetFractionGeometry(&weights2[0],&phi2,&point2,&f 21,&f22,&istrapeze2,levelset2);2033 this->GetFractionGeometry(&weights1[0],&phi1,&point1,&d,&e,&istrapeze1,levelset1); 2034 this->GetFractionGeometry(&weights2[0],&phi2,&point2,&f,&g,&istrapeze2,levelset2); 2036 2035 2037 2036 … … 2039 2038 if (istrapeze1==istrapeze2 && point1==point2 && phi1==phi2){ 2040 2039 //the two levelsets are redundant: levelset1 = positivescalar * levelset2 2041 this->GetBarycenterFromLevelset(platbar,plongbar, phi1, f11, f12, late, longe, point1,istrapeze1,planetradius);2040 this->GetBarycenterFromLevelset(platbar,plongbar, phi1, d, e, late, longe, point1,istrapeze1,planetradius); 2042 2041 *ploadarea=area*phi1; 2043 2042 for (int i=0;i<NUMVERTICES;i++) loadweights[i]=weights1[i]; … … 2056 2055 ::GetVerticesCoordinates(&xyz0[0][0],vertices,NUMVERTICES); // initial triangle 2057 2056 2058 i0=point1; 2059 i1=(point1+1)%3; 2060 i2=(point1+2)%3; 2061 2062 j0=point2; 2063 j1=(point2+1)%3; 2064 j2=(point2+2)%3; 2065 2066 //f1o: fraction of segment {point_f11 -> point_f12} where the levelsets intersect (only used when f1o>=0 and f1o<=1) 2067 if(point2==i0) f1o= f22*(f11-f21)/(f11*f22-f12*f21); 2068 else if(point2==i1) f1o=f21*(1.0-f22-f11)/(f21*(f12-f11)-f12*f22); 2069 else f1o= (f22*(1.0-f21-f11)+f21*f11)/(f22*(f12-f11) +f21*f11); 2057 //Let our element be triangle ABC with: 2058 i0=point1; //A 2059 i1=(point1+1)%3; //B 2060 i2=(point1+2)%3; //C 2061 2062 j0=point2; //Can be A, B or C 2063 j1=(point2+1)%3; //anticlockwise point from j0 2064 j2=(point2+2)%3; //clockwise point from j0 2065 2066 /* Below we define the relative fractional lengths of ABC where the zero-level contours of the two level sets intersect with ABC and each other. For example D is the intersection of level set 1 with side AB with fractional length d=[AD]/[AB]. 2067 2068 levelset1 intersects ABC on D and E: 2069 A------D---B 2070 <--d---> 2071 2072 A-----E----C 2073 <--e--> 2074 2075 levelset2 intersects ABC on F and G: 2076 j0---F------j1 2077 <--f-> 2078 2079 j0-------G--j2 2080 <---g----> 2081 2082 levelset1 and 2 intersect on H (when that intersection exists inside the element) 2083 D----H------E 2084 <-h1-> 2085 2086 F-----H----G 2087 <--h2-> 2088 */ 2089 2090 if (point2==i0){ 2091 h1= g*(d-f)/(d*g-e*f); 2092 h2= e/g * h1; 2093 } 2094 else if (point2==i1){ 2095 h1=f*(1.0-g-d)/(f*(e-d)-e*g); 2096 h2= 1.0-e/f * h1; 2097 } 2098 else if (point2==i2){ 2099 h1= (g*(1.0-f-d)+f*d)/(g*(e-d) +f*d); 2100 h2= (d*(f+e-1))/(g*(e-d) +f*d); 2101 } 2070 2102 2071 2103 2072 2104 //interpolant weights of each point. Any field F[0,1,2] provided at the original vertices [0,1,2] will be equal on point k to sum_i (F[i] * w[k][i]) 2073 w[0][0]=1; 2074 w[1][1]=1; 2075 w[2][2]=1; 2076 w[3][i0]=1.0- f11; w[3][i1]=f11;2077 w[4][i0]=1.0- f12; w[4][i2]=f12;2078 w[5][j0]=1.0-f 21; w[5][j1]=f21;2079 w[6][j0]=1.0- f22; w[6][j2]=f22;2080 for (int j=0;j<3;j++) w[7][j]=w[3][j]*(1.0- f1o) + w[4][j]*f1o; //we interpolate the intersection point between point_f11 and point_f12 at fraction f1o2105 w[0][0]=1; //A 2106 w[1][1]=1; //B 2107 w[2][2]=1; //C 2108 w[3][i0]=1.0-d; w[3][i1]=d; //D 2109 w[4][i0]=1.0-e; w[4][i2]=e; //E 2110 w[5][j0]=1.0-f; w[5][j1]=f; //F 2111 w[6][j0]=1.0-g; w[6][j2]=g; //G 2112 for (int j=0;j<3;j++) w[7][j]=w[3][j]*(1.0-h1) + w[4][j]*h1; //H: we interpolate the intersection point H between D and E at fraction h1 2081 2113 2082 2114 for (int k=0;k<8;k++){ … … 2088 2120 //point2 can be either i0,i1 or i2. We start the search with i1 and i2 as they have less computational cost in ifs 2089 2121 if(point2==i2){ /*{{{*/ 2090 if ( f12>1.0-f21){ /*{{{*/2122 if (e>1.0-f){ /*{{{*/ 2091 2123 if (!istrapeze1 && !istrapeze2){ 2092 tria1[0]=5; tria1[1]= 7; tria1[2]= 4; 2124 tria1[0]=5; tria1[1]= 7; tria1[2]= 4; // FHE 2125 area1=h2*(e+f-1.0)*g; 2093 2126 } 2094 2127 else if (!istrapeze1 && istrapeze2){ 2095 tria1[0]=i0; tria1[1]= 3; tria1[2]= 7; 2096 tria2[0]=i0; tria2[1]= 7; tria2[2]= 5; 2128 tria1[0]=i0; tria1[1]= 3; tria1[2]= 5; //ADF 2129 area1=d*(1.0-f); 2130 tria2[0]=3; tria2[1]= 7; tria2[2]= 5; //DHF 2131 area2=d*h1*(e+f-1.0); 2097 2132 } 2098 2133 else if (istrapeze1 && !istrapeze2){ 2099 tria1[0]=7; tria1[1]= 6; tria1[2]= 4; 2100 tria2[0]=4; tria2[1]= 6; tria2[2]= i2; 2134 tria1[0]=7; tria1[1]= 6; tria1[2]= 4; //HGE 2135 area1=g*(1.0-h2)*(e+f-1.0); 2136 tria2[0]=4; tria2[1]= 6; tria2[2]= i2; //EGC 2137 area2=g*(1.0-e); 2101 2138 } 2102 2139 else { //istrapeze1 && istrapeze2 2103 tria1[0]=3; tria1[1]= i1; tria1[2]= 7; 2104 tria2[0]=7; tria2[1]= i1; tria2[2]= 6; 2140 tria1[0]=3; tria1[1]= i1; tria1[2]= 6; //DBG 2141 area1=(1.0-d)*(1.0-g); 2142 tria2[0]=3; tria2[1]= 6; tria2[2]= 7; //DGH 2143 area2=g*((1.0-f)*(1.0-h2)+h2*e)+d*(1.0-e-g); 2105 2144 } /*}}}*/ 2106 2145 } 2107 else if ( f12<=1.0-f21){ /*{{{*/2146 else if (e<=1.0-f){ /*{{{*/ 2108 2147 if (!istrapeze1 && !istrapeze2){ 2109 2148 } 2110 2149 else if (!istrapeze1 && istrapeze2){ 2111 tria1[0]=i0; tria1[1]= 3; tria1[2]= 4; 2150 tria1[0]=i0; tria1[1]= 3; tria1[2]= 4; //ADE 2151 area1=d*e; 2112 2152 } 2113 2153 else if (istrapeze1 && !istrapeze2){ 2114 tria1[0]=5; tria1[1]= 6; tria1[2]= i2; 2154 tria1[0]=5; tria1[1]= 6; tria1[2]= i2; //FGC 2155 area1=f*g; 2115 2156 } 2116 2157 else { //istrapeze1 && istrapeze2 2117 tria1[0]=3; tria1[1]= i1; tria1[2]= 4; 2118 tria2[0]=4; tria2[1]= i1; tria2[2]= 5; 2119 tria3[0]=5; tria3[1]= i1; tria3[2]= 6; 2158 tria1[0]=3; tria1[1]= i1; tria1[2]= 5; //DBF 2159 area1=(1.0-d)*(1.0-f); 2160 tria2[0]=4; tria2[1]= 3; tria2[2]= 5; //EDF 2161 area2=d*(1.0-e-f); 2162 tria3[0]=5; tria3[1]= i1; tria3[2]= 6; //FBG 2163 area3=f*(1.0-g); 2120 2164 } /*}}}*/ 2121 2165 } 2122 2166 }/*}}}*/ 2123 2167 else if(point2==i1){ /*{{{*/ 2124 if ( f11>1.0-f22){ /*{{{*/2168 if (d>1.0-g){ /*{{{*/ 2125 2169 if (!istrapeze1 && !istrapeze2){ 2126 tria1[0]=6; tria1[1]= 3; tria1[2]= 7; 2170 tria1[0]=6; tria1[1]= 3; tria1[2]= 7; //GDH 2171 area1=(1.0-h2)*(d+g-1.0)*f; 2127 2172 } 2128 2173 else if (!istrapeze1 && istrapeze2){ 2129 tria1[0]=i0; tria1[1]= 6; tria1[2]= 7; 2130 tria2[0]=i0; tria2[1]= 7; tria2[2]= 4; 2174 tria1[0]=i0; tria1[1]= 6; tria1[2]= 4; //AGE 2175 area1=(1.0-g)*e; 2176 tria2[0]=6; tria2[1]= 7; tria2[2]= 4; //GHE 2177 area2=e*(1.0-h1)*(g+d-1.0); 2131 2178 } 2132 2179 else if (istrapeze1 && !istrapeze2){ 2133 tria1[0]=3; tria1[1]= i1; tria1[2]= 7; 2134 tria2[0]=7; tria2[1]= i1; tria2[2]= 5; 2180 tria1[0]=i1; tria1[1]= 5; tria1[2]= 3; //BFD 2181 area1=(1.0-d)*f; 2182 tria2[0]=3; tria2[1]= 5; tria2[2]= 7; //DFH 2183 area2=f*h2*(d+g-1.0); 2135 2184 } 2136 2185 else { //istrapeze1 && istrapeze2 2137 tria1[0]=7; tria1[1]= 5; tria1[2]= 4; 2138 tria2[0]=4; tria2[1]= 5; tria2[2]= i2; 2186 tria1[0]=7; tria1[1]= 5; tria1[2]= 4; //HFE 2187 area1=e*((1.0-d)*(1.0-h1)+h1*g)+f*(1.0-g-e); 2188 tria2[0]=4; tria2[1]= 5; tria2[2]= i2;//EFC 2189 area2=(1.0-e)*(1.0-f); 2139 2190 } /*}}}*/ 2140 2191 } 2141 else if ( f11<=1.0-f22){ /*{{{*/2192 else if (d<=1.0-g){ /*{{{*/ 2142 2193 if (!istrapeze1 && !istrapeze2){ 2143 2194 } 2144 2195 else if (!istrapeze1 && istrapeze2){ 2145 tria1[0]=i0; tria1[1]= 3; tria1[2]= 4; 2196 tria1[0]=i0; tria1[1]= 3; tria1[2]= 4; //ADE 2197 area1=d*e; 2146 2198 } 2147 2199 else if (istrapeze1 && !istrapeze2){ 2148 tria1[0]=6; tria1[1]= i1; tria1[2]= 5; 2200 tria1[0]=6; tria1[1]= i1; tria1[2]= 5; //GBF 2201 area1=f*g; 2149 2202 } 2150 2203 else { //istrapeze1 && istrapeze2 2151 tria1[0]=3; tria1[1]= 6; tria1[2]= 4; 2152 tria2[0]=4; tria2[1]= 6; tria2[2]= 5; 2153 tria3[0]=4; tria3[1]= 5; tria3[2]= i2; 2204 tria1[0]=3; tria1[1]= 6; tria1[2]= 4; //DGE 2205 area1=e*(1.0-d-g); 2206 tria2[0]=6; tria2[1]= i2; tria2[2]= 4; //GCE 2207 area2=(1.0-g)*(1.0-e); 2208 tria3[0]=6; tria3[1]= 5; tria3[2]= i2; //GFC 2209 area3=g*(1.0-f); 2154 2210 } /*}}}*/ 2155 2211 } … … 2157 2213 }/*}}}*/ 2158 2214 else{ /*{{{*/ 2159 if ( f11<=f21 && f12>=f22){ /*{{{*/2215 if (d<=f && e>=g){ /*{{{*/ 2160 2216 if (!istrapeze1 && !istrapeze2){ 2161 tria1[0]=i0; tria1[1]= 3; tria1[2]= 7; 2162 tria2[0]=i0; tria2[1]= 7; tria2[2]= 6; 2217 tria1[0]=i0; tria1[1]= 3; tria1[2]= 7; //ADH 2218 area1=h1*d*e; 2219 tria2[0]=i0; tria2[1]= 7; tria2[2]= 6; //AHG 2220 area2=(1.0-h2)*f*g; 2163 2221 } 2164 2222 else if (!istrapeze1 && istrapeze2){ 2165 tria1[0]=6; tria1[1]= 7; tria1[2]= 4; 2223 tria1[0]=6; tria1[1]= 7; tria1[2]= 4; //GHE 2224 area1=(e-g)*d*(1.0-h1); 2166 2225 } 2167 2226 else if (istrapeze1 && !istrapeze2){ 2168 tria1[0]=3; tria1[1]= 5; tria1[2]= 7; 2227 tria1[0]=3; tria1[1]= 5; tria1[2]= 7; //DFH 2228 area1=(f-d)*g*h2; 2169 2229 } 2170 2230 else { //istrapeze1 && istrapeze2 2171 tria1[0]=7; tria1[1]= 5; tria1[2]= i1; 2172 tria2[0]=7; tria2[1]= i1; tria2[2]= 4; 2173 tria3[0]=4; tria3[1]= i1; tria3[2]= i2; 2231 tria1[0]=5; tria1[1]= i1; tria1[2]= 7; //FBH 2232 area1=g*h2*(1.0-f); 2233 tria2[0]=7; tria2[1]= i1; tria2[2]= i2;//HBC 2234 area2=1.0+d*(h1-e*h1-1.0)+g*h2*(d-1.0); 2235 tria3[0]=7; tria3[1]= i2; tria3[2]= 4; //HCE 2236 area3=d*(1.0-h1)*(1.0-e); 2174 2237 } /*}}}*/ 2175 2238 } 2176 else if ( f11>=f21 && f12<=f22){ /*{{{*/2239 else if (d>=f && e<=g){ /*{{{*/ 2177 2240 if (!istrapeze1 && !istrapeze2){ 2178 tria1[0]=i0; tria1[1]= 5; tria1[2]= 7; 2179 tria2[0]=i0; tria2[1]= 4; tria2[2]= 7; 2241 tria1[0]=i0; tria1[1]= 5; tria1[2]= 7; //AFH 2242 area1=h2*f*g; 2243 tria2[0]=i0; tria2[1]= 7; tria2[2]= 4; //AHE 2244 area2=(1.0-h1)*d*e; 2180 2245 }else if (!istrapeze1 && istrapeze2){ 2181 tria1[0]=5; tria1[1]= 3; tria1[2]= 7; 2246 tria1[0]=5; tria1[1]= 3; tria1[2]= 7; //FDH 2247 area1=(d-f)*e*h1; 2182 2248 }else if (istrapeze1 && !istrapeze2){ 2183 tria1[0]=4; tria1[1]= 7; tria1[2]= 6; 2249 tria1[0]=4; tria1[1]= 7; tria1[2]= 6; //EHG 2250 area1=(g-e)*f*(1.0-h2); 2184 2251 }else { //istrapeze1 && istrapeze2 2185 tria1[0]=3; tria1[1]= i1; tria1[2]= 7; 2186 tria2[0]=7; tria2[1]= i1; tria2[2]= 6; 2187 tria3[0]=6; tria3[1]= i1; tria3[2]= i2; 2252 tria1[0]=3; tria1[1]= i1; tria1[2]= 7; //DBH 2253 area1=e*h1*(1.0-d); 2254 tria2[0]=7; tria2[1]= i1; tria2[2]= 6; //HCG 2255 area2=f*(1.0-h2)*(1.0-g); 2256 tria3[0]=6; tria3[1]= i1; tria3[2]= i2; //HBC 2257 area3=1.0+f*(h2-g*h2-1.0)+e*h1*(f-1.0); 2188 2258 } /*}}}*/ 2189 2259 } 2190 else if ( f11<=f21 && f12<=f22){ /*{{{*/2260 else if (d<=f && e<=g){ /*{{{*/ 2191 2261 if (!istrapeze1 && !istrapeze2){ 2192 tria1[0]=i0; tria1[1]= 3; tria1[2]= 4; 2262 tria1[0]=i0; tria1[1]= 3; tria1[2]= 4;//ADE 2263 area1=d*e; 2193 2264 }else if (!istrapeze1 && istrapeze2){ 2194 2265 }else if (istrapeze1 && !istrapeze2){ 2195 tria1[0]=3; tria1[1]= 5; tria1[2]= 4; 2196 tria2[0]=4; tria2[1]= 5; tria2[2]= 6; 2266 tria1[0]=3; tria1[1]= 5; tria1[2]= 6; //DFG 2267 area1=g*(f-d); 2268 tria2[0]=3; tria2[1]= 6; tria2[2]= 4; //DGE 2269 area2=d*(g-e); 2197 2270 }else { //istrapeze1 && istrapeze2 2198 tria1[0]=6; tria1[1]= 5; tria1[2]= i1; 2199 tria2[0]=6; tria2[1]= i1; tria2[2]= i2; 2271 tria1[0]=5; tria1[1]= i2; tria1[2]= 6; //FCG 2272 area1=f*(1.0-g); 2273 tria2[0]=5; tria2[1]= i1; tria2[2]= i2;//FBC 2274 area2=1.0-f; 2200 2275 } /*}}}*/ 2201 2276 } 2202 else if ( f11>=f21 && f12>=f22){ /*{{{*/2277 else if (d>=f && e>=g){ /*{{{*/ 2203 2278 if (!istrapeze1 && !istrapeze2){ 2204 tria1[0]=i0; tria1[1]= 5; tria1[2]= 6; 2279 tria1[0]=i0; tria1[1]= 5; tria1[2]= 6; //AFG 2280 area1=f*g; 2205 2281 }else if (!istrapeze1 && istrapeze2){ 2206 tria1[0]=5; tria1[1]= 3; tria1[2]= 6; 2207 tria2[0]=6; tria2[1]= 3; tria2[2]= 4; 2282 tria1[0]=5; tria1[1]= 4; tria1[2]= 6; //FEG 2283 area1=f*(e-g); 2284 tria2[0]=5; tria2[1]= 3; tria2[2]= 4; //FDE 2285 area2=e*(d-f); 2208 2286 }else if (istrapeze1 && !istrapeze2){ 2209 2287 }else { //istrapeze1 && istrapeze2 2210 tria1[0]=4; tria1[1]= 3; tria1[2]= i1; 2211 tria2[0]=i1; tria2[1]= i2; tria2[2]= 4; 2288 tria1[0]=3; tria1[1]= i1; tria1[2]= i2; //DBC 2289 area1=1.0-d; 2290 tria2[0]=3; tria2[1]= i2; tria2[2]= 4;//DCE 2291 area2=d*(1.0-e); 2212 2292 } /*}}}*/ 2213 2293 } … … 2221 2301 } 2222 2302 } 2223 area1 = GetTriangleAreaSpherical(xyz1);2303 area1*=area; //dimensionalize the fractional area from [0:1] to [0:area] 2224 2304 } 2225 2305 if(tria2[0]>-1){ … … 2230 2310 } 2231 2311 } 2232 area2 = GetTriangleAreaSpherical(xyz2);2312 area2*=area; 2233 2313 } 2234 2314 if(tria3[0]>-1){ … … 2239 2319 } 2240 2320 } 2241 area3 = GetTriangleAreaSpherical(xyz3);2321 area3*=area; 2242 2322 } 2243 2323 … … 6100 6180 IssmDouble xyz_list[NUMVERTICES][3]; 6101 6181 6102 /* stacks:*/6103 IssmDouble* stackRSL = NULL;6104 IssmDouble* stackU = NULL;6105 IssmDouble* stackN = NULL;6106 IssmDouble* stackE = NULL;6182 /*viscous stacks:*/ 6183 IssmDouble* viscousRSL = NULL; 6184 IssmDouble* viscousU = NULL; 6185 IssmDouble* viscousN = NULL; 6186 IssmDouble* viscousE = NULL; 6107 6187 6108 6188 #ifdef _HAVE_RESTRICT_ … … 6112 6192 IssmDouble* __restrict__ GE=NULL; 6113 6193 IssmDouble* __restrict__ G_viscoelastic_precomputed=NULL; 6114 IssmDouble* __restrict__ G_ rigid_precomputed=NULL;6194 IssmDouble* __restrict__ G_gravi_precomputed=NULL; 6115 6195 IssmDouble* __restrict__ U_viscoelastic_precomputed=NULL; 6116 6196 IssmDouble* __restrict__ H_viscoelastic_precomputed=NULL; … … 6121 6201 IssmDouble* GE=NULL; 6122 6202 IssmDouble* G_viscoelastic_precomputed=NULL; 6123 IssmDouble* G_ rigid_precomputed=NULL;6203 IssmDouble* G_gravi_precomputed=NULL; 6124 6204 IssmDouble* U_viscoelastic_precomputed=NULL; 6125 6205 IssmDouble* H_viscoelastic_precomputed=NULL; … … 6128 6208 /*viscoelastic green function:*/ 6129 6209 int index; 6130 int M; 6210 int M; 6211 IssmDouble doubleindex,lincoef; 6131 6212 6132 6213 /*Computational flags:*/ 6133 bool compute rigid= false;6214 bool computeselfattraction = false; 6134 6215 bool computeelastic = false; 6135 6216 bool computerotation = false; … … 6140 6221 IssmDouble start_time,final_time; 6141 6222 int nt,precomputednt; 6223 int grd, grdmodel; 6142 6224 6143 6225 /*Rotational:*/ … … 6155 6237 IssmDouble polenudge; 6156 6238 /*}}}*/ 6239 6157 6240 /*Recover parameters:{{{ */ 6158 6241 rho_earth=FindParam(MaterialsEarthDensityEnum); 6159 this->parameters->FindParam(&compute rigid,SolidearthSettingsRigidEnum);6242 this->parameters->FindParam(&computeselfattraction,SolidearthSettingsSelfAttractionEnum); 6160 6243 this->parameters->FindParam(&computeelastic,SolidearthSettingsElasticEnum); 6161 6244 this->parameters->FindParam(&computerotation,SolidearthSettingsRotationEnum); … … 6166 6249 this->parameters->FindParam(&NewtonG,ConstantsNewtonGravityEnum); 6167 6250 this->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum); 6251 this->parameters->FindParam(&grd,SolidearthSettingsGRDEnum); 6252 this->parameters->FindParam(&grdmodel,GrdModelEnum); 6253 6254 /*early return:*/ 6255 if (!grd || grdmodel!=ElasticEnum) return; //Love numbers won't be found in this case, return before loading them 6256 if(!computeselfattraction)return; 6168 6257 6169 6258 if(computerotation){ … … 6177 6266 /*}}}*/ 6178 6267 6179 /*early return:*/6180 if(!computerigid)return;6181 6182 6268 /*Recover precomputed green function kernels:{{{*/ 6183 DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeG RigidEnum)); _assert_(parameter);6184 parameter->GetParameterValueByPointer((IssmDouble**)&G_ rigid_precomputed,&M);6269 DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeGSelfAttractionEnum)); _assert_(parameter); 6270 parameter->GetParameterValueByPointer((IssmDouble**)&G_gravi_precomputed,&M); 6185 6271 6186 6272 if(computeelastic){ … … 6215 6301 } 6216 6302 else{ 6217 nt=1; //in elastic, or if we run only rigid, we need only one step6303 nt=1; //in elastic, or if we run only selfattraction, we need only one step 6218 6304 } 6219 6305 … … 6245 6331 delPhi=fabs(lati-late); delLambda=fabs(longi-longe); if (delLambda>M_PI)delLambda=2*M_PI-delLambda; 6246 6332 alpha=2.*asin(sqrt(pow(sin(delPhi/2),2)+cos(lati)*cos(late)*pow(sin(delLambda/2),2))); 6247 index=reCast<int,IssmDouble>( alpha/M_PI*reCast<IssmDouble,int>(M-1) ); 6333 doubleindex=alpha/M_PI*reCast<IssmDouble,int>(M-1); //maps 0<alpha<PI on [0:M-1] 6334 index=reCast<int,IssmDouble>(doubleindex); //truncates doubleindex to integer part 6248 6335 _assert_(index>=0 && index<M); 6336 6337 6338 lincoef=doubleindex-index; //where between index and index+1 is alpha 6339 if (index==M-1){ //avoids out of bound case 6340 index-=1; 6341 lincoef=1; 6342 } 6343 6249 6344 6250 6345 if(horiz){ … … 6266 6361 6267 6362 /*Rigid earth gravitational perturbation: */ 6268 G[timeindex]+=G_rigid_precomputed[index]; 6363 G[timeindex]+=G_gravi_precomputed[index+0]*(1.-lincoef) 6364 +G_gravi_precomputed[index+1]*lincoef; //linear interpolation 6269 6365 6270 6366 /*Find a way to interpolate precomputed Gkernels to our solution time stepping:*/ 6271 6367 if(computeelastic){ 6272 G[timeindex]+=G_viscoelastic_precomputed[index*nt+t]; 6368 G[timeindex]+=G_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef) 6369 +G_viscoelastic_precomputed[(index+1)*nt+t]*lincoef; //linear interpolation 6273 6370 } 6274 6371 G[timeindex]=G[timeindex]*ratioe; … … 6276 6373 /*Elastic components:*/ 6277 6374 if(computeelastic){ 6278 GU[timeindex] = ratioe * U_viscoelastic_precomputed[index*nt+t]; 6375 GU[timeindex] = ratioe *(U_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef) 6376 +U_viscoelastic_precomputed[(index+1)*nt+t]*lincoef); 6279 6377 if(horiz){ 6280 GN[timeindex] = ratioe*H_viscoelastic_precomputed[index*nt+t]*N_azim; 6281 GE[timeindex] = ratioe*H_viscoelastic_precomputed[index*nt+t]*E_azim; 6378 GN[timeindex] = N_azim*ratioe *(H_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef) 6379 +H_viscoelastic_precomputed[(index+1)*nt+t]*lincoef); 6380 GE[timeindex] = E_azim*ratioe *(H_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef) 6381 +H_viscoelastic_precomputed[(index+1)*nt+t]*lincoef); 6282 6382 } 6283 6383 } … … 6376 6476 } 6377 6477 /*}}}*/ 6378 /*Initialize stacks: {{{*/6478 /*Initialize viscous stacks: {{{*/ 6379 6479 if(computeviscous){ 6380 stackRSL=xNewZeroInit<IssmDouble>(3*nt);6381 stackU=xNewZeroInit<IssmDouble>(3*nt);6382 6383 this->inputs->SetArrayInput(S tackRSLEnum,this->lid,stackRSL,3*nt);6384 this->inputs->SetArrayInput(S tackUEnum,this->lid,stackU,3*nt);6385 this->parameters->SetParam(0,S tackIndexEnum);6480 viscousRSL=xNewZeroInit<IssmDouble>(3*nt); 6481 viscousU=xNewZeroInit<IssmDouble>(3*nt); 6482 6483 this->inputs->SetArrayInput(SealevelchangeViscousRSLEnum,this->lid,viscousRSL,3*nt); 6484 this->inputs->SetArrayInput(SealevelchangeViscousUEnum,this->lid,viscousU,3*nt); 6485 this->parameters->SetParam(0,SealevelchangeViscousIndexEnum); 6386 6486 if(horiz){ 6387 stackN=xNewZeroInit<IssmDouble>(3*nt);6388 stackE=xNewZeroInit<IssmDouble>(3*nt);6389 this->inputs->SetArrayInput(S tackNEnum,this->lid,stackRSL,3*nt);6390 this->inputs->SetArrayInput(S tackEEnum,this->lid,stackU,3*nt);6487 viscousN=xNewZeroInit<IssmDouble>(3*nt); 6488 viscousE=xNewZeroInit<IssmDouble>(3*nt); 6489 this->inputs->SetArrayInput(SealevelchangeViscousNEnum,this->lid,viscousRSL,3*nt); 6490 this->inputs->SetArrayInput(SealevelchangeViscousEEnum,this->lid,viscousU,3*nt); 6391 6491 } 6392 6492 } … … 6472 6572 slgeom->late[this->lid]=late; 6473 6573 6474 /*compute fractional areas and load weights forocean:*/6574 /*compute areas and load weights for ocean and flag elements only partially in the ocean:*/ 6475 6575 if(isoceanonly){ 6476 6576 slgeom->LoadArea[SLGEOM_OCEAN][this->lid]=area; … … 6582 6682 /*Deal with ice loads if we are on grounded ice:*/ 6583 6683 if(isice && !isoceanonly && computeice){ 6584 if(isiceonly ){6684 if(isiceonly && !isocean){ 6585 6685 slgeom->LoadArea[SLGEOM_ICE][this->lid]=area; 6586 6686 for(int i=0;i<NUMVERTICES;i++) slgeom->LoadWeigths[SLGEOM_ICE][i][this->lid]=1.0/3.0; … … 6635 6735 IssmDouble loadweightsocean[3]; //to keep memory of these loads, no need to recompute for bottom pressure. 6636 6736 IssmDouble xyz_list[NUMVERTICES][3]; 6637 IssmDouble latbar= 0;6638 IssmDouble longbar= 0;6737 IssmDouble latbar=slgeom->late[this->lid]; 6738 IssmDouble longbar=slgeom->longe[this->lid]; 6639 6739 IssmDouble constant; 6640 6740 IssmDouble nanconstant=NAN; … … 6645 6745 6646 6746 #ifdef _ISSM_DEBUG_ 6647 this->AddInput(SealevelBarystaticIceLatbarEnum,& nanconstant,P0Enum);6648 this->AddInput(SealevelBarystaticIceLongbarEnum,& nanconstant,P0Enum);6649 this->AddInput(SealevelBarystaticHydroLatbarEnum,& nanconstant,P0Enum);6650 this->AddInput(SealevelBarystaticHydroLongbarEnum,& nanconstant,P0Enum);6651 this->AddInput(SealevelBarystaticOceanLatbarEnum,& nanconstant,P0Enum);6652 this->AddInput(SealevelBarystaticOceanLongbarEnum,& nanconstant,P0Enum);6747 this->AddInput(SealevelBarystaticIceLatbarEnum,&latbar,P0Enum); 6748 this->AddInput(SealevelBarystaticIceLongbarEnum,&longbar,P0Enum); 6749 this->AddInput(SealevelBarystaticHydroLatbarEnum,&latbar,P0Enum); 6750 this->AddInput(SealevelBarystaticHydroLongbarEnum,&longbar,P0Enum); 6751 this->AddInput(SealevelBarystaticOceanLatbarEnum,&latbar,P0Enum); 6752 this->AddInput(SealevelBarystaticOceanLongbarEnum,&longbar,P0Enum); 6653 6753 #endif 6654 6754 … … 6725 6825 } 6726 6826 /*}}}*/ 6727 void Tria::SealevelchangeGeometry FractionKernel(SealevelGeometry* slgeom){ /*{{{*/6827 void Tria::SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom){ /*{{{*/ 6728 6828 6729 6829 /*Declarations:{{{*/ … … 6740 6840 #ifdef _HAVE_RESTRICT_ 6741 6841 IssmDouble* __restrict__ G_viscoelastic_precomputed=NULL; 6742 IssmDouble* __restrict__ G_ rigid_precomputed=NULL;6842 IssmDouble* __restrict__ G_gravi_precomputed=NULL; 6743 6843 IssmDouble* __restrict__ U_viscoelastic_precomputed=NULL; 6744 6844 IssmDouble* __restrict__ H_viscoelastic_precomputed=NULL; … … 6750 6850 #else 6751 6851 IssmDouble* G_viscoelastic_precomputed=NULL; 6752 IssmDouble* G_ rigid_precomputed=NULL;6852 IssmDouble* G_gravi_precomputed=NULL; 6753 6853 IssmDouble* U_viscoelastic_precomputed=NULL; 6754 6854 IssmDouble* H_viscoelastic_precomputed=NULL; … … 6759 6859 #endif 6760 6860 6761 /* elastic green function:*/6861 /*viscoelastic green function:*/ 6762 6862 int index; 6763 int M; 6863 int M; 6864 IssmDouble doubleindex,lincoef; 6764 6865 6765 6866 /*Computational flags:*/ 6766 bool compute rigid= false;6867 bool computeselfattraction = false; 6767 6868 bool computeelastic = false; 6768 6869 bool computeviscous = false; 6769 6870 int horiz; 6871 int grd, grdmodel; 6770 6872 6771 6873 bool istime=true; … … 6777 6879 /*Recover parameters:{{{ */ 6778 6880 rho_earth=FindParam(MaterialsEarthDensityEnum); 6779 this->parameters->FindParam(&compute rigid,SolidearthSettingsRigidEnum);6881 this->parameters->FindParam(&computeselfattraction,SolidearthSettingsSelfAttractionEnum); 6780 6882 this->parameters->FindParam(&computeelastic,SolidearthSettingsElasticEnum); 6781 6883 this->parameters->FindParam(&computeviscous,SolidearthSettingsViscousEnum); … … 6784 6886 this->parameters->FindParam(&planetradius,SolidearthPlanetRadiusEnum); 6785 6887 this->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum); 6888 this->parameters->FindParam(&grd,SolidearthSettingsGRDEnum); 6889 this->parameters->FindParam(&grdmodel,GrdModelEnum); 6786 6890 /*}}}*/ 6787 6891 6788 6892 /*early return:*/ 6789 if(!computerigid)return; 6893 if (!grd || grdmodel!=ElasticEnum) return; //Love numbers won't be found in this case, return before loading them 6894 if(!computeselfattraction)return; 6790 6895 6791 6896 /*Recover precomputed green function kernels:{{{*/ 6792 DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeG RigidEnum)); _assert_(parameter);6793 parameter->GetParameterValueByPointer((IssmDouble**)&G_ rigid_precomputed,&M);6897 DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeGSelfAttractionEnum)); _assert_(parameter); 6898 parameter->GetParameterValueByPointer((IssmDouble**)&G_gravi_precomputed,&M); 6794 6899 6795 6900 if(computeelastic){ … … 6826 6931 } 6827 6932 else{ 6828 nt=1; //in elastic, or if we run only rigid, we need only one step6933 nt=1; //in elastic, or if we run only selfattraction, we need only one step 6829 6934 } 6830 6935 Gsubel=xNew<IssmDouble*>(SLGEOM_NUMLOADS); … … 6884 6989 delPhi=fabs(lati-late); delLambda=fabs(longi-longe); if (delLambda>M_PI)delLambda=2*M_PI-delLambda; 6885 6990 alpha=2.*asin(sqrt(pow(sin(delPhi/2.0),2.0)+cos(lati)*cos(late)*pow(sin(delLambda/2.0),2.0))); 6886 index=reCast<int,IssmDouble>( alpha/M_PI*reCast<IssmDouble,int>(M-1) ); 6887 6991 doubleindex=alpha/M_PI*reCast<IssmDouble,int>(M-1); //maps 0<alpha<PI on [0:M-1] 6992 index=reCast<int,IssmDouble>(doubleindex); //truncates doubleindex to integer part 6993 6994 lincoef=doubleindex-index; //where between index and index+1 is alpha 6995 if (index==M-1){ //avoids out of bound case 6996 index-=1; 6997 lincoef=1; 6998 } 6888 6999 6889 7000 for(int t=0;t<nt;t++){ … … 6891 7002 6892 7003 /*Rigid earth gravitational perturbation: */ 6893 Gsubel[l][timeindex]+=G_rigid_precomputed[index]; 7004 Gsubel[l][timeindex]+=G_gravi_precomputed[index+0]*(1.-lincoef) 7005 +G_gravi_precomputed[index+1]*lincoef; //linear interpolation 6894 7006 6895 7007 if(computeelastic){ 6896 Gsubel[l][timeindex]+=G_viscoelastic_precomputed[index*nt+t]; 7008 Gsubel[l][timeindex]+=G_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef) 7009 +G_viscoelastic_precomputed[(index+1)*nt+t]*lincoef; //linear interpolation 6897 7010 } 6898 7011 Gsubel[l][timeindex]*=ratioe; … … 6900 7013 /*Elastic components:*/ 6901 7014 if(computeelastic){ 6902 GUsubel[l][timeindex] = ratioe * U_viscoelastic_precomputed[index*nt+t];6903 7015 GUsubel[l][timeindex] = ratioe *(U_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef) 7016 +U_viscoelastic_precomputed[(index+1)*nt+t]*lincoef); 6904 7017 if(horiz){ 6905 GNsubel[l][timeindex] = ratioe*H_viscoelastic_precomputed[index*nt+t]*N_azim; 6906 GEsubel[l][timeindex] = ratioe*H_viscoelastic_precomputed[index*nt+t]*E_azim; 7018 GNsubel[l][timeindex] = N_azim*ratioe *(H_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef) 7019 +H_viscoelastic_precomputed[(index+1)*nt+t]*lincoef); 7020 GEsubel[l][timeindex] = E_azim*ratioe *(H_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef) 7021 +H_viscoelastic_precomputed[(index+1)*nt+t]*lincoef); 6907 7022 } 6908 7023 } … … 6951 7066 6952 7067 /*Inputs:*/ 6953 IssmDouble* stackRSL=NULL;6954 IssmDouble* stackU=NULL;6955 IssmDouble* stackN=NULL;6956 IssmDouble* stackE=NULL;6957 IssmDouble* stacktimes=NULL;6958 int stacknumsteps;6959 int stackindex=0;7068 IssmDouble* viscousRSL=NULL; 7069 IssmDouble* viscousU=NULL; 7070 IssmDouble* viscousN=NULL; 7071 IssmDouble* viscousE=NULL; 7072 IssmDouble* viscoustimes=NULL; 7073 int viscousnumsteps; 7074 int viscousindex=0; 6960 7075 int newindex=0; 6961 7076 int dummy; … … 6970 7085 this->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum); 6971 7086 6972 this->parameters->FindParam(& stacknumsteps,StackNumStepsEnum);6973 this->parameters->FindParam(& stacktimes,NULL,StackTimesEnum);6974 this->parameters->FindParam(& stackindex,StackIndexEnum);7087 this->parameters->FindParam(&viscousnumsteps,SealevelchangeViscousNumStepsEnum); 7088 this->parameters->FindParam(&viscoustimes,NULL,SealevelchangeViscousTimesEnum); 7089 this->parameters->FindParam(&viscousindex,SealevelchangeViscousIndexEnum); 6975 7090 this->parameters->FindParam(¤ttime,TimeEnum); 6976 7091 6977 this->inputs->GetArrayPtr(S tackRSLEnum,this->lid,&stackRSL,&dummy);6978 this->inputs->GetArrayPtr(S tackUEnum,this->lid,&stackU,&dummy);7092 this->inputs->GetArrayPtr(SealevelchangeViscousRSLEnum,this->lid,&viscousRSL,&dummy); 7093 this->inputs->GetArrayPtr(SealevelchangeViscousUEnum,this->lid,&viscousU,&dummy); 6979 7094 if(horiz){ 6980 this->inputs->GetArrayPtr(S tackNEnum,this->lid,&stackN,&dummy);6981 this->inputs->GetArrayPtr(S tackEEnum,this->lid,&stackE,&dummy);7095 this->inputs->GetArrayPtr(SealevelchangeViscousNEnum,this->lid,&viscousN,&dummy); 7096 this->inputs->GetArrayPtr(SealevelchangeViscousEEnum,this->lid,&viscousE,&dummy); 6982 7097 } 6983 7098 … … 6986 7101 int offset=1; 6987 7102 lincoeff=0; 6988 newindex= stacknumsteps-2;6989 6990 for(int t= stackindex;t<stacknumsteps;t++){6991 if ( stacktimes[t]>currenttime){7103 newindex=viscousnumsteps-2; 7104 7105 for(int t=viscousindex;t<viscousnumsteps;t++){ 7106 if (viscoustimes[t]>currenttime){ 6992 7107 newindex=t-1; 6993 lincoeff=(currenttime- stacktimes[newindex])/(stacktimes[t]-stacktimes[newindex]);7108 lincoeff=(currenttime-viscoustimes[newindex])/(viscoustimes[t]-viscoustimes[newindex]); 6994 7109 foundtime=true; 6995 7110 offset=0; … … 6999 7114 7000 7115 if(!foundtime) lincoeff=1; 7001 stacktimes[newindex]=currenttime;7116 viscoustimes[newindex]=currenttime; 7002 7117 for(int i=0;i<NUMVERTICES;i++){ 7003 stackRSL[i*stacknumsteps+newindex+offset]=(1-lincoeff)*stackRSL[i*stacknumsteps+newindex]+lincoeff*stackRSL[i*stacknumsteps+newindex+1];7004 stackU[i*stacknumsteps+newindex+offset]=(1-lincoeff)*stackU[i*stacknumsteps+newindex]+lincoeff*stackU[i*stacknumsteps+newindex+1];7118 viscousRSL[i*viscousnumsteps+newindex+offset]=(1-lincoeff)*viscousRSL[i*viscousnumsteps+newindex]+lincoeff*viscousRSL[i*viscousnumsteps+newindex+1]; 7119 viscousU[i*viscousnumsteps+newindex+offset]=(1-lincoeff)*viscousU[i*viscousnumsteps+newindex]+lincoeff*viscousU[i*viscousnumsteps+newindex+1]; 7005 7120 if(horiz){ 7006 stackN[i*stacknumsteps+newindex+offset]=(1-lincoeff)*stackN[i*stacknumsteps+newindex]+lincoeff*stackN[i*stacknumsteps+newindex+1];7007 stackE[i*stacknumsteps+newindex+offset]=(1-lincoeff)*stackE[i*stacknumsteps+newindex]+lincoeff*stackE[i*stacknumsteps+newindex+1];7008 } 7009 } 7010 stackindex=newindex+offset;7121 viscousN[i*viscousnumsteps+newindex+offset]=(1-lincoeff)*viscousN[i*viscousnumsteps+newindex]+lincoeff*viscousN[i*viscousnumsteps+newindex+1]; 7122 viscousE[i*viscousnumsteps+newindex+offset]=(1-lincoeff)*viscousE[i*viscousnumsteps+newindex]+lincoeff*viscousE[i*viscousnumsteps+newindex+1]; 7123 } 7124 } 7125 viscousindex=newindex+offset; 7011 7126 7012 7127 7013 this->parameters->SetParam( stackindex,StackIndexEnum);7014 this->parameters->SetParam( stacktimes,stacknumsteps,StackTimesEnum);7128 this->parameters->SetParam(viscousindex,SealevelchangeViscousIndexEnum); 7129 this->parameters->SetParam(viscoustimes,viscousnumsteps,SealevelchangeViscousTimesEnum); 7015 7130 7016 7131 /*free allocations:*/ 7017 xDelete<IssmDouble>( stacktimes);7132 xDelete<IssmDouble>(viscoustimes); 7018 7133 } 7019 7134 … … 7099 7214 } 7100 7215 /*}}}*/ 7101 void Tria::SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){ /*{{{*/7216 void Tria::SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* polarmotionvector,SealevelGeometry* slgeom){ /*{{{*/ 7102 7217 7103 7218 /*sal green function:*/ 7104 7219 IssmDouble* G=NULL; 7105 7220 IssmDouble* Gsub[SLGEOM_NUMLOADS]; 7106 IssmDouble SealevelGRD[NUMVERTICES]={0};7107 IssmDouble oceanaverage=0;7108 IssmDouble oceanarea=0;7109 IssmDouble rho_water;7110 7221 bool computefuture=false; 7111 7222 … … 7120 7231 IssmDouble Grotm3[3]; 7121 7232 7122 this->parameters->FindParam(&sal,SolidearthSettings RigidEnum);7233 this->parameters->FindParam(&sal,SolidearthSettingsSelfAttractionEnum); 7123 7234 this->parameters->FindParam(&viscous,SolidearthSettingsViscousEnum); 7124 7235 this->parameters->FindParam(&rotation,SolidearthSettingsRotationEnum); 7125 7236 this->parameters->FindParam(&nel,MeshNumberofelementsEnum); 7126 this->parameters->FindParam(&rho_water,MaterialsRhoSeawaterEnum);7127 7237 7128 7238 if(sal){ … … 7132 7242 this->inputs->GetArrayPtr(SealevelchangeGsubelOceanEnum,this->lid,&Gsub[SLGEOM_OCEAN],&size); 7133 7243 7134 this->SealevelchangeGxL(sealevelpercpu, G, Gsub, loads, slgeom, nel,percpu=true,S tackRSLEnum,computefuture=false);7244 this->SealevelchangeGxL(sealevelpercpu, G, Gsub, loads, slgeom, nel,percpu=true,SealevelchangeViscousRSLEnum,computefuture=false); 7135 7245 } 7136 7246 … … 7142 7252 for(int i=0;i<NUMVERTICES;i++){ 7143 7253 if(slgeom->lids[this->vertices[i]->lid]==this->lid){ 7144 sealevelpercpu[this->vertices[i]->lid]+=Grotm1[i]* rotationvector[0]+Grotm2[i]*rotationvector[1]+Grotm3[i]*rotationvector[2];7254 sealevelpercpu[this->vertices[i]->lid]+=Grotm1[i]*polarmotionvector[0]+Grotm2[i]*polarmotionvector[1]+Grotm3[i]*polarmotionvector[2]; 7145 7255 } 7146 7256 } … … 7151 7261 7152 7262 /*sal green function:*/ 7153 IssmDouble* G=NULL;7154 IssmDouble* Gsub[SLGEOM_NUMLOADS];7155 7263 IssmDouble oceanaverage=0; 7156 7264 IssmDouble oceanarea=0; … … 7188 7296 return; 7189 7297 } /*}}}*/ 7190 void Tria::SealevelchangeDeformationConvolution( GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){ /*{{{*/7191 7192 IssmDouble Sealevel [3]={0,0,0};7193 IssmDouble SealevelRSL[3]={0,0,0};7194 IssmDouble SealevelU[3]={0,0,0};7195 IssmDouble SealevelN[3]={0,0,0};7196 IssmDouble SealevelE[3]={0,0,0};7298 void Tria::SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* polarmotionvector,SealevelGeometry* slgeom){ /*{{{*/ 7299 7300 IssmDouble SealevelGrd[3]={0,0,0}; 7301 IssmDouble RSLGrd[3]={0,0,0}; 7302 IssmDouble UGrd[3]={0,0,0}; 7303 IssmDouble NGrd[3]={0,0,0}; 7304 IssmDouble EGrd[3]={0,0,0}; 7197 7305 int nel,nbar; 7198 7306 bool sal = false; … … 7224 7332 bool elastic=false; 7225 7333 bool percpu=false; 7334 bool planethasocean=false; 7226 7335 7227 7336 this->parameters->FindParam(&nel,MeshNumberofelementsEnum); 7228 this->parameters->FindParam(&sal,SolidearthSettings RigidEnum);7337 this->parameters->FindParam(&sal,SolidearthSettingsSelfAttractionEnum); 7229 7338 this->parameters->FindParam(&rotation,SolidearthSettingsRotationEnum); 7230 7339 this->parameters->FindParam(&elastic,SolidearthSettingsElasticEnum); 7231 7340 this->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum); 7232 7341 this->parameters->FindParam(&planethasocean,SolidearthSettingsGrdOceanEnum); 7233 7342 7234 7343 … … 7257 7366 } 7258 7367 } 7259 this->SealevelchangeGxL(& SealevelRSL[0],G, Gsub, loads, slgeom, nel,percpu=false,StackRSLEnum,computefuture=true);7368 this->SealevelchangeGxL(&RSLGrd[0],G, Gsub, loads, slgeom, nel,percpu=false,SealevelchangeViscousRSLEnum,computefuture=true); 7260 7369 7261 7370 if(elastic){ 7262 this->SealevelchangeGxL(& SealevelU[0],GU, GUsub, loads, slgeom, nel,percpu=false,StackUEnum,computefuture=true);7371 this->SealevelchangeGxL(&UGrd[0],GU, GUsub, loads, slgeom, nel,percpu=false,SealevelchangeViscousUEnum,computefuture=true); 7263 7372 if(horiz ){ 7264 this->SealevelchangeGxL(& SealevelN[0],GN, GNsub, loads, slgeom, nel,percpu=false,StackNEnum,computefuture=true);7265 this->SealevelchangeGxL(& SealevelE[0],GE, GEsub, loads, slgeom, nel,percpu=false,StackEEnum,computefuture=true);7373 this->SealevelchangeGxL(&NGrd[0],GN, GNsub, loads, slgeom, nel,percpu=false,SealevelchangeViscousNEnum,computefuture=true); 7374 this->SealevelchangeGxL(&EGrd[0],GE, GEsub, loads, slgeom, nel,percpu=false,SealevelchangeViscousEEnum,computefuture=true); 7266 7375 } 7267 7376 } … … 7275 7384 for(int i=0;i<NUMVERTICES;i++){ 7276 7385 if(slgeom->lids[this->vertices[i]->lid]==this->lid){ 7277 SealevelRSL[i]+=Grotm1[i]*rotationvector[0]+Grotm2[i]*rotationvector[1]+Grotm3[i]*rotationvector[2];7386 RSLGrd[i]+=Grotm1[i]*polarmotionvector[0]+Grotm2[i]*polarmotionvector[1]+Grotm3[i]*polarmotionvector[2]; 7278 7387 } 7279 7388 } … … 7286 7395 for(int i=0;i<NUMVERTICES;i++){ 7287 7396 if(slgeom->lids[this->vertices[i]->lid]==this->lid){ 7288 SealevelU[i]+=GUrotm1[i]*rotationvector[0]+GUrotm2[i]*rotationvector[1]+GUrotm3[i]*rotationvector[2];7397 UGrd[i]+=GUrotm1[i]*polarmotionvector[0]+GUrotm2[i]*polarmotionvector[1]+GUrotm3[i]*polarmotionvector[2]; 7289 7398 } 7290 7399 } … … 7299 7408 for(int i=0;i<NUMVERTICES;i++){ 7300 7409 if(slgeom->lids[this->vertices[i]->lid]==this->lid){ 7301 SealevelN[i]+=GNrotm1[i]*rotationvector[0]+GNrotm2[i]*rotationvector[1]+GNrotm3[i]*rotationvector[2];7302 SealevelE[i]+=GErotm1[i]*rotationvector[0]+GErotm2[i]*rotationvector[1]+GErotm3[i]*rotationvector[2];7410 NGrd[i]+=GNrotm1[i]*polarmotionvector[0]+GNrotm2[i]*polarmotionvector[1]+GNrotm3[i]*polarmotionvector[2]; 7411 EGrd[i]+=GErotm1[i]*polarmotionvector[0]+GErotm2[i]*polarmotionvector[1]+GErotm3[i]*polarmotionvector[2]; 7303 7412 } 7304 7413 } … … 7307 7416 } 7308 7417 7418 if (planethasocean){ //We must also output the RSL on vertices to compute the ocean mass conservation 7419 for(int i=0;i<NUMVERTICES;i++){ 7420 if(slgeom->lids[this->vertices[i]->lid]==this->lid){ 7421 sealevelpercpu[this->vertices[i]->lid]=RSLGrd[i]; 7422 } 7423 } 7424 } 7425 7309 7426 /*Create geoid: */ 7310 for(int i=0;i<NUMVERTICES;i++)Sealevel [i]=SealevelU[i]+SealevelRSL[i];7427 for(int i=0;i<NUMVERTICES;i++)SealevelGrd[i]=UGrd[i]+RSLGrd[i]; 7311 7428 7312 7429 /*Create inputs*/ 7313 this->AddInput(SealevelGRDEnum,Sealevel ,P1Enum);7314 this->AddInput(BedGRDEnum, SealevelU,P1Enum);7430 this->AddInput(SealevelGRDEnum,SealevelGrd,P1Enum); 7431 this->AddInput(BedGRDEnum,UGrd,P1Enum); 7315 7432 if(horiz){ 7316 this->AddInput(BedNorthGRDEnum, SealevelN,P1Enum);7317 this->AddInput(BedEastGRDEnum, SealevelE,P1Enum);7433 this->AddInput(BedNorthGRDEnum,NGrd,P1Enum); 7434 this->AddInput(BedEastGRDEnum,EGrd,P1Enum); 7318 7435 } 7319 7436 7320 7437 7321 7438 } /*}}}*/ 7322 void Tria::SealevelchangeGxL(IssmDouble* sealevelout, IssmDouble* G, IssmDouble** Gsub, GrdLoads* loads, SealevelGeometry* slgeom, int nel, bool percpu, int stackenum, bool computefuture) { /*{{{*/7323 7324 IssmDouble* sealevel=NULL;7439 void Tria::SealevelchangeGxL(IssmDouble* grdfieldout, IssmDouble* G, IssmDouble** Gsub, GrdLoads* loads, SealevelGeometry* slgeom, int nel, bool percpu, int viscousenum, bool computefuture) { /*{{{*/ 7440 7441 IssmDouble* grdfield=NULL; 7325 7442 int i,e,l,t,nbar; 7326 bool viscous=false;7327 IssmDouble* stack=NULL;7443 bool computeviscous=false; 7444 IssmDouble* viscousfield=NULL; 7328 7445 int nt=1; //important 7329 int stackindex=0; //important7330 int stacknumsteps=1; //important7331 7332 this->parameters->FindParam(& viscous,SolidearthSettingsViscousEnum);7333 if( viscous){7334 this->parameters->FindParam(& stacknumsteps,StackNumStepsEnum);7335 if(computefuture) nt= stacknumsteps;7446 int viscousindex=0; //important 7447 int viscousnumsteps=1; //important 7448 7449 this->parameters->FindParam(&computeviscous,SolidearthSettingsViscousEnum); 7450 if(computeviscous){ 7451 this->parameters->FindParam(&viscousnumsteps,SealevelchangeViscousNumStepsEnum); 7452 if(computefuture) nt=viscousnumsteps; 7336 7453 else nt=1; 7337 7454 7338 7455 //allocate 7339 sealevel=xNewZeroInit<IssmDouble>(3*nt);7340 } 7341 else sealevel=xNewZeroInit<IssmDouble>(3*nt);7456 grdfield=xNewZeroInit<IssmDouble>(3*nt); 7457 } 7458 else grdfield=xNewZeroInit<IssmDouble>(3*nt); 7342 7459 7343 7460 if(loads->sealevelloads){ … … 7347 7464 for (e=0;e<nel;e++){ 7348 7465 for(t=0;t<nt;t++){ 7349 int index=i*nel* stacknumsteps+e*stacknumsteps+t;7350 sealevel[i*nt+t]+=G[index]*(loads->sealevelloads[e]+loads->loads[e]);7466 int index=i*nel*viscousnumsteps+e*viscousnumsteps+t; 7467 grdfield[i*nt+t]+=G[index]*(loads->sealevelloads[e]+loads->loads[e]); 7351 7468 } 7352 7469 } … … 7355 7472 for (e=0;e<nbar;e++){ 7356 7473 for(t=0;t<nt;t++){ 7357 int index=i*nbar* stacknumsteps+e*stacknumsteps+t;7358 sealevel[i*nt+t]+=Gsub[l][index]*(loads->subloads[l][e]);7474 int index=i*nbar*viscousnumsteps+e*viscousnumsteps+t; 7475 grdfield[i*nt+t]+=Gsub[l][index]*(loads->subloads[l][e]); 7359 7476 } 7360 7477 } … … 7362 7479 for (e=0;e<nbar;e++){ 7363 7480 for(t=0;t<nt;t++){ 7364 int index=i*nbar* stacknumsteps+e*stacknumsteps+t;7365 sealevel[i*nt+t]+=Gsub[l][index]*(loads->subsealevelloads[e]);7481 int index=i*nbar*viscousnumsteps+e*viscousnumsteps+t; 7482 grdfield[i*nt+t]+=Gsub[l][index]*(loads->subsealevelloads[e]); 7366 7483 } 7367 7484 } … … 7376 7493 for (e=0;e<nel;e++){ 7377 7494 for(t=0;t<nt;t++){ 7378 int index=i*nel* stacknumsteps+e*stacknumsteps+t;7379 sealevel[i*nt+t]+=G[index]*(loads->loads[e]);7495 int index=i*nel*viscousnumsteps+e*viscousnumsteps+t; 7496 grdfield[i*nt+t]+=G[index]*(loads->loads[e]); 7380 7497 } 7381 7498 } … … 7384 7501 for (e=0;e<nbar;e++){ 7385 7502 for(t=0;t<nt;t++){ 7386 int index=i*nbar* stacknumsteps+e*stacknumsteps+t;7387 sealevel[i*nt+t]+=Gsub[l][index]*(loads->subloads[l][e]);7503 int index=i*nbar*viscousnumsteps+e*viscousnumsteps+t; 7504 grdfield[i*nt+t]+=Gsub[l][index]*(loads->subloads[l][e]); 7388 7505 } 7389 7506 } … … 7392 7509 } 7393 7510 7394 if( viscous){7395 IssmDouble* sealevelinterp=NULL;7396 IssmDouble* stacktimes=NULL;7511 if(computeviscous){ 7512 IssmDouble* grdfieldinterp=NULL; 7513 IssmDouble* viscoustimes=NULL; 7397 7514 IssmDouble final_time; 7398 7515 IssmDouble lincoeff; 7399 7516 IssmDouble timeacc; 7400 7517 7401 this->parameters->FindParam(& stackindex,StackIndexEnum);7402 this->parameters->FindParam(& stacktimes,NULL,StackTimesEnum);7518 this->parameters->FindParam(&viscousindex,SealevelchangeViscousIndexEnum); 7519 this->parameters->FindParam(&viscoustimes,NULL,SealevelchangeViscousTimesEnum); 7403 7520 this->parameters->FindParam(&final_time,TimesteppingFinalTimeEnum); 7404 7521 this->parameters->FindParam(&timeacc,SolidearthSettingsTimeAccEnum); 7405 this->inputs->GetArrayPtr( stackenum,this->lid,&stack,NULL);7522 this->inputs->GetArrayPtr(viscousenum,this->lid,&viscousfield,NULL); 7406 7523 if(computefuture){ 7407 sealevelinterp=xNew<IssmDouble>(3*nt);7408 if( stacktimes[stackindex]<final_time){7409 lincoeff=( stacktimes[stackindex+1]-stacktimes[stackindex])/timeacc;7410 for(int t= stackindex;t<nt;t++){7411 if(t== stackindex){7524 grdfieldinterp=xNew<IssmDouble>(3*nt); 7525 if(viscoustimes[viscousindex]<final_time){ 7526 lincoeff=(viscoustimes[viscousindex+1]-viscoustimes[viscousindex])/timeacc; 7527 for(int t=viscousindex;t<nt;t++){ 7528 if(t==viscousindex){ 7412 7529 for(int i=0;i<NUMVERTICES;i++){ 7413 7530 if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue; 7414 sealevelinterp[i*nt+t]= sealevel[i*nt+0];7531 grdfieldinterp[i*nt+t]= grdfield[i*nt+0]; 7415 7532 } 7416 7533 } … … 7418 7535 for(int i=0;i<NUMVERTICES;i++){ 7419 7536 if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue; 7420 sealevelinterp[i*nt+t]= (1-lincoeff)*sealevel[i*nt+(t-stackindex-1)]+lincoeff*sealevel[i*nt+(t-stackindex)];7537 grdfieldinterp[i*nt+t]= (1-lincoeff)*grdfield[i*nt+(t-viscousindex-1)]+lincoeff*grdfield[i*nt+(t-viscousindex)]; 7421 7538 } 7422 7539 } … … 7425 7542 } 7426 7543 7427 /*update sealevel at present time usingstack at present time: */7544 /*update grdfield at present time using viscous stack at present time: */ 7428 7545 for(int i=0;i<NUMVERTICES;i++){ 7429 7546 if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue; 7430 sealevel[i*nt+0]+=stack[i*stacknumsteps+stackindex];7431 } 7432 7433 if(computefuture){ /*update stack with future deformation from present load: */7434 7435 for(int t=nt-1;t>= stackindex;t--){7547 grdfield[i*nt+0]+=viscousfield[i*viscousnumsteps+viscousindex]; 7548 } 7549 7550 if(computefuture){ /*update viscous stack with future deformation from present load: */ 7551 7552 for(int t=nt-1;t>=viscousindex;t--){ 7436 7553 for(int i=0;i<NUMVERTICES;i++){ 7437 7554 if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue; 7438 stack[i*stacknumsteps+t]+=sealevelinterp[i*nt+t]-sealevelinterp[i*nt+stackindex]-stack[i*stacknumsteps+stackindex]; 7555 //offset viscousfield to remove all deformation that has already been added 7556 viscousfield[i*viscousnumsteps+t]+=grdfieldinterp[i*nt+t]-grdfieldinterp[i*nt+viscousindex]-viscousfield[i*viscousnumsteps+viscousindex]; 7439 7557 } 7440 7558 } 7441 /*Re-add stack now that we updated:*/7442 this->inputs->SetArrayInput( stackenum,this->lid,stack,3*stacknumsteps);7559 /*Re-add viscous stack now that we updated:*/ 7560 this->inputs->SetArrayInput(viscousenum,this->lid,viscousfield,3*viscousnumsteps); 7443 7561 } 7444 7562 7445 7563 /*Free allocatoins:*/ 7446 xDelete<IssmDouble>( stacktimes);7564 xDelete<IssmDouble>(viscoustimes); 7447 7565 } 7448 7566 … … 7451 7569 for(i=0;i<NUMVERTICES;i++){ 7452 7570 if(slgeom->lids[this->vertices[i]->lid]==this->lid){ 7453 sealevelout[this->vertices[i]->lid]=sealevel[i*nt+0];7571 grdfieldout[this->vertices[i]->lid]=grdfield[i*nt+0]; 7454 7572 } 7455 7573 } 7456 7574 } 7457 7575 else{ 7458 for(i=0;i<NUMVERTICES;i++) sealevelout[i]=sealevel[i*nt+0];7576 for(i=0;i<NUMVERTICES;i++) grdfieldout[i]=grdfield[i*nt+0]; 7459 7577 } 7460 7578 -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r26272 r26296 170 170 void GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,Matlitho* litho, IssmDouble* x,IssmDouble* y); 171 171 void SealevelchangeGeometryInitial(IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae); 172 void SealevelchangeGeometry FractionKernel(SealevelGeometry* slgeom);172 void SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom); 173 173 void SealevelchangeGeometrySubElementLoads(SealevelGeometry* slgeom, IssmDouble* areae); 174 174 void SealevelchangeGeometryCentroidLoads(SealevelGeometry* slgeom, IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae); … … 176 176 void SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom); 177 177 void SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom); 178 void SealevelchangeDeformationConvolution( GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom);178 void SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom); 179 179 void SealevelchangeShift(GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom); 180 180 void SealevelchangeMomentOfInertiaCentroid(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom); -
issm/trunk-jpl/src/c/cores/sealevelchange_core.cpp
r26285 r26296 24 24 void TransferSealevel(FemModel* femmodel,int forcingenum); 25 25 bool slcconvergence(Vector<IssmDouble>* RSLg,Vector<IssmDouble>* RSLg_old,IssmDouble eps_rel,IssmDouble eps_abs); 26 IssmDouble SealevelloadsOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble oceanarea);27 void RotationAxisMotion(IssmDouble* m, FemModel* femmodel,GrdLoads* loads, SealevelGeometry* slgeom);26 IssmDouble SealevelloadsOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble totaloceanarea); 27 void PolarMotion(IssmDouble* m, FemModel* femmodel,GrdLoads* loads, SealevelGeometry* slgeom); 28 28 void ConserveOceanMass(FemModel* femmodel,GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom); 29 29 void ivins_deformation_core(FemModel* femmodel); … … 221 221 BarystaticContributions* barycontrib=NULL; 222 222 GenericParam<BarystaticContributions*>* barycontribparam=NULL; 223 IssmDouble rotationaxismotionvector[3]={0};223 IssmDouble polarmotionvector[3]={0}; 224 224 225 225 GrdLoads* loads=NULL; 226 226 Vector<IssmDouble>* oldsealevelloads=NULL; 227 227 Vector<IssmDouble>* oceanareas=NULL; 228 IssmDouble oceanarea;228 IssmDouble totaloceanarea; 229 229 Vector<IssmDouble>* subelementoceanareas=NULL; 230 230 IssmDouble oceanaverage; … … 244 244 int grd=0; 245 245 int grdmodel; 246 int computesealevel=0;246 int sealevelloading=0; 247 247 bool viscous=false; 248 bool rotation=false; 249 bool planethasocean=false; 248 250 IssmDouble* sealevelpercpu=NULL; 249 251 … … 255 257 /*retrieve parameters:{{{*/ 256 258 femmodel->parameters->FindParam(&grd,SolidearthSettingsGRDEnum); 259 femmodel->parameters->FindParam(&grdmodel,GrdModelEnum); 257 260 femmodel->parameters->FindParam(&frequency,SolidearthSettingsRunFrequencyEnum); 258 261 femmodel->parameters->FindParam(&count,SealevelchangeRunCountEnum); 259 femmodel->parameters->FindParam(&computesealevel,SolidearthSettingsComputesealevelchangeEnum); 262 femmodel->parameters->FindParam(&step,StepEnum); 263 femmodel->parameters->FindParam(&time,TimeEnum); 264 femmodel->parameters->FindParam(&sealevelloading,SolidearthSettingsSealevelLoadingEnum); 260 265 femmodel->parameters->FindParam(&max_nonlinear_iterations,SolidearthSettingsMaxiterEnum); 261 femmodel->parameters->FindParam(&grdmodel,GrdModelEnum);262 266 femmodel->parameters->FindParam(&viscous,SolidearthSettingsViscousEnum); 267 femmodel->parameters->FindParam(&rotation,SolidearthSettingsRotationEnum); 268 femmodel->parameters->FindParam(&planethasocean,SolidearthSettingsGrdOceanEnum); 263 269 /*}}}*/ 264 270 … … 314 320 loads->BroadcastLoads(); 315 321 316 //compute rotation axismotion:317 RotationAxisMotion(&rotationaxismotionvector[0],femmodel,loads,slgeom);318 319 /*skip computation of sea level if requested, which means sea level loads should be zeroed */320 if(! computesealevel){322 //compute polar motion: 323 PolarMotion(&polarmotionvector[0],femmodel,loads,slgeom); 324 325 /*skip computation of sea level equation if requested, which means sea level loads should be zeroed */ 326 if(!sealevelloading){ 321 327 loads->sealevelloads=xNewZeroInit<IssmDouble>(nel); 322 328 loads->subsealevelloads=xNewZeroInit<IssmDouble>(slgeom->nbar[SLGEOM_OCEAN]); 329 323 330 goto deformation; 324 331 } … … 332 339 for(Object* & object : femmodel->elements->objects){ 333 340 Element* element = xDynamicCast<Element*>(object); 334 element->SealevelchangeConvolution(sealevelpercpu, loads , rotationaxismotionvector,slgeom);341 element->SealevelchangeConvolution(sealevelpercpu, loads , polarmotionvector,slgeom); 335 342 } 336 343 … … 347 354 oceanareas->Assemble(); 348 355 subelementoceanareas->Assemble(); 349 oceanareas->Sum(& oceanarea); _assert_(oceanarea>0.);350 if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2356 oceanareas->Sum(&totaloceanarea); _assert_(totaloceanarea>0.); 357 if(scaleoceanarea) totaloceanarea=3.619e+14; // use true ocean area, m^2 351 358 } 352 359 353 360 //Conserve ocean mass: 354 oceanaverage=SealevelloadsOceanAverage(loads, oceanareas,subelementoceanareas, oceanarea);355 ConserveOceanMass(femmodel,loads,barycontrib->Total()/ oceanarea - oceanaverage,slgeom);361 oceanaverage=SealevelloadsOceanAverage(loads, oceanareas,subelementoceanareas, totaloceanarea); 362 ConserveOceanMass(femmodel,loads,barycontrib->Total()/totaloceanarea - oceanaverage,slgeom); 356 363 357 364 //broadcast sea level loads 358 365 loads->BroadcastSealevelLoads(); 359 366 360 //compute rotation axismotion:361 RotationAxisMotion(&rotationaxismotionvector[0],femmodel,loads, slgeom);367 //compute polar motion: 368 PolarMotion(&polarmotionvector[0],femmodel,loads, slgeom); 362 369 363 370 //convergence? … … 376 383 for(Object* & object : femmodel->elements->objects){ 377 384 Element* element = xDynamicCast<Element*>(object); 378 element->SealevelchangeDeformationConvolution( loads, rotationaxismotionvector,slgeom);385 element->SealevelchangeDeformationConvolution(sealevelpercpu, loads, polarmotionvector,slgeom); 379 386 } 380 387 381 388 if(VerboseSolution()) _printf0_(" updating GRD fields\n"); 382 389 383 /*Update bedrock motion and geoid:*/ 384 if(computesealevel){ 385 femmodel->inputs->Shift(SealevelGRDEnum,barycontrib->Total()/rho_water/oceanarea- oceanaverage/rho_water); //given that we converged, no need to recompute ocean average 390 if(planethasocean){ 391 if (!sealevelloading){ //we haven't done so before, so we need to compute the ocean average and area 392 loads->sealevelloads=NULL; //needed to trigger the calculation of areas 393 /*retrieve sea level average and ocean area:*/ 394 for(Object* & object : femmodel->elements->objects){ 395 Element* element = xDynamicCast<Element*>(object); 396 element->SealevelchangeOceanAverage(loads, oceanareas, subelementoceanareas, sealevelpercpu, slgeom); 397 } 398 loads->sealevelloads=xNewZeroInit<IssmDouble>(nel); 399 loads->AssembleSealevelLoads(); 400 /*compute ocean areas:*/ 401 oceanareas->Assemble(); 402 subelementoceanareas->Assemble(); 403 oceanareas->Sum(&totaloceanarea); _assert_(totaloceanarea>0.); 404 if(scaleoceanarea) totaloceanarea=3.619e+14; // use true ocean area, m^2 405 406 //Conserve ocean mass 407 //Note that here we create sea-level loads but they will not generate GRD as we have already run all the convolutions 408 oceanaverage=SealevelloadsOceanAverage(loads, oceanareas,subelementoceanareas, totaloceanarea); 409 ConserveOceanMass(femmodel,loads,barycontrib->Total()/totaloceanarea - oceanaverage,slgeom); 410 } 411 412 femmodel->inputs->Shift(SealevelGRDEnum,barycontrib->Total()/rho_water/totaloceanarea- oceanaverage/rho_water); 386 413 387 414 //cumulate barystatic contributions and save to results: 388 415 barycontrib->Cumulate(femmodel->parameters); 389 barycontrib->Save(femmodel->results,femmodel->parameters, oceanarea);416 barycontrib->Save(femmodel->results,femmodel->parameters,totaloceanarea); 390 417 barycontrib->Reset(); 391 418 } 392 419 420 if (rotation) { 421 femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,SealevelInertiaTensorXZEnum,polarmotionvector[0],step,time)); 422 femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,SealevelInertiaTensorYZEnum,polarmotionvector[1],step,time)); 423 femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,SealevelInertiaTensorZZEnum,polarmotionvector[2],step,time)); 424 } 425 426 /*Update bedrock motion and geoid:*/ 393 427 femmodel->inputs->AXPY(1,SealevelGRDEnum,SealevelEnum); 394 428 femmodel->inputs->AXPY(1,BedGRDEnum,BedEnum); … … 409 443 /*parameters: */ 410 444 int step; 411 int computesealevel=0;412 445 bool isocean=false; 413 446 IssmDouble time; … … 417 450 IssmDouble cumgmslc=0; 418 451 IssmDouble gmtslc=0; 419 420 /*early return if we are not computing sea level, but rather deformation: */421 femmodel->parameters->FindParam(&computesealevel,SolidearthSettingsComputesealevelchangeEnum);422 if (!computesealevel)return;423 452 424 453 /*early return if we have no ocean transport:*/ … … 610 639 femmodel->parameters->FindParam(&areae,&nel,AreaeEnum); 611 640 612 /*initialize Sealevel Masks structure: */641 /*initialize SealevelloadMasks structure: */ 613 642 slgeom=new SealevelGeometry(femmodel->elements->Size(),femmodel->vertices->Size()); 614 643 … … 639 668 for(Object* & object : femmodel->elements->objects){ 640 669 Element* element=xDynamicCast<Element*>(object); 641 element->SealevelchangeGeometry FractionKernel(slgeom);670 element->SealevelchangeGeometrySubElementKernel(slgeom); 642 671 } 643 672 … … 699 728 700 729 } /*}}}*/ 701 IssmDouble SealevelloadsOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* suboceanareas, IssmDouble oceanarea){ /*{{{*/730 IssmDouble SealevelloadsOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* suboceanareas, IssmDouble totaloceanarea){ /*{{{*/ 702 731 703 732 IssmDouble sealevelloadsaverage; … … 715 744 delete vsubsealevelloadsvolume; 716 745 717 return (sealevelloadsaverage+subsealevelloadsaverage)/ oceanarea;746 return (sealevelloadsaverage+subsealevelloadsaverage)/totaloceanarea; 718 747 } /*}}}*/ 719 void RotationAxisMotion(IssmDouble* m, FemModel* femmodel,GrdLoads* loads, SealevelGeometry* slgeom){ /*{{{*/748 void PolarMotion(IssmDouble* polarmotionvector, FemModel* femmodel,GrdLoads* loads, SealevelGeometry* slgeom){ /*{{{*/ 720 749 721 750 IssmDouble moi_list[3]={0,0,0}; … … 746 775 747 776 element->SealevelchangeMomentOfInertiaCentroid(&moi_list[0],loads,slgeom); 748 749 777 element->SealevelchangeMomentOfInertiaSubElement(&moi_list_sub[0],loads, slgeom); 750 778 … … 754 782 } 755 783 784 for (int i=0;i<3;i++) moi_list[i]=0; 756 785 757 786 ISSM_MPI_Reduce (&moi_list_cpu[0],&moi_list[0],1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() ); … … 770 799 771 800 /*Assign output pointers:*/ 772 m[0]=m1;773 m[1]=m2;774 m[2]=m3;801 polarmotionvector[0]=m1; 802 polarmotionvector[1]=m2; 803 polarmotionvector[2]=m3; 775 804 } /*}}}*/ 776 805 void ConserveOceanMass(FemModel* femmodel,GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom){ /*{{{*/ -
issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
r26274 r26296 360 360 SolidearthSettingsViscousEnum, 361 361 SealevelchangeGeometryDoneEnum, 362 SealevelchangeViscousNumStepsEnum, 363 SealevelchangeViscousTimesEnum, 364 SealevelchangeViscousIndexEnum, 362 365 RotationalEquatorialMoiEnum, 363 366 TidalLoveHEnum, … … 370 373 LoveTimeFreqEnum, 371 374 LoveIsTimeEnum, 372 SealevelchangeG RigidEnum,375 SealevelchangeGSelfAttractionEnum, 373 376 SealevelchangeGViscoElasticEnum, 374 SolidearthSettings ComputesealevelchangeEnum,377 SolidearthSettingsSealevelLoadingEnum, 375 378 SolidearthSettingsGRDEnum, 376 379 SolidearthSettingsRunFrequencyEnum, … … 379 382 SolidearthSettingsHorizEnum, 380 383 SolidearthSettingsMaxiterEnum, 384 SolidearthSettingsGrdOceanEnum, 381 385 SolidearthSettingsOceanAreaScalingEnum, 382 386 RotationalPolarMoiEnum, 383 387 SolidearthSettingsReltolEnum, 384 388 SealevelchangeRequestedOutputsEnum, 385 SolidearthSettings RigidEnum,389 SolidearthSettingsSelfAttractionEnum, 386 390 SolidearthSettingsRotationEnum, 387 391 SolidearthSettingsMaxSHCoeffEnum, … … 397 401 SettingsSolverResidueThresholdEnum, 398 402 SettingsWaitonlockEnum, 399 StackNumStepsEnum,400 StackTimesEnum,401 StackIndexEnum,402 403 SmbAIceEnum, 403 404 SmbAIdxEnum, … … 832 833 SealevelchangeGEsubelHydroEnum, 833 834 SealevelchangeGNsubelHydroEnum, 835 SealevelchangeViscousRSLEnum, 836 SealevelchangeViscousUEnum, 837 SealevelchangeViscousNEnum, 838 SealevelchangeViscousEEnum, 834 839 SedimentHeadEnum, 835 840 SedimentHeadOldEnum, … … 953 958 SolidearthExternalDisplacementUpRateEnum, 954 959 SolidearthExternalGeoidRateEnum, 955 StackRSLEnum,956 StackUEnum,957 StackNEnum,958 StackEEnum,959 960 StrainRateeffectiveEnum, 960 961 StrainRateparallelEnum, … … 1430 1431 SealevelInertiaTensorYZEnum, 1431 1432 SealevelInertiaTensorZZEnum, 1433 SealevelchangePolarMotionEnum, 1432 1434 SealevelNmotionEnum, 1433 1435 SealevelUmotionEnum, -
issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
r26274 r26296 378 378 case LoveTimeFreqEnum : return "LoveTimeFreq"; 379 379 case LoveIsTimeEnum : return "LoveIsTime"; 380 case SealevelchangeG RigidEnum : return "SealevelchangeGRigid";380 case SealevelchangeGSelfAttractionEnum : return "SealevelchangeGSelfAttraction"; 381 381 case SealevelchangeGViscoElasticEnum : return "SealevelchangeGViscoElastic"; 382 case SolidearthSettings ComputesealevelchangeEnum : return "SolidearthSettingsComputesealevelchange";382 case SolidearthSettingsSealevelLoadingEnum : return "SolidearthSettingsSealevelLoading"; 383 383 case SolidearthSettingsGRDEnum : return "SolidearthSettingsGRD"; 384 384 case SolidearthSettingsRunFrequencyEnum : return "SolidearthSettingsRunFrequency"; … … 391 391 case SolidearthSettingsReltolEnum : return "SolidearthSettingsReltol"; 392 392 case SealevelchangeRequestedOutputsEnum : return "SealevelchangeRequestedOutputs"; 393 case SolidearthSettings RigidEnum : return "SolidearthSettingsRigid";393 case SolidearthSettingsSelfAttractionEnum : return "SolidearthSettingsSelfAttraction"; 394 394 case SolidearthSettingsRotationEnum : return "SolidearthSettingsRotation"; 395 395 case SealevelchangeRunCountEnum : return "SealevelchangeRunCount"; … … 404 404 case SettingsSolverResidueThresholdEnum : return "SettingsSolverResidueThreshold"; 405 405 case SettingsWaitonlockEnum : return "SettingsWaitonlock"; 406 case S tackNumStepsEnum : return "StackNumSteps";407 case S tackTimesEnum : return "StackTimes";408 case S tackIndexEnum : return "StackIndex";406 case SealevelchangeViscousNumStepsEnum : return "SealevelchangeViscousNumSteps"; 407 case SealevelchangeViscousTimesEnum : return "SealevelchangeViscousTimes"; 408 case SealevelchangeViscousIndexEnum : return "SealevelchangeViscousIndex"; 409 409 case SmbAIceEnum : return "SmbAIce"; 410 410 case SmbAIdxEnum : return "SmbAIdx"; … … 957 957 case SolidearthExternalDisplacementUpRateEnum : return "SolidearthExternalDisplacementUpRate"; 958 958 case SolidearthExternalGeoidRateEnum : return "SolidearthExternalGeoidRate"; 959 case S tackRSLEnum : return "StackRSL";960 case S tackUEnum : return "StackU";961 case S tackNEnum : return "StackN";962 case S tackEEnum : return "StackE";959 case SealevelchangeViscousRSLEnum : return "SealevelchangeViscousRSL"; 960 case SealevelchangeViscousUEnum : return "SealevelchangeViscousU"; 961 case SealevelchangeViscousNEnum : return "SealevelchangeViscousN"; 962 case SealevelchangeViscousEEnum : return "SealevelchangeViscousE"; 963 963 case StrainRateeffectiveEnum : return "StrainRateeffective"; 964 964 case StrainRateparallelEnum : return "StrainRateparallel"; -
issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
r26274 r26296 387 387 if(stage==4){ 388 388 if (strcmp(name,"LoveIsTime")==0) return LoveIsTimeEnum; 389 else if (strcmp(name,"SealevelchangeG Rigid")==0) return SealevelchangeGRigidEnum;389 else if (strcmp(name,"SealevelchangeGSelfAttraction")==0) return SealevelchangeGSelfAttractionEnum; 390 390 else if (strcmp(name,"SealevelchangeGViscoElastic")==0) return SealevelchangeGViscoElasticEnum; 391 else if (strcmp(name,"SolidearthSettings Computesealevelchange")==0) return SolidearthSettingsComputesealevelchangeEnum;391 else if (strcmp(name,"SolidearthSettingsSealevelLoading")==0) return SolidearthSettingsSealevelLoadingEnum; 392 392 else if (strcmp(name,"SolidearthSettingsGRD")==0) return SolidearthSettingsGRDEnum; 393 393 else if (strcmp(name,"SolidearthSettingsRunFrequency")==0) return SolidearthSettingsRunFrequencyEnum; … … 400 400 else if (strcmp(name,"SolidearthSettingsReltol")==0) return SolidearthSettingsReltolEnum; 401 401 else if (strcmp(name,"SealevelchangeRequestedOutputs")==0) return SealevelchangeRequestedOutputsEnum; 402 else if (strcmp(name,"SolidearthSettings Rigid")==0) return SolidearthSettingsRigidEnum;402 else if (strcmp(name,"SolidearthSettingsSelfAttraction")==0) return SolidearthSettingsSelfAttractionEnum; 403 403 else if (strcmp(name,"SolidearthSettingsRotation")==0) return SolidearthSettingsRotationEnum; 404 404 else if (strcmp(name,"SealevelchangeRunCount")==0) return SealevelchangeRunCountEnum; … … 413 413 else if (strcmp(name,"SettingsSolverResidueThreshold")==0) return SettingsSolverResidueThresholdEnum; 414 414 else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum; 415 else if (strcmp(name,"S tackNumSteps")==0) return StackNumStepsEnum;416 else if (strcmp(name,"S tackTimes")==0) return StackTimesEnum;417 else if (strcmp(name,"S tackIndex")==0) return StackIndexEnum;415 else if (strcmp(name,"SealevelchangeViscousNumSteps")==0) return SealevelchangeViscousNumStepsEnum; 416 else if (strcmp(name,"SealevelchangeViscousTimes")==0) return SealevelchangeViscousTimesEnum; 417 else if (strcmp(name,"SealevelchangeViscousIndex")==0) return SealevelchangeViscousIndexEnum; 418 418 else if (strcmp(name,"SmbAIce")==0) return SmbAIceEnum; 419 419 else if (strcmp(name,"SmbAIdx")==0) return SmbAIdxEnum; … … 978 978 else if (strcmp(name,"SolidearthExternalDisplacementUpRate")==0) return SolidearthExternalDisplacementUpRateEnum; 979 979 else if (strcmp(name,"SolidearthExternalGeoidRate")==0) return SolidearthExternalGeoidRateEnum; 980 else if (strcmp(name,"S tackRSL")==0) return StackRSLEnum;981 else if (strcmp(name,"S tackU")==0) return StackUEnum;982 else if (strcmp(name,"S tackN")==0) return StackNEnum;983 else if (strcmp(name,"S tackE")==0) return StackEEnum;980 else if (strcmp(name,"SealevelchangeViscousRSL")==0) return SealevelchangeViscousRSLEnum; 981 else if (strcmp(name,"SealevelchangeViscousU")==0) return SealevelchangeViscousUEnum; 982 else if (strcmp(name,"SealevelchangeViscousN")==0) return SealevelchangeViscousNEnum; 983 else if (strcmp(name,"SealevelchangeViscousE")==0) return SealevelchangeViscousEEnum; 984 984 else if (strcmp(name,"StrainRateeffective")==0) return StrainRateeffectiveEnum; 985 985 else if (strcmp(name,"StrainRateparallel")==0) return StrainRateparallelEnum; -
issm/trunk-jpl/src/m/classes/solidearthsettings.m
r26272 r26296 9 9 abstol = 0; 10 10 maxiter = 0; 11 rigid = 0; 12 elastic = 0; 13 viscous = 0; 14 rotation = 0; 11 selfattraction = 1; 12 elastic = 1; 13 viscous = 1; 14 rotation = 1; 15 grdocean = 1; 15 16 ocean_area_scaling = 0; 16 17 runfrequency = 1; %how many time steps we skip before we run grd_core 17 computesealevelchange = 1; %will sea-level be coputed?18 sealevelloading = 1; %will sea-level loads be computed? 18 19 isgrd = 0; %will GRD patterns be computed? 19 20 compute_bp_grd = 0; %will GRD patterns for bottom pressures be computed? … … 21 22 timeacc = 0; %time step accurary required to compute Green tables 22 23 horiz = 0; %compute horizontal deformation 23 grdmodel = 0; %grd model (0 by default, 1 for elastic, 2 for Ivins)24 grdmodel = 0; %grd model (0 by default, 1 for (visco)-elastic, 2 for Ivins) 24 25 cross_section_shape = 0; %cross section only used when grd model is Ivins 25 26 end 27 methods (Static) 28 function self = loadobj(self) % {{{ 29 % This function is directly called by matlab when a model object is 30 % loaded. If the input is a struct it is an old version of this class and 31 % old fields must be recovered (make sure they are in the deprecated 32 % model properties) 33 34 if isstruct(self) 35 % 2021, Jun 4 36 if isfield(self,'rigid') 37 self.selfattraction = self.rigid; 38 end 39 if isfield(self,'computesealevelchange') 40 self.sealevelloading = self.computesealevelchange; 41 end 42 self = structtoobj(solidearthsettings(),self); 43 44 end 45 end% }}} 46 end 26 47 methods 48 27 49 function self = solidearthsettings(varargin) % {{{ 28 50 switch nargin … … 43 65 44 66 %computational flags: 45 self. rigid=1;67 self.selfattraction=1; 46 68 self.elastic=1; 47 69 self.viscous=1; 48 70 self.rotation=1; 71 self.grdocean=1; 49 72 self.ocean_area_scaling=0; 50 73 self.compute_bp_grd=0; 51 74 self.isgrd=0; 52 self. computesealevelchange=1;75 self.sealevelloading=1; 53 76 54 77 %numerical discretization accuracy … … 83 106 md = checkfield(md,'fieldname','solidearth.settings.grdmodel','>=',0,'<=',2); 84 107 md = checkfield(md,'fieldname','solidearth.settings.cross_section_shape','numel',[1],'values',[1,2]); 85 86 %checks on computational flags 87 if self.elastic==1 & self.rigid==0, 88 error('solidearthsettings checkconsistency error message: need rigid on if elastic flag is set'); 108 if self.elastic==1 & self.selfattraction==0, 109 error('solidearthsettings checkconsistency error message: need selfattraction on if elastic flag is set'); 89 110 end 90 111 if self.viscous==1 & self.elastic==0, … … 103 124 end 104 125 end 126 if self.sealevelloading==1 & self.grdocean==0 127 error('solidearthsettings checkconsistency error message: need grdocean on if sealevelloading flag is set'); 128 end 105 129 end 106 130 … … 116 140 fielddisplay(self,'abstol','sea level change absolute convergence criterion, NaN: not applied'); 117 141 fielddisplay(self,'maxiter','maximum number of nonlinear iterations'); 142 fielddisplay(self,'grdocean','does this planet have an ocean, if set to 1: global water mass is conserved in GRD module [default: 1]'); 118 143 fielddisplay(self,'ocean_area_scaling','correction for model representation of ocean area [default: No correction]'); 119 fielddisplay(self,' computesealevelchange','compute sealevel change (default 1)');144 fielddisplay(self,'sealevelloading','enables surface loading from sea-level change (default 1)'); 120 145 fielddisplay(self,'isgrd','compute GRD patterns (default 1)'); 121 146 fielddisplay(self,'compute_bp_grd','compute GRD patterns for bottom pressure loads (default 1)'); 122 147 fielddisplay(self,'runfrequency','how many time steps we skip before we run solidearthsettings solver during transient (default: 1)'); 123 fielddisplay(self,' rigid','rigid earth graviational potential perturbation');124 fielddisplay(self,'elastic','e lastic earth graviational potential perturbation');125 fielddisplay(self,'viscous',' viscous earth graviational potential perturbation');126 fielddisplay(self,'rotation','e arth rotational potential perturbation');148 fielddisplay(self,'selfattraction','enables surface mass load to perturb the gravity field'); 149 fielddisplay(self,'elastic','enables elastic deformation from surface loading'); 150 fielddisplay(self,'viscous','enables viscous deformation from surface loading'); 151 fielddisplay(self,'rotation','enables polar motion to feedback on the GRD fields'); 127 152 fielddisplay(self,'degacc','accuracy (default .01 deg) for numerical discretization of the Green''s functions'); 128 153 fielddisplay(self,'timeacc','time accuracy (default 1 yr) for numerical discretization of the Green''s functions'); 129 fielddisplay(self,'grdmodel','type of deformation model, 1 for elastic, 2 for visco-elastic from Ivins');154 fielddisplay(self,'grdmodel','type of deformation model, 0 for no GRD, 1 for spherical GRD model (SESAW model), 2 for half-space planar GRD (visco-elastic model from Ivins)'); 130 155 fielddisplay(self,'cross_section_shape','1: square-edged (default). 2: elliptical. See iedge in GiaDeflectionCore'); 131 156 end % }}} … … 134 159 WriteData(fid,prefix,'object',self,'fieldname','abstol','name','md.solidearth.settings.abstol','format','Double'); 135 160 WriteData(fid,prefix,'object',self,'fieldname','maxiter','name','md.solidearth.settings.maxiter','format','Integer'); 136 WriteData(fid,prefix,'object',self,'fieldname',' rigid','name','md.solidearth.settings.rigid','format','Boolean');161 WriteData(fid,prefix,'object',self,'fieldname','selfattraction','name','md.solidearth.settings.selfattraction','format','Boolean'); 137 162 WriteData(fid,prefix,'object',self,'fieldname','elastic','name','md.solidearth.settings.elastic','format','Boolean'); 138 163 WriteData(fid,prefix,'object',self,'fieldname','viscous','name','md.solidearth.settings.viscous','format','Boolean'); 139 164 WriteData(fid,prefix,'object',self,'fieldname','rotation','name','md.solidearth.settings.rotation','format','Boolean'); 165 WriteData(fid,prefix,'object',self,'fieldname','grdocean','name','md.solidearth.settings.grdocean','format','Boolean'); 140 166 WriteData(fid,prefix,'object',self,'fieldname','ocean_area_scaling','name','md.solidearth.settings.ocean_area_scaling','format','Boolean'); 141 167 WriteData(fid,prefix,'object',self,'fieldname','runfrequency','name','md.solidearth.settings.runfrequency','format','Integer'); … … 143 169 WriteData(fid,prefix,'object',self,'fieldname','timeacc','name','md.solidearth.settings.timeacc','format','Double','scale',md.constants.yts); 144 170 WriteData(fid,prefix,'object',self,'fieldname','horiz','name','md.solidearth.settings.horiz','format','Integer'); 145 WriteData(fid,prefix,'object',self,'fieldname',' computesealevelchange','name','md.solidearth.settings.computesealevelchange','format','Integer');171 WriteData(fid,prefix,'object',self,'fieldname','sealevelloading','name','md.solidearth.settings.sealevelloading','format','Integer'); 146 172 WriteData(fid,prefix,'object',self,'fieldname','isgrd','name','md.solidearth.settings.isgrd','format','Integer'); 147 173 WriteData(fid,prefix,'object',self,'fieldname','compute_bp_grd','name','md.solidearth.settings.compute_bp_grd','format','Integer'); … … 154 180 writejsdouble(fid,[modelname '.solidearth.settings.reltol'],self.reltol); 155 181 writejsdouble(fid,[modelname '.solidearth.settings.abstol'],self.abstol); 156 writejsdouble(fid,[modelname '.solidearth.settings. rigid'],self.rigid);182 writejsdouble(fid,[modelname '.solidearth.settings.selfattraction'],self.selfattraction); 157 183 writejsdouble(fid,[modelname '.solidearth.settings.elastic'],self.elastic); 158 184 writejsdouble(fid,[modelname '.solidearth.settings.viscous'],self.viscous); 159 185 writejsdouble(fid,[modelname '.solidearth.settings.rotation'],self.rotation); 186 writejsdouble(fid,[modelname '.solidearth.settings.grdocean'],self.rotation); 160 187 writejsdouble(fid,[modelname '.solidearth.settings.ocean_area_scaling'],self.ocean_area_scaling); 161 188 writejsdouble(fid,[modelname '.solidearth.settings.run_frequency'],self.run_frequency); -
issm/trunk-jpl/test/NightlyRun/test2001.m
r26165 r26296 17 17 md.initialization.sealevel=zeros(md.mesh.numberofvertices,1); 18 18 md.solidearth.settings.cross_section_shape=1; % for square-edged x-section 19 md.solidearth.settings.computesealevelchange=0; %do not compute sea level, only deformation 19 md.solidearth.settings.grdocean=0; %do not compute sea level, only deformation 20 md.solidearth.settings.sealevelloading=0; %do not compute sea level, only deformation 20 21 md.solidearth.requested_outputs={'Sealevel','BedGRD'}; 21 22 -
issm/trunk-jpl/test/NightlyRun/test2002.m
r26268 r26296 3 3 %mesh earth: 4 4 md=model; 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',500.); %700 km resolution mesh 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 6 7 7 %Geometry for the bed, arbitrary thickness of 100 0:8 %Geometry for the bed, arbitrary thickness of 100: 8 9 md.geometry.bed=zeros(md.mesh.numberofvertices,1); 9 10 md.geometry.base=md.geometry.bed; … … 70 71 md.solidearth.settings.reltol=NaN; 71 72 md.solidearth.settings.abstol=1e-3; 72 md.solidearth.settings. computesealevelchange=1;73 md.solidearth.settings.sealevelloading=1; 73 74 md.solidearth.settings.isgrd=1; 74 75 md.solidearth.settings.ocean_area_scaling=0; … … 87 88 88 89 %eustatic run: 89 md.solidearth.settings. rigid=0;90 md.solidearth.settings.selfattraction=0; 90 91 md.solidearth.settings.elastic=0; 91 92 md.solidearth.settings.rotation=0; … … 96 97 Beustatic=md.results.TransientSolution.Bed; 97 98 98 %eustatic + rigidrun:99 md.solidearth.settings. rigid=1;99 %eustatic + selfattraction run: 100 md.solidearth.settings.selfattraction=1; 100 101 md.solidearth.settings.elastic=0; 101 102 md.solidearth.settings.rotation=0; 102 103 md.solidearth.settings.viscous=0; 103 104 md=solve(md,'tr'); 104 S rigid=md.results.TransientSolution.Sealevel;105 B rigid=md.results.TransientSolution.Bed;105 Sselfattraction=md.results.TransientSolution.Sealevel; 106 Bselfattraction=md.results.TransientSolution.Bed; 106 107 107 %eustatic + rigid+ elastic run:108 md.solidearth.settings. rigid=1;108 %eustatic + selfattraction + elastic run: 109 md.solidearth.settings.selfattraction=1; 109 110 md.solidearth.settings.elastic=1; 110 111 md.solidearth.settings.rotation=0; … … 114 115 Belastic=md.results.TransientSolution.Bed; 115 116 116 %eustatic + rigid+ elastic + rotation run:117 md.solidearth.settings. rigid=1;117 %eustatic + selfattraction + elastic + rotation run: 118 md.solidearth.settings.selfattraction=1; 118 119 md.solidearth.settings.elastic=1; 119 120 md.solidearth.settings.rotation=1; … … 124 125 125 126 %Fields and tolerances to track changes 126 field_names={'Seustatic','S rigid','Selastic','Srotation','Beustatic','Brigid','Belastic','Brotation'};127 field_names={'Seustatic','Sselfattraction','Selastic','Srotation','Beustatic','Bselfattraction','Belastic','Brotation'}; 127 128 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13}; 128 field_values={Seustatic,S rigid,Selastic,Srotation,Beustatic,Brigid,Belastic,Brotation};129 field_values={Seustatic,Sselfattraction,Selastic,Srotation,Beustatic,Bselfattraction,Belastic,Brotation}; -
issm/trunk-jpl/test/NightlyRun/test2003.m
r26269 r26296 3 3 %mesh earth: 4 4 md=model; 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',1000.); %1000 km resolution mesh 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 6 7 7 8 %Geometry for the bed, arbitrary thickness of 1000: … … 62 63 md.solidearth.settings.reltol=NaN; 63 64 md.solidearth.settings.abstol=1e-3; 64 md.solidearth.settings.computesealevelchange=0; 65 md.solidearth.settings.sealevelloading=0; 66 md.solidearth.settings.grdocean=0; 65 67 md.solidearth.settings.isgrd=1; 66 68 md.solidearth.settings.ocean_area_scaling=0; … … 68 70 md.solidearth.settings.horiz=1; 69 71 md.solidearth.requested_outputs={'Sealevel','Bed', 'BedEast', 'BedNorth'}; 70 71 72 72 73 %Physics: … … 81 82 md.timestepping.final_time=1; 82 83 83 %eustatic + rigid+ elastic run:84 md.solidearth.settings. rigid=1;84 %eustatic + selfattraction + elastic run: 85 md.solidearth.settings.selfattraction=1; 85 86 md.solidearth.settings.elastic=1; 86 87 md.solidearth.settings.rotation=0; … … 94 95 BNnoRotation=md.results.TransientSolution.BedNorth; 95 96 96 %eustatic + rigid+ elastic + rotation run:97 md.solidearth.settings. rigid=1;97 %eustatic + selfattraction + elastic + rotation run: 98 md.solidearth.settings.selfattraction=1; 98 99 md.solidearth.settings.elastic=1; 99 100 md.solidearth.settings.rotation=1; … … 108 109 109 110 %Fields and tolerances to track changes 110 field_names ={' noRotation','Rotation'};111 field_names ={'Sealevel', 'Uplift', 'NorthDisplacement', 'EastDisplacement'}; 111 112 field_tolerances={1e-13,1e-13,1e-13,1e-13}; 112 113 field_values={SRotation-SnoRotation,BURotation-BUnoRotation,BNRotation-BNnoRotation,BERotation-BEnoRotation}; -
issm/trunk-jpl/test/NightlyRun/test2004.m
r26121 r26296 395 395 md.solidearth.settings.reltol=NaN; 396 396 md.solidearth.settings.abstol=1e-3; 397 md.solidearth.settings. computesealevelchange=1;397 md.solidearth.settings.sealevelloading=1; 398 398 md.solidearth.settings.isgrd=1; 399 399 md.solidearth.settings.ocean_area_scaling=0; … … 423 423 424 424 %eustatic run: 425 md.solidearth.settings. rigid=0;425 md.solidearth.settings.selfattraction=0; 426 426 md.solidearth.settings.elastic=0; 427 427 md.solidearth.settings.rotation=0; … … 432 432 Seustatic=md.results.TransientSolution.Sealevel; 433 433 434 %eustatic + rigidrun:435 md.solidearth.settings. rigid=1;434 %eustatic + selfattraction run: 435 md.solidearth.settings.selfattraction=1; 436 436 md.solidearth.settings.elastic=0; 437 437 md.solidearth.settings.rotation=0; 438 438 md=solve(md,'Transient'); 439 S rigid=md.results.TransientSolution.Sealevel;440 441 %eustatic + rigid+ elastic run:442 md.solidearth.settings. rigid=1;439 Sselfattraction=md.results.TransientSolution.Sealevel; 440 441 %eustatic + selfattraction + elastic run: 442 md.solidearth.settings.selfattraction=1; 443 443 md.solidearth.settings.elastic=1; 444 444 md.solidearth.settings.rotation=0; … … 446 446 Selastic=md.results.TransientSolution.Sealevel; 447 447 448 %eustatic + rigid+ elastic + rotation run:449 md.solidearth.settings. rigid=1;448 %eustatic + selfattraction + elastic + rotation run: 449 md.solidearth.settings.selfattraction=1; 450 450 md.solidearth.settings.elastic=1; 451 451 md.solidearth.settings.rotation=1; … … 457 457 field_names ={'Eustatic','Rigid','Elastic','Rotation'}; 458 458 field_tolerances={1e-13,1e-13,1e-13,1e-13}; 459 field_values={Seustatic,S rigid,Selastic,Srotation};459 field_values={Seustatic,Sselfattraction,Selastic,Srotation}; -
issm/trunk-jpl/test/NightlyRun/test2005.m
r26054 r26296 1 %Test Name: Earth Slc1 %Test Name: Earthslc_time 2 2 3 3 %mesh earth: 4 4 md=model; 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); %700 km resolution mesh 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 6 7 7 %parameterize solidearth solution: 8 %Geometry for the bed, arbitrary thickness of 100: 9 md.geometry.bed=zeros(md.mesh.numberofvertices,1); 10 md.geometry.base=md.geometry.bed; 11 md.geometry.thickness=100*ones(md.mesh.numberofvertices,1); 12 md.geometry.surface=md.geometry.bed+md.geometry.thickness; 13 8 14 %solidearth loading: {{{ 9 md.solidearth.surfaceload.icethicknesschange=zeros(md.mesh.numberofelements,1); 10 md.solidearth.initialsealevel=zeros(md.mesh.numberofvertices,1); 11 md.dsl.global_average_thermosteric_sea_level_change=[1;0]; 12 md.dsl.sea_surface_height_change_above_geoid=zeros(md.mesh.numberofvertices+1,1); 13 md.dsl.sea_water_pressure_change_at_sea_floor=zeros(md.mesh.numberofvertices+1,1); 15 md.masstransport.spcthickness=[md.geometry.thickness;0]; 16 md.smb.mass_balance=zeros(md.mesh.numberofvertices,1); 14 17 %antarctica 15 late=sum(md.mesh.lat(md.mesh.elements),2)/3; 16 longe=sum(md.mesh.long(md.mesh.elements),2)/3; 18 xe=md.mesh.x(md.mesh.elements)*[1;1;1]/3; 19 ye=md.mesh.y(md.mesh.elements)*[1;1;1]/3; 20 ze=md.mesh.z(md.mesh.elements)*[1;1;1]/3; 21 re=sqrt(xe.^2+ye.^2+ze.^2); 22 23 late=asind(ze./re); 24 longe=atan2d(ye,xe); 17 25 pos=find(late < -80); 18 md.solidearth.surfaceload.icethicknesschange(pos)=-100; 26 md.masstransport.spcthickness(md.mesh.elements(pos,:))= md.masstransport.spcthickness(md.mesh.elements(pos,:))-100; 27 posant=pos; 19 28 %greenland 20 pos=find(late>70 & late<80 & longe>-60 & longe<-30); 21 md.solidearth.surfaceload.icethicknesschange(pos)=-100; 29 pos=find(late>60 & late<90 & longe>-75 & longe<-15); 30 md.masstransport.spcthickness(md.mesh.elements(pos,:))= md.masstransport.spcthickness(md.mesh.elements(pos,:))-100; 31 posgre=pos; 22 32 23 33 %elastic loading from love numbers: 24 md.solidearth.lovenumbers=lovenumbers('maxdeg',100 );34 md.solidearth.lovenumbers=lovenumbers('maxdeg',1000); 25 35 26 36 %}}} 27 37 %mask: {{{ 28 38 mask=gmtmask(md.mesh.lat,md.mesh.long); 39 oceanmask=-ones(md.mesh.numberofvertices,1); 40 pos=find(mask==0); oceanmask(pos)=1; 41 29 42 icemask=ones(md.mesh.numberofvertices,1); 30 pos=find(mask==0); 31 icemask(pos)=-1; 32 pos=find(sum(mask(md.mesh.elements),2)<3); 33 icemask(md.mesh.elements(pos,:))=-1; 43 icemask(md.mesh.elements(posant))=-1; 44 icemask(md.mesh.elements(posgre))=-1; 45 34 46 md.mask.ice_levelset=icemask; 35 md.mask.ocean_levelset=-icemask; 36 37 %make sure that the elements that have loads are fully grounded: 38 pos=find(md.solidearth.surfaceload.icethicknesschange); 39 md.mask.ocean_levelset(md.mesh.elements(pos,:))=1; 40 41 %make sure wherever there is an ice load, that the mask is set to ice: 42 %pos=find(md.solidearth.surfaceload.icethicknesschange); % TODO: Do we need to do this twice? 43 md.mask.ice_levelset(md.mesh.elements(pos,:))=-1; 47 md.mask.ocean_levelset=oceanmask; 44 48 % }}} 45 49 46 md.solidearth.settings.ocean_area_scaling=0; 50 %time stepping: 51 md.timestepping.start_time=0; 52 md.timestepping.time_step=1; 53 md.timestepping.final_time=10; 47 54 48 %Geometry for the bed, arbitrary: 49 md.geometry.bed=-ones(md.mesh.numberofvertices,1); 55 %masstransport: 56 md.basalforcings.groundedice_melting_rate=zeros(md.mesh.numberofvertices,1); 57 md.basalforcings.floatingice_melting_rate=zeros(md.mesh.numberofvertices,1); 58 md.initialization.vx=zeros(md.mesh.numberofvertices,1); 59 md.initialization.vy=zeros(md.mesh.numberofvertices,1); 60 md.initialization.sealevel=zeros(md.mesh.numberofvertices,1); 61 md.initialization.str=0; 50 62 51 63 %Materials: … … 56 68 57 69 %Solution parameters 70 md.cluster.np=3; 58 71 md.solidearth.settings.reltol=NaN; 59 72 md.solidearth.settings.abstol=1e-3; 60 md.solidearth.settings.computesealevelchange=1; 73 md.solidearth.settings.sealevelloading=1; 74 md.solidearth.settings.isgrd=1; 75 md.solidearth.settings.ocean_area_scaling=0; 76 md.solidearth.settings.grdmodel=1; 61 77 62 % max number of iteration reverted back to 10 (i.e., the original default value) 63 md.solidearth.settings.maxiter=10; 64 65 %eustatic + rigid + elastic + rotation run: 66 md.solidearth.settings.rigid=1; 78 md.solidearth.settings.selfattraction=1; 67 79 md.solidearth.settings.elastic=1; 68 80 md.solidearth.settings.rotation=1; 81 md.solidearth.settings.viscous=0; 69 82 70 %transient settings: 71 md.timestepping.start_time=0; 72 md.timestepping.final_time=10; 73 md.timestepping.time_step=1; 74 md.transient.isslc=1; 75 md.transient.issmb=0; 76 md.transient.ismasstransport=0; 83 %Physics: 84 md.transient.issmb=0; 77 85 md.transient.isstressbalance=0; 78 86 md.transient.isthermal=0; 79 dh=md.solidearth.surfaceload.icethicknesschange; 80 deltathickness=zeros(md.mesh.numberofelements+1,10); 81 for i=1:10, 82 deltathickness(1:end-1,i)=dh*i; 87 md.transient.ismasstransport=1; 88 md.transient.isslc=1; 89 md.solidearth.requested_outputs={'Sealevel'}; 90 91 dh=md.masstransport.spcthickness; 92 deltathickness=zeros(md.mesh.numberofvertices+1,10); 93 for i=0:10, 94 deltathickness(1:end-1,i+1)=md.geometry.thickness+dh(1:end-1)*i; 83 95 end 84 deltathickness(end,:)=0:1: 9;85 md. solidearth.surfaceload.icethicknesschange=deltathickness;96 deltathickness(end,:)=0:1:10; 97 md.masstransport.spcthickness=deltathickness; 86 98 %hack: 87 99 md.geometry.surface=zeros(md.mesh.numberofvertices,1); … … 89 101 md.geometry.base=-ones(md.mesh.numberofvertices,1); 90 102 md.geometry.bed=md.geometry.base; 103 91 104 92 105 %run transient solution: -
issm/trunk-jpl/test/NightlyRun/test2006.m
r26054 r26296 3 3 %mesh earth: 4 4 md=model; 5 md.cluster=generic('name',oshostname(),'np',5); 6 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); %700 km resolution mesh 7 8 %parameterize solidearth solution: 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 7 8 %Geometry for the bed, arbitrary thickness of 100: 9 md.geometry.bed=zeros(md.mesh.numberofvertices,1); 10 md.geometry.base=md.geometry.bed; 11 md.geometry.thickness=100*ones(md.mesh.numberofvertices,1); 12 md.geometry.surface=md.geometry.bed+md.geometry.thickness; 13 9 14 %solidearth loading: {{{ 10 md.solidearth.surfaceload.icethicknesschange=zeros(md.mesh.numberofelements,1); 11 md.solidearth.initialsealevel=zeros(md.mesh.numberofvertices,1); 12 md.dsl.global_average_thermosteric_sea_level_change=[1;0]; 13 md.dsl.sea_surface_height_change_above_geoid=zeros(md.mesh.numberofvertices+1,1); 14 md.dsl.sea_water_pressure_change_at_sea_floor=zeros(md.mesh.numberofvertices+1,1); 15 md.masstransport.spcthickness=[md.geometry.thickness;0]; 16 md.smb.mass_balance=zeros(md.mesh.numberofvertices,1); 15 17 %antarctica 16 late=sum(md.mesh.lat(md.mesh.elements),2)/3; 17 longe=sum(md.mesh.long(md.mesh.elements),2)/3; 18 xe=md.mesh.x(md.mesh.elements)*[1;1;1]/3; 19 ye=md.mesh.y(md.mesh.elements)*[1;1;1]/3; 20 ze=md.mesh.z(md.mesh.elements)*[1;1;1]/3; 21 re=sqrt(xe.^2+ye.^2+ze.^2); 22 23 late=asind(ze./re); 24 longe=atan2d(ye,xe); 18 25 pos=find(late < -80); 19 md.solidearth.surfaceload.icethicknesschange(pos)=-100; 26 md.masstransport.spcthickness(md.mesh.elements(pos,:))= md.masstransport.spcthickness(md.mesh.elements(pos,:))-100; 27 posant=pos; 20 28 %greenland 21 pos=find(late>70 & late<80 & longe>-60 & longe<-30); 22 md.solidearth.surfaceload.icethicknesschange(pos)=-100; 29 pos=find(late>60 & late<90 & longe>-75 & longe<-15); 30 md.masstransport.spcthickness(md.mesh.elements(pos,:))= md.masstransport.spcthickness(md.mesh.elements(pos,:))-100; 31 posgre=pos; 23 32 24 33 %elastic loading from love numbers: … … 28 37 %mask: {{{ 29 38 mask=gmtmask(md.mesh.lat,md.mesh.long); 39 oceanmask=-ones(md.mesh.numberofvertices,1); 40 pos=find(mask==0); oceanmask(pos)=1; 41 30 42 icemask=ones(md.mesh.numberofvertices,1); 31 pos=find(mask==0); 32 icemask(pos)=-1; 33 pos=find(sum(mask(md.mesh.elements),2)<3); 34 icemask(md.mesh.elements(pos,:))=-1; 43 icemask(md.mesh.elements(posant))=-1; 44 icemask(md.mesh.elements(posgre))=-1; 45 35 46 md.mask.ice_levelset=icemask; 36 md.mask.ocean_levelset=-icemask; 37 38 %make sure that the elements that have loads are fully grounded: 39 pos=find(md.solidearth.surfaceload.icethicknesschange); 40 md.mask.ocean_levelset(md.mesh.elements(pos,:))=1; 41 42 %make sure wherever there is an ice load, that the mask is set to ice: 43 pos=find(md.solidearth.surfaceload.icethicknesschange); 44 md.mask.ice_levelset(md.mesh.elements(pos,:))=-1; 47 md.mask.ocean_levelset=oceanmask; 45 48 % }}} 46 49 47 md.solidearth.settings.ocean_area_scaling=0; 48 49 %Geometry for the bed, arbitrary: 50 md.geometry.bed=-ones(md.mesh.numberofvertices,1); 50 %time stepping: 51 md.timestepping.start_time=0; 52 md.timestepping.time_step=1; 53 md.timestepping.final_time=10; 54 55 %masstransport: 56 md.basalforcings.groundedice_melting_rate=zeros(md.mesh.numberofvertices,1); 57 md.basalforcings.floatingice_melting_rate=zeros(md.mesh.numberofvertices,1); 58 md.initialization.vx=zeros(md.mesh.numberofvertices,1); 59 md.initialization.vy=zeros(md.mesh.numberofvertices,1); 60 md.initialization.sealevel=zeros(md.mesh.numberofvertices,1); 61 md.initialization.str=0; 51 62 52 63 %Materials: … … 57 68 58 69 %Solution parameters 70 md.cluster.np=3; 59 71 md.solidearth.settings.reltol=NaN; 60 72 md.solidearth.settings.abstol=1e-3; 61 md.solidearth.settings.computesealevelchange=1; 62 63 % max number of iteration reverted back to 10 (i.e., the original default value) 64 md.solidearth.settings.maxiter=10; 65 66 %eustatic + rigid + elastic + rotation run: 67 md.solidearth.settings.rigid=1; 73 md.solidearth.settings.sealevelloading=1; 74 md.solidearth.settings.isgrd=1; 75 md.solidearth.settings.ocean_area_scaling=0; 76 md.solidearth.settings.grdmodel=1; 77 78 md.solidearth.settings.selfattraction=1; 68 79 md.solidearth.settings.elastic=1; 69 80 md.solidearth.settings.rotation=1; 70 71 %transient settings: 72 md.timestepping.start_time=0; 73 md.timestepping.final_time=10; 74 md.timestepping.time_step=1; 75 md.transient.isslc=1; 76 md.transient.issmb=0; 77 md.transient.ismasstransport=0; 81 md.solidearth.settings.viscous=0; 82 83 %Physics: 84 md.transient.issmb=0; 78 85 md.transient.isstressbalance=0; 79 86 md.transient.isthermal=0; 80 dh=md.solidearth.surfaceload.icethicknesschange; 81 deltathickness=zeros(md.mesh.numberofelements+1,10); 82 for i=1:10, 83 deltathickness(1:end-1,i)=dh*i; 87 md.transient.ismasstransport=1; 88 md.transient.isslc=1; 89 md.solidearth.requested_outputs={'Sealevel'}; 90 91 dh=md.masstransport.spcthickness; 92 deltathickness=zeros(md.mesh.numberofvertices+1,10); 93 for i=0:10, 94 deltathickness(1:end-1,i+1)=md.geometry.thickness+dh(1:end-1)*i; 84 95 end 85 deltathickness(end,:)=0:1: 9;86 md. solidearth.surfaceload.icethicknesschange=deltathickness;96 deltathickness(end,:)=0:1:10; 97 md.masstransport.spcthickness=deltathickness; 87 98 88 99 %hack: -
issm/trunk-jpl/test/NightlyRun/test2007.m
r26274 r26296 1 %Test Name: offline solid earth solution1 %Test Name: External_OfflineSolidearthSolution 2 2 3 3 %mesh earth: 4 4 md=model; 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); %700 km resolution mesh 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 6 7 7 %Geometry for the bed, arbitrary thickness of 1000:8 %Geometry for the bed, arbitrary 8 9 md.geometry.bed=-ones(md.mesh.numberofvertices,1); 9 10 md.geometry.base=md.geometry.bed; … … 46 47 %Solution parameters 47 48 md.cluster.np=3; 49 md.solidearth.settings.isgrd=0; 48 50 md.solidearth.settings.horiz=1; 49 51 -
issm/trunk-jpl/test/NightlyRun/test2008.m
r26274 r26296 1 %Test Name: External :AdditionalSolidearthSolution1 %Test Name: External_AdditionalSolidearthSolution 2 2 3 3 %mesh earth: 4 4 md=model; 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); %700 km resolution mesh 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 6 7 7 8 %Geometry for the bed, arbitrary thickness of 100: … … 70 71 md.solidearth.settings.reltol=NaN; 71 72 md.solidearth.settings.abstol=1e-3; 72 md.solidearth.settings. computesealevelchange=1;73 md.solidearth.settings.sealevelloading=1; 73 74 md.solidearth.settings.isgrd=1; 74 75 md.solidearth.settings.ocean_area_scaling=0; … … 86 87 md.solidearth.settings.maxiter=10; 87 88 88 %eustatic + rigid+ elastic:89 md.solidearth.settings. rigid=1;89 %eustatic + selfattraction + elastic: 90 md.solidearth.settings.selfattraction=1; 90 91 md.solidearth.settings.elastic=1; 91 92 md.solidearth.settings.rotation=0; -
issm/trunk-jpl/test/NightlyRun/test2010.m
r25956 r26296 3 3 %mesh earth: 4 4 md=model; 5 rad_e = 6.371012*10^3; % mean radius of Earth, km 6 md.mesh=gmshplanet('radius',rad_e,'resolution',1000.0); % km resolution 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 7 8 %Geometry for the bed, arbitrary thickness of 1000: 9 md.geometry.bed=-ones(md.mesh.numberofvertices,1); 10 md.geometry.base=md.geometry.bed; 11 md.geometry.thickness=100*ones(md.mesh.numberofvertices,1); 12 md.geometry.surface=md.geometry.bed+md.geometry.thickness; 13 7 14 8 15 %parameterize slc solution: 9 %s lcloading: {{{10 late=sum(md.mesh.lat(md.mesh.elements),2)/3;11 longe=sum(md.mesh.long(md.mesh.elements),2)/3;16 %solidearth loading: {{{ 17 md.masstransport.spcthickness=[md.geometry.thickness;0]; 18 md.smb.mass_balance=zeros(md.mesh.numberofvertices,1); 12 19 13 md.solidearth.surfaceload.icethicknesschange=zeros(md.mesh.numberofelements,1);14 pos=find(late <-75 & longe >0);15 md.solidearth.surfaceload.icethicknesschange(pos(6:7))=-1;16 20 17 md.solidearth.initialsealevel=zeros(md.mesh.numberofvertices,1);18 md.dsl.global_average_thermosteric_sea_level_change=[0;0];19 md.dsl.sea_surface_height_change_above_geoid=zeros(md.mesh.numberofvertices+1,1);20 md.dsl.sea_water_pressure_change_at_sea_floor=zeros(md.mesh.numberofvertices+1,1);21 xe=md.mesh.x(md.mesh.elements)*[1;1;1]/3; 22 ye=md.mesh.y(md.mesh.elements)*[1;1;1]/3; 23 ze=md.mesh.z(md.mesh.elements)*[1;1;1]/3; 24 re=sqrt(xe.^2+ye.^2+ze.^2); 21 25 22 md.solidearth.settings.ocean_area_scaling = 1; 26 late=asind(ze./re); 27 longe=atan2d(ye,xe); 28 %greenland 29 pos=find(late>60 & late<90 & longe>-75 & longe<-15); 30 md.masstransport.spcthickness(md.mesh.elements(pos,:))= md.masstransport.spcthickness(md.mesh.elements(pos,:))-100; 31 posice=pos; 23 32 24 33 %elastic loading from love numbers: 25 md.solidearth.lovenumbers=lovenumbers('maxdeg',100 0);34 md.solidearth.lovenumbers=lovenumbers('maxdeg',100); 26 35 27 36 %}}} … … 29 38 mask=gmtmask(md.mesh.lat,md.mesh.long); 30 39 icemask=ones(md.mesh.numberofvertices,1); 31 pos=find(mask==0); 32 icemask(pos)=-1; 33 pos=find(sum(mask(md.mesh.elements),2)<3); 34 icemask(md.mesh.elements(pos,:))=-1; 40 icemask(md.mesh.elements(posice,:))=-0.5; 41 42 oceanmask=-ones(md.mesh.numberofvertices,1); 43 pos=find(mask==0); oceanmask(pos)=1; icemask(~pos)=1; 44 35 45 md.mask.ice_levelset=icemask; 36 md.mask.ocean_levelset= -icemask;46 md.mask.ocean_levelset=oceanmask; 37 47 38 %make sure that the elements that have loads are fully grounded: 39 pos=find(md.solidearth.surfaceload.icethicknesschange); 40 md.mask.ocean_levelset(md.mesh.elements(pos,:))=1; 48 % use model representation of ocen area (not the true area) 49 md.solidearth.settings.ocean_area_scaling = 0; 41 50 42 %make sure wherever there is an ice load, that the mask is set to ice: 43 md.mask.ice_levelset=ones(md.mesh.numberofvertices,1); 44 pos=find(md.solidearth.surfaceload.icethicknesschange); 45 md.mask.ice_levelset(md.mesh.elements(pos,:))=-1; 46 % }}} 51 %materials 52 md.initialization.temperature=273.25*ones(md.mesh.numberofvertices,1); 53 md.initialization.sealevel=zeros(md.mesh.numberofvertices,1); 54 md.initialization.str=0; 47 55 48 %geometry {{{ 49 di=md.materials.rho_ice/md.materials.rho_water; 50 md.geometry.thickness=ones(md.mesh.numberofvertices,1); 51 md.geometry.surface=(1-di)*zeros(md.mesh.numberofvertices,1); 52 md.geometry.base=md.geometry.surface-md.geometry.thickness; 53 md.geometry.bed=md.geometry.base; 54 % }}} 55 %materials {{{ 56 md.initialization.temperature=273.25*ones(md.mesh.numberofvertices,1); 57 md.materials.rheology_B=paterson(md.initialization.temperature); 58 md.materials.rheology_n=3*ones(md.mesh.numberofelements,1); 59 % }}} 60 %Miscellaneous {{{ 56 md.basalforcings.groundedice_melting_rate=zeros(md.mesh.numberofvertices,1); 57 md.basalforcings.floatingice_melting_rate=zeros(md.mesh.numberofvertices,1); 58 md.initialization.vx=zeros(md.mesh.numberofvertices,1); 59 md.initialization.vy=zeros(md.mesh.numberofvertices,1); 60 61 %Miscellaneous 61 62 md.miscellaneous.name='test2010'; 62 % }}} 63 %Solution parameters {{{63 64 %Solution parameters 64 65 md.solidearth.settings.reltol=NaN; 65 66 md.solidearth.settings.abstol=1e-3; 66 md.solidearth.settings.computesealevelchange=1; 67 % }}} 67 md.solidearth.settings.sealevelloading=0; 68 md.solidearth.settings.grdocean=1; 69 md.solidearth.settings.isgrd=1; 70 md.solidearth.settings.ocean_area_scaling=0; 71 md.solidearth.settings.grdmodel=1; 72 md.solidearth.settings.horiz=1; 73 md.solidearth.requested_outputs={'Sealevel','SealevelBarystaticIceArea','SealevelBarystaticIceLoad','SealevelBarystaticIceMask','SealevelBarystaticIceLatbar' 'SealevelBarystaticIceLongbar'}; 68 74 69 %eustatic + rigid + elastic run: 70 md.solidearth.settings.rigid=1; 75 %Physics: 76 md.transient.issmb=0; 77 md.transient.isstressbalance=0; 78 md.transient.isthermal=0; 79 md.transient.ismasstransport=1; 80 md.transient.isslc=1; 81 82 md.timestepping.start_time=0; 83 md.timestepping.time_step=1; 84 md.timestepping.final_time=1; 85 86 %eustatic + selfattraction + elastic + rotation run: 87 md.solidearth.settings.selfattraction=1; 71 88 md.solidearth.settings.elastic=1; 72 89 md.solidearth.settings.rotation=1; 90 md.solidearth.settings.viscous=0; 73 91 md.cluster=generic('name',oshostname(),'np',3); 92 %md.verbose=verbose('111111111'); 93 md=solve(md,'Transient'); 74 94 95 moi_p=md.solidearth.rotational.polarmoi; 96 moi_e=md.solidearth.rotational.equatorialmoi; 97 tide_love_k2=md.solidearth.lovenumbers.tk(3); 98 load_love_k2=md.solidearth.lovenumbers.k(3); 99 tide_love_k2secular=md.solidearth.lovenumbers.tk2secular; 75 100 % uncomment following 2 lines for 76 md=solve(md,'Sealevelchange'); 77 eus=md.results.SealevelchangeSolution.Bslc; 78 slc=md.results.SealevelchangeSolution.Sealevel; 79 moixz=md.results.SealevelchangeSolution.SealevelInertiaTensorXZ; 80 moiyz=md.results.SealevelchangeSolution.SealevelInertiaTensorYZ; 81 moizz=md.results.SealevelchangeSolution.SealevelInertiaTensorZZ; 101 eus=md.results.TransientSolution.Bslc; 102 slc=md.results.TransientSolution.Sealevel; 103 moixz=md.results.TransientSolution.SealevelInertiaTensorXZ / (1/(1-tide_love_k2/tide_love_k2secular) * (1+load_love_k2)/(moi_p-moi_e) ); 104 moiyz=md.results.TransientSolution.SealevelInertiaTensorYZ / (1/(1-tide_love_k2/tide_love_k2secular) * (1+load_love_k2)/(moi_p-moi_e) ); 105 moizz=md.results.TransientSolution.SealevelInertiaTensorZZ / ( -(1+load_love_k2)/moi_p); 106 107 areaice=md.results.TransientSolution.SealevelBarystaticIceArea; 108 loadice=md.results.TransientSolution.SealevelBarystaticIceLoad; 82 109 83 110 % analytical moi => just checking FOR ICE only!!! {{{ 84 111 % ...have to mute ** slc induced MOI in Tria.cpp ** prior to the comparison 85 %rad_e = rad_e*1e3; % now in meters 86 %areas=GetAreasSphericalTria(md.mesh.elements,md.mesh.lat,md.mesh.long,rad_e); 87 %lat=late*pi/180; lon=longe*pi/180; 88 %moi_xz = sum(-md.materials.rho_freshwater.*md.solidearth.surfaceload.icethicknesschange.*areas.*rad_e^2.*sin(lat).*cos(lat).*cos(lon)); 89 %moi_yz = sum(-md.materials.rho_freshwater.*md.solidearth.surfaceload.icethicknesschange.*areas.*rad_e^2.*sin(lat).*cos(lat).*sin(lon)); 112 rad_e = md.solidearth.planetradius; 113 114 lat=md.results.TransientSolution.SealevelBarystaticIceLatbar*pi/180; 115 lon=md.results.TransientSolution.SealevelBarystaticIceLongbar*pi/180; 116 moi_xz = sum(-loadice.*areaice.*rad_e^2.*sin(lat).*cos(lat).*cos(lon)); 117 moi_yz = sum(-loadice.*areaice.*rad_e^2.*sin(lat).*cos(lat).*sin(lon)); 118 moi_zz = sum(-loadice.*areaice.*rad_e^2.*(1.0-sin(lat).^2)); 119 theoretical_value_check=[moixz/moi_xz moiyz/moi_yz moizz/moizz] 90 120 % }}} 91 121 92 122 %Fields and tolerances to track changes 93 123 field_names ={'eus','slc','moixz','moiyz','moizz'}; 94 field_tolerances={1e-13,1e-13,1e-13,1e-13 ,1e-13};124 field_tolerances={1e-13,1e-13,1e-13,1e-13}; 95 125 field_values={eus,slc,moixz,moiyz,moizz}; 96 126 -
issm/trunk-jpl/test/NightlyRun/test2011.m
r26222 r26296 1 %Test Name: EarthSlc1 %Test Name: SlcBarystatic 2 2 3 3 %mesh earth: 4 4 md=model; 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',500.); %700 km resolution mesh 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 6 7 7 8 %Geometry for the bed, arbitrary thickness of 1000: … … 70 71 71 72 %Miscellaneous 72 md.miscellaneous.name='test20 02';73 md.miscellaneous.name='test2011'; 73 74 74 75 %Solution parameters … … 76 77 md.solidearth.settings.reltol=NaN; 77 78 md.solidearth.settings.abstol=1e-3; 78 md.solidearth.settings. computesealevelchange=1;79 md.solidearth.settings.sealevelloading=1; 79 80 md.solidearth.settings.isgrd=1; 80 81 md.solidearth.settings.ocean_area_scaling=0; … … 94 95 95 96 %eustatic + rigid + elastic + rotation run: 96 md.solidearth.settings. rigid=1;97 md.solidearth.settings.selfattraction=1; 97 98 md.solidearth.settings.elastic=1; 98 md.solidearth.settings.rotation=1; 99 md.solidearth.settings.rotation=0; 100 md.solidearth.settings.viscous=0; 99 101 md=solve(md,'tr'); 100 102 … … 106 108 weights=md.results.TransientSolution(1).SealevelBarystaticIceWeights; 107 109 dH=md.results.TransientSolution(1).DeltaIceThickness(md.mesh.elements); 108 dHavg=sum(dH.*weights );110 dHavg=sum(dH.*weights,2); 109 111 oceanarea=sum(md.results.TransientSolution(1).SealevelBarystaticOceanArea); 110 112 bslc2=-sum(dHavg.*area)*md.materials.rho_ice/md.materials.rho_water/oceanarea; … … 113 115 field_names={'BarystaticIce','BarystaticIce2','BarystaticIceDiff'}; 114 116 field_tolerances={1e-13,1e-13,1e-13}; 115 field_values={bslc,bslc2,bslc2-bslc 2};117 field_values={bslc,bslc2,bslc2-bslc}; -
issm/trunk-jpl/test/NightlyRun/test2090.m
r26284 r26296 3 3 %mesh earth: 4 4 md=model; 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); %700 km resolution mesh 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 6 7 7 8 %Geometry for the bed, arbitrary thickness of 1000: … … 73 74 time1=md.timestepping.start_time:md.timestepping.time_step:md.timestepping.final_time; 74 75 md.masstransport.spcthickness=repmat(md.masstransport.spcthickness, [1 length(time1)]); 75 md.masstransport.spcthickness(1:end-1, 2:end)=0;76 md.masstransport.spcthickness(1:end-1,3:end)=0; 76 77 md.masstransport.spcthickness(end,:)=time1; 77 78 … … 92 93 93 94 %Solution parameters 94 md.cluster.np= 1;95 md.cluster.np=3; 95 96 md.solidearth.settings.reltol=NaN; 96 97 md.solidearth.settings.abstol=1e-3; 97 md.solidearth.settings. computesealevelchange=1;98 md.solidearth.settings.sealevelloading=1; 98 99 md.solidearth.settings.isgrd=1; 99 100 md.solidearth.settings.ocean_area_scaling=0; 100 101 md.solidearth.settings.grdmodel=1; 101 102 md.solidearth.settings.timeacc=md.timestepping.time_step; 102 md.solidearth.settings.degacc=. 01;103 md.solidearth.settings.degacc=.1; 103 104 104 105 %Physics: … … 113 114 md.solidearth.settings.maxiter=10; 114 115 115 %eustatic + rigid+ elastic + rotation run:116 md.solidearth.settings. rigid=1;116 %eustatic + selfattraction + elastic + rotation run: 117 md.solidearth.settings.selfattraction=1; 117 118 md.solidearth.settings.elastic=1; 118 119 md.solidearth.settings.viscous=1; … … 127 128 end 128 129 130 hold on 131 plot(md.timestepping.start_time:md.timestepping.time_step:(md.timestepping.final_time-md.timestepping.time_step), [B(916,:)]); 132 129 133 %Fields and tolerances to track changes 130 134 field_names={'Sealevel','Bed'};
Note:
See TracChangeset
for help on using the changeset viewer.