Changeset 19984
- Timestamp:
- 01/22/16 09:56:50 (9 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 4 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r19749 r19984 111 111 ./shared/Numerics/NewtonSolveDnorm.cpp\ 112 112 ./shared/Numerics/extrema.cpp\ 113 ./shared/Numerics/legendre.cpp\ 113 114 ./shared/Numerics/XZvectorsToCoordinateSystem.cpp\ 114 115 ./shared/Exceptions/Exceptions.cpp\ … … 464 465 endif 465 466 #}}} 467 #Slr sources {{{ 468 if SEALEVELRISE 469 issm_sources += ./cores/sealevelrise_core.cpp\ 470 ./analyses/SealevelriseAnalysis.cpp 471 endif 472 #}}} 466 473 #Metis sources {{{ 467 474 if METIS -
issm/trunk-jpl/src/c/analyses/EnumToAnalysis.cpp
r19720 r19984 116 116 case LsfReinitializationAnalysisEnum : return new LsfReinitializationAnalysis(); 117 117 #endif 118 #ifdef _HAVE_SEALEVELRISE_ 119 case SealevelriseAnalysisEnum : return new SealevelriseAnalysis(); 120 #endif 118 121 default : _error_("enum provided not supported ("<<EnumToStringx(analysis_enum)<<")"); 119 122 } -
issm/trunk-jpl/src/c/analyses/analyses.h
r19720 r19984 32 32 #include "./MasstransportAnalysis.h" 33 33 #include "./SmbAnalysis.h" 34 #include "./SealevelriseAnalysis.h" 34 35 #include "./MeltingAnalysis.h" 35 36 #include "./MeshdeformationAnalysis.h" -
issm/trunk-jpl/src/c/classes/Elements/Element.cpp
r19825 r19984 1464 1464 bool Element::IsIceInElement(){/*{{{*/ 1465 1465 return (this->inputs->Min(MaskIceLevelsetEnum)<0.); 1466 } 1467 /*}}}*/ 1468 bool Element::IsWaterInElement(){/*{{{*/ 1469 return (this->inputs->Max(MaskOceanLevelsetEnum)>0.); 1466 1470 } 1467 1471 /*}}}*/ … … 1516 1520 name==MaterialsRheologyBbarEnum || 1517 1521 name==MaterialsRheologyNEnum || 1522 name==SealevelriseSEnum || 1518 1523 name==GiaWEnum || 1519 1524 name==GiadWdtEnum || -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r19764 r19984 119 119 bool IsFloating(); 120 120 bool IsIceInElement(); 121 bool IsWaterInElement(); 121 122 bool IsInput(int name); 122 123 void LinearFloatingiceMeltingRate(); … … 299 300 virtual void GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y)=0; 300 301 #endif 302 #ifdef _HAVE_SEALEVELRISE_ 303 virtual void Sealevelrise(Vector<IssmDouble>* pSgi,Vector<IssmDouble>* pSgo,IssmDouble* peustatic,IssmDouble* Sg_old,IssmDouble* Sgi_old,IssmDouble* Sgo_old,IssmDouble* x,IssmDouble* y,IssmDouble* z,IssmDouble oceanarea)=0; 304 virtual IssmDouble OceanArea(void)=0; 305 #endif 306 301 307 }; 302 308 #endif -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r19764 r19984 180 180 void GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y); 181 181 #endif 182 #ifdef _HAVE_SEALEVELRISE_ 183 void Sealevelrise(Vector<IssmDouble>* pSgi,Vector<IssmDouble>* pSgo,IssmDouble* peustatic,IssmDouble* Sg_old,IssmDouble* Sgi_old,IssmDouble* Sgo_old,IssmDouble* x,IssmDouble* y,IssmDouble* z, IssmDouble oceanarea){_error_("not implemented yet!");}; 184 IssmDouble OceanArea(void){_error_("not implemented yet!");}; 185 #endif 186 182 187 /*}}}*/ 183 188 }; -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r19764 r19984 166 166 #endif 167 167 168 #ifdef _HAVE_SEALEVELRISE_ 169 void Sealevelrise(Vector<IssmDouble>* pSgi,Vector<IssmDouble>* pSgo,IssmDouble* peustatic,IssmDouble* Sg_old,IssmDouble* Sgi_old,IssmDouble* Sgo_old,IssmDouble* x,IssmDouble* y,IssmDouble* z,IssmDouble oceanarea){_error_("not implemented yet!");}; 170 IssmDouble OceanArea(void){_error_("not implemented yet!");}; 171 #endif 172 168 173 #ifdef _HAVE_DAKOTA_ 169 174 void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Tetra.h
r19764 r19984 172 172 void GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y){_error_("not implemented yet");}; 173 173 #endif 174 #ifdef _HAVE_SEALEVELRISE_ 175 void Sealevelrise(Vector<IssmDouble>* pSgi,Vector<IssmDouble>* pSgo,IssmDouble* peustatic,IssmDouble* Sg_old,IssmDouble* Sgi_old,IssmDouble* Sgo_old,IssmDouble* x,IssmDouble* y,IssmDouble* z,IssmDouble oceanarea){_error_("not implemented yet!");}; 176 IssmDouble OceanArea(void){_error_("not implemented yet!");}; 177 #endif 174 178 175 179 #ifdef _HAVE_DAKOTA_ -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r19825 r19984 1034 1034 _assert_(x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1>0); 1035 1035 return (x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1)/2; 1036 } 1037 /*}}}*/ 1038 IssmDouble Tria::GetArea3D(void){/*{{{*/ 1039 1040 IssmDouble xyz_list[NUMVERTICES][3]; 1041 IssmDouble x1,y1,z1,x2,y2,z2,x3,y3,z3; 1042 IssmDouble detm1,detm2,detm3; 1043 1044 /*Get xyz list: */ 1045 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 1046 x1=xyz_list[0][0]; y1=xyz_list[0][1]; z1=xyz_list[0][2]; 1047 x2=xyz_list[1][0]; y2=xyz_list[1][1]; z2=xyz_list[1][2]; 1048 x3=xyz_list[2][0]; y3=xyz_list[2][1]; z3=xyz_list[2][2]; 1049 1050 detm1=x1*y2 - x2*y1 - x1*y3 + x3*y1 + x2*y3 - x3*y2; 1051 detm2=y1*z2 - y2*z1 - y1*z3 + y3*z1 + y2*z3 - y3*z2; 1052 detm3=x2*z1 - x1*z2 + x1*z3 - x3*z1 - x2*z3 + x3*z2; 1053 1054 return sqrt(pow(detm1,2) + pow(detm2,2) + pow(detm3,2))/2; 1036 1055 } 1037 1056 /*}}}*/ … … 3483 3502 #endif 3484 3503 3504 #ifdef _HAVE_SEALEVELRISE_ 3505 void Tria::Sealevelrise(Vector<IssmDouble>* pSgi,Vector<IssmDouble>* pSgo,IssmDouble* peustatic,IssmDouble* Sg_old,IssmDouble* Sgi_old,IssmDouble* Sgo_old,IssmDouble* x,IssmDouble* y,IssmDouble* z,IssmDouble oceanarea){ /*{{{*/ 3506 3507 /*diverse:*/ 3508 int gsize; 3509 bool spherical=true; 3510 IssmDouble x0,y0,z0,a; 3511 IssmDouble xyz_list[NUMVERTICES][3]; 3512 IssmDouble area; 3513 IssmDouble I; //change in ice thickness or water level(Farrel and Clarke, Equ. 4) 3514 IssmDouble Me; 3515 IssmDouble rho; 3516 3517 /*love numbers:*/ 3518 IssmDouble* love_h=NULL; 3519 IssmDouble* love_k=NULL; 3520 IssmDouble* deltalove=NULL; 3521 int nl; 3522 3523 /*ice properties: */ 3524 IssmDouble rho_ice,rho_water,rho_earth; 3525 3526 /*other constants: */ 3527 //IssmDouble g; 3528 3529 /*Solution outputs: */ 3530 Vector<IssmDouble>* pSolution=NULL; 3531 3532 /*Initialize eustatic component: do not skip this step :):*/ 3533 IssmDouble eustatic = 0; 3534 3535 /*Computational flags:*/ 3536 bool computerigid = true; 3537 bool computeelastic= true; 3538 bool computeeustatic = true; 3539 3540 /*recover material parameters: */ 3541 rho_ice=matpar->GetMaterialParameter(MaterialsRhoIceEnum); 3542 rho_water=matpar->GetMaterialParameter(MaterialsRhoSeawaterEnum); 3543 rho_earth=matpar->GetMaterialParameter(MaterialsEarthDensityEnum); 3544 3545 /*recover love numbers and computational flags: */ 3546 this->parameters->FindParam(&love_h,&nl,SealevelriseLoveHEnum); 3547 this->parameters->FindParam(&love_k,&nl,SealevelriseLoveKEnum); 3548 this->parameters->FindParam(&computerigid,SealevelriseRigidEnum); 3549 this->parameters->FindParam(&computeelastic,SealevelriseElasticEnum); 3550 this->parameters->FindParam(&computeeustatic,SealevelriseEustaticEnum); 3551 3552 /*how many dofs are we working with here? */ 3553 this->parameters->FindParam(&gsize,MeshNumberofverticesEnum); 3554 3555 /*retrieve coordinates: */ 3556 ::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES); 3557 3558 /* Where is the centroid of this element?. To avoid issues with lat,long 3559 * being between [0,180] and [0 360], and issues with jumps at the central 3560 * meridian and poles, we do everything in cartesian coordinate system: */ 3561 x0=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3; 3562 y0=(xyz_list[0][1]+xyz_list[1][1]+xyz_list[2][1])/3; 3563 z0=(xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2])/3; 3564 3565 /*radius at this location?:*/ 3566 a=sqrt(pow(xyz_list[0][0],2)+pow(xyz_list[0][1],2)+pow(xyz_list[0][2],2)); //a from Farrel and Clark, Eq 4. 3567 3568 /*Compute mass of the earth:*/ 3569 Me= rho_earth*4/3*PI*pow(a,3); 3570 3571 /*Compute area of element:*/ 3572 area=GetArea3D(); 3573 3574 /*Compute ice thickness or sea level change: */ 3575 if(IsWaterInElement()){ 3576 3577 IssmDouble phi_I_I_O,phi_O_O_O; 3578 3579 /*From Sg_old, recover water sea level rise:*/ 3580 I=0; for(int i=0;i<NUMVERTICES;i++) I+=Sg_old[this->vertices[i]->Sid()]/NUMVERTICES; 3581 rho=rho_water; 3582 pSolution=pSgo; 3583 3584 /*Compute eustatic component: */ 3585 if(computeeustatic){ 3586 phi_I_I_O=0; for(int i=0;i<NUMVERTICES;i++) phi_I_I_O+=area/oceanarea * Sgi_old[this->vertices[i]->Sid()]/NUMVERTICES; 3587 phi_O_O_O=0; for(int i=0;i<NUMVERTICES;i++) phi_O_O_O+=area/oceanarea * Sgo_old[this->vertices[i]->Sid()]/NUMVERTICES; 3588 eustatic -= (phi_I_I_O + phi_O_O_O); //Watch out the sign "-"! 3589 } 3590 3591 } 3592 else{ 3593 Input* deltathickness_input=inputs->GetInput(SealevelriseDeltathicknessEnum); 3594 if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!"); 3595 deltathickness_input->GetInputAverage(&I); 3596 rho=rho_ice; 3597 pSolution=pSgi; 3598 3599 /*Compute eustatic compoent:*/ 3600 if(computeeustatic)eustatic -= rho_ice*area*I/(oceanarea*rho_water); //Watch out the sign "-"! 3601 } 3602 3603 3604 /*Speed up of love number comutation: */ 3605 if(computeelastic){ 3606 deltalove=xNew<IssmDouble>(nl); 3607 for (int n=0;n<nl;n++) deltalove[n] = (love_k[n]-love_k[nl-1]-love_h[n]+love_h[nl-1]); 3608 } 3609 3610 if(computeelastic | computerigid){ 3611 for(int i=0;i<gsize;i++){ 3612 3613 IssmDouble alpha; 3614 IssmDouble G_rigid=0; //do not remove =0! 3615 IssmDouble G_elastic=0; //do not remove =0! 3616 IssmDouble Pn1,Pn2; //first two legendre polynomials 3617 IssmDouble cosalpha; 3618 3619 /*Compute alpha angle between centroid and current vertex and cosine of this angle: */ 3620 alpha = acos( 3621 (x[i]*x0+y[i]*y0+z[i]*z0) //scalar product of two position vectors 3622 / sqrt(pow(x0,2.0)+pow(y0,2.0)+pow(z0,2.0)) //norm of first position vector 3623 / sqrt(pow(x[i],2.0)+pow(y[i],2.0)+pow(z[i],2.0)) //norm of second position vector 3624 ); 3625 cosalpha=cos(alpha); //compute this to speed up the elastic component. 3626 3627 //Rigid earth gravitational perturbation: 3628 if(computerigid)G_rigid=1.0/2.0/sin(alpha/2.0); 3629 3630 //Elastic component (from Eq 17 in Adhikari et al, GMD 2015) 3631 if(computeelastic){ 3632 G_elastic = (love_k[nl-1]-love_h[nl-1])/2.0/sin(alpha/2.0); 3633 for(int n=0;n<nl;n++) G_elastic += deltalove[n]*legendre(Pn1,Pn2,n,cosalpha); 3634 } 3635 3636 /*Add all components to the pSgi or pSgo solution vectors:*/ 3637 pSolution->SetValue(i,rho*a/Me*I*area*(G_rigid+G_elastic),ADD_VAL); 3638 } 3639 } 3640 3641 /*Assign output pointer:*/ 3642 *peustatic=eustatic; 3643 3644 /*Free ressources:*/ 3645 xDelete<IssmDouble>(love_h); 3646 xDelete<IssmDouble>(love_k); 3647 xDelete<IssmDouble>(deltalove); 3648 return; 3649 } 3650 /*}}}*/ 3651 IssmDouble Tria::OceanArea(void){ /*{{{*/ 3652 3653 if(IsWaterInElement()) return GetArea3D(); 3654 else return 0; 3655 3656 } 3657 /*}}}*/ 3658 #endif 3659 3660 3485 3661 #ifdef _HAVE_DAKOTA_ 3486 3662 void Tria::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){/*{{{*/ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r19764 r19984 143 143 void GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y); 144 144 #endif 145 #ifdef _HAVE_SEALEVELRISE_ 146 void Sealevelrise(Vector<IssmDouble>* pSgi,Vector<IssmDouble>* pSgo,IssmDouble* peustatic,IssmDouble* Sg_old,IssmDouble* Sgi_old,IssmDouble* Sgo_old,IssmDouble* x,IssmDouble* y,IssmDouble* z,IssmDouble oceanarea); 147 IssmDouble OceanArea(void); 148 #endif 145 149 /*}}}*/ 146 150 /*Tria specific routines:{{{*/ … … 148 152 void AddInput(int input_enum, IssmDouble* values, int interpolation_enum); 149 153 IssmDouble GetArea(void); 150 IssmDouble GetAreaIce(void); 154 IssmDouble GetArea3D(void); 155 IssmDouble GetAreaIce(void); 151 156 void GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints); 152 157 void GetLevelsetIntersection(int** pindices, int* pnumiceverts, IssmDouble* fraction, int levelset_enum, IssmDouble level); -
issm/trunk-jpl/src/c/classes/FemModel.cpp
r19803 r19984 534 534 break; 535 535 536 case SealevelriseSolutionEnum: 537 analyses_temp[numanalyses++]=SealevelriseAnalysisEnum; 538 break; 539 536 540 case SmbSolutionEnum: 537 541 analyses_temp[numanalyses++]=SmbAnalysisEnum; … … 2201 2205 /*}}}*/ 2202 2206 #endif 2207 #ifdef _HAVE_SEALEVELRISE_ 2208 void FemModel::Sealevelrise(Vector<IssmDouble>* pSgi,Vector<IssmDouble>* pSgo, IssmDouble* peustatic, Vector<IssmDouble>* pSg_old, Vector<IssmDouble>* pSgi_old,Vector<IssmDouble>* pSgo_old,IssmDouble* x, IssmDouble* y, IssmDouble* z) { /*{{{*/ 2209 2210 /*serialized vectors:*/ 2211 IssmDouble* Sg_old=NULL; 2212 IssmDouble* Sgi_old=NULL; 2213 IssmDouble* Sgo_old=NULL; 2214 IssmDouble eustatic=0; 2215 IssmDouble eustatic_cpu=0; 2216 IssmDouble eustatic_cpu_e=0; 2217 IssmDouble oceanarea=0; 2218 IssmDouble oceanarea_cpu=0; 2219 int ns; 2220 2221 /*Serialize vectors from previous iteration:*/ 2222 2223 Sg_old=pSg_old->ToMPISerial(); 2224 Sgi_old=pSgi_old->ToMPISerial(); 2225 Sgo_old=pSgo_old->ToMPISerial(); 2226 2227 /*Go through elements, and add contribution from each element to the deflection vector wg:*/ 2228 ns = elements->Size(); 2229 2230 /*First, figure out the area of the ocean, which is needed to compute the eustatic component: */ 2231 for(int i=0;i<ns;i++){ 2232 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i)); 2233 oceanarea_cpu += element->OceanArea(); 2234 } 2235 ISSM_MPI_Reduce (&oceanarea_cpu,&oceanarea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() ); 2236 ISSM_MPI_Bcast(&oceanarea,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 2237 2238 /*Call the sea level rise core: */ 2239 for(int i=0;i<ns;i++){ 2240 2241 if(IssmComm::GetRank()==0)if(VerboseConvergence())if(i%1000)_printf_("\r" << " convolution progress: " << (float)i/(float)ns*100 << "\%"); 2242 2243 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i)); 2244 element->Sealevelrise(pSgi,pSgo,&eustatic_cpu_e,Sg_old,Sgi_old,Sgo_old,x,y,z,oceanarea); 2245 eustatic_cpu+=eustatic_cpu_e; 2246 } 2247 if(IssmComm::GetRank()==0)if(VerboseConvergence())_printf_("\n"); 2248 2249 /*Sum all eustatic components from all cpus:*/ 2250 ISSM_MPI_Reduce (&eustatic_cpu,&eustatic,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() ); 2251 ISSM_MPI_Bcast(&eustatic,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 2252 2253 /*Assign output pointers:*/ 2254 *peustatic=eustatic; 2255 2256 /*Free ressources:*/ 2257 xDelete<IssmDouble>(Sg_old); 2258 xDelete<IssmDouble>(Sgi_old); 2259 xDelete<IssmDouble>(Sgo_old); 2260 } 2261 /*}}}*/ 2262 #endif 2263 2203 2264 void FemModel::HydrologyEPLupdateDomainx(IssmDouble* pEplcount){ /*{{{*/ 2204 2265 -
issm/trunk-jpl/src/c/classes/FemModel.h
r19803 r19984 112 112 void Deflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt, IssmDouble* x, IssmDouble* y); 113 113 #endif 114 #ifdef _HAVE_SEALEVELRISE_ 115 void Sealevelrise(Vector<IssmDouble>* pSgi,Vector<IssmDouble>* pSgo, IssmDouble* peustatic, Vector<IssmDouble>* pSg_old, Vector<IssmDouble>* pSgi_old,Vector<IssmDouble>* pSgo_old,IssmDouble* x, IssmDouble* y, IssmDouble* z); 116 #endif 114 117 void TimeAdaptx(IssmDouble* pdt); 115 118 void UpdateConstraintsx(void); -
issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp
r19720 r19984 58 58 mantle_shear_modulus=0; 59 59 mantle_density=0; 60 61 earth_density=0; 60 62 61 63 poisson=0; … … 160 162 iomodel->Constant(&this->mantle_shear_modulus,MaterialsMantleShearModulusEnum); 161 163 iomodel->Constant(&this->mantle_density,MaterialsMantleDensityEnum); 164 165 /*slr:*/ 166 iomodel->Constant(&this->earth_density,MaterialsEarthDensityEnum); 167 162 168 break; 163 169 default: … … 255 261 matpar->mantle_shear_modulus=this->mantle_shear_modulus; 256 262 matpar->mantle_density=this->mantle_density; 263 264 matpar->earth_density=this->earth_density; 257 265 258 266 return matpar; … … 302 310 MARSHALLING(mantle_shear_modulus); 303 311 MARSHALLING(mantle_density); 312 313 //slr: 314 MARSHALLING(earth_density); 304 315 305 316 //Sea ice: … … 516 527 case MaterialsMantleDensityEnum: return this->mantle_density; 517 528 case MaterialsMantleShearModulusEnum: return this->mantle_shear_modulus; 529 case MaterialsEarthDensityEnum: return this->earth_density; 518 530 default: _error_("Enum "<<EnumToStringx(enum_in)<<" not supported yet"); 519 531 } -
issm/trunk-jpl/src/c/classes/Materials/Matpar.h
r19554 r19984 58 58 IssmDouble mantle_shear_modulus; 59 59 IssmDouble mantle_density; 60 61 /*slr:*/ 62 IssmDouble earth_density; 60 63 61 64 /*Sea ice*/ -
issm/trunk-jpl/src/c/classes/Vertex.cpp
r19199 r19984 36 36 _assert_(iomodel->Data(BaseEnum) && iomodel->Data(ThicknessEnum)); 37 37 this->sigma = (iomodel->Data(MeshZEnum)[i]-iomodel->Data(BaseEnum)[i])/(iomodel->Data(ThicknessEnum)[i]); 38 break; 39 case Domain3DsurfaceEnum: 40 this->latitute = iomodel->Data(MeshLatEnum)[i]; 41 this->longitude = iomodel->Data(MeshLongEnum)[i]; 42 this->R = iomodel->Data(MeshREnum)[i]; 38 43 break; 39 44 case Domain2DhorizontalEnum: … … 121 126 IssmDouble Vertex::GetZ(){/*{{{*/ 122 127 return this->z; 128 } 129 /*}}}*/ 130 IssmDouble Vertex::GetLatitude(){/*{{{*/ 131 return this->latitute; 132 } 133 /*}}}*/ 134 IssmDouble Vertex::GetLongitude(){/*{{{*/ 135 return this->longitude; 136 } 137 /*}}}*/ 138 IssmDouble Vertex::GetRadius(){/*{{{*/ 139 return this->R; 123 140 } 124 141 /*}}}*/ … … 239 256 } 240 257 /*}}}*/ 241 void Vertex::VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz ){/*{{{*/258 void Vertex::VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz, bool spherical){/*{{{*/ 242 259 243 260 if (this->clone==true) return; 244 261 245 vx->SetValue(this->sid,this->x,INS_VAL); 246 vy->SetValue(this->sid,this->y,INS_VAL); 247 vz->SetValue(this->sid,this->z,INS_VAL); 262 if(!spherical){ 263 vx->SetValue(this->sid,this->x,INS_VAL); 264 vy->SetValue(this->sid,this->y,INS_VAL); 265 vz->SetValue(this->sid,this->z,INS_VAL); 266 } 267 else{ 268 vx->SetValue(this->sid,this->latitute,INS_VAL); 269 vy->SetValue(this->sid,this->longitude,INS_VAL); 270 vz->SetValue(this->sid,this->R,INS_VAL); 271 } 248 272 249 273 return; … … 252 276 253 277 /*Methods relating to Vertex, but not internal methods: */ 254 void GetVerticesCoordinates(IssmDouble* xyz,Vertex** vertices, int numvertices ){ /*{{{*/278 void GetVerticesCoordinates(IssmDouble* xyz,Vertex** vertices, int numvertices,bool spherical){ /*{{{*/ 255 279 256 280 _assert_(vertices); 257 281 _assert_(xyz); 258 282 259 for(int i=0;i<numvertices;i++) { 260 xyz[i*3+0]=vertices[i]->GetX(); 261 xyz[i*3+1]=vertices[i]->GetY(); 262 xyz[i*3+2]=vertices[i]->GetZ(); 283 if(!spherical){ 284 for(int i=0;i<numvertices;i++) { 285 xyz[i*3+0]=vertices[i]->GetX(); 286 xyz[i*3+1]=vertices[i]->GetY(); 287 xyz[i*3+2]=vertices[i]->GetZ(); 288 } 289 } 290 else{ 291 for(int i=0;i<numvertices;i++) { 292 xyz[i*3+0]=vertices[i]->GetLatitude(); 293 xyz[i*3+1]=vertices[i]->GetLongitude(); 294 xyz[i*3+2]=vertices[i]->GetRadius(); 295 } 263 296 } 264 297 }/*}}}*/ -
issm/trunk-jpl/src/c/classes/Vertex.h
r19199 r19984 28 28 IssmDouble y; 29 29 IssmDouble z; 30 IssmDouble latitute; 31 IssmDouble longitude; 32 IssmDouble R; 30 33 IssmDouble sigma; //sigma coordinate: (z-bed)/thickness 31 34 int connectivity; //number of vertices connected to this vertex … … 52 55 IssmDouble GetY(void); 53 56 IssmDouble GetZ(void); 57 IssmDouble GetLatitude(void); 58 IssmDouble GetLongitude(void); 59 IssmDouble GetRadius(void); 54 60 void UpdatePosition(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed); 55 61 void DistributePids(int* ppidcount); … … 59 65 void SetClone(int* minranks); 60 66 void ToXYZ(Matrix<IssmDouble>* matrix); 61 void VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz );67 void VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,bool spherical=false); 62 68 }; 63 69 64 70 /*Methods relating to Vertex object: */ 65 void GetVerticesCoordinates(IssmDouble* xyz,Vertex** vertices, int numvertices );71 void GetVerticesCoordinates(IssmDouble* xyz,Vertex** vertices, int numvertices,bool spherical=false); 66 72 67 73 #endif /* _VERTEX_H */ -
issm/trunk-jpl/src/c/cores/CorePointerFromSolutionEnum.cpp
r19087 r19984 59 59 solutioncore=&masstransport_core; 60 60 break; 61 case SealevelriseSolutionEnum: 62 solutioncore=&sealevelrise_core; 63 break; 61 64 case GiaSolutionEnum: 62 65 #if _HAVE_GIA_ -
issm/trunk-jpl/src/c/cores/cores.h
r19527 r19984 46 46 void dummy_core(FemModel* femmodel); 47 47 void gia_core(FemModel* femmodel); 48 void sealevelrise_core(FemModel* femmodel); 48 49 void smb_core(FemModel* femmodel); 49 50 void damage_core(FemModel* femmodel); -
issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
r19087 r19984 95 95 /*Fetch data:*/ 96 96 iomodel->FetchData(6,MeshXEnum,MeshYEnum,MeshZEnum,BaseEnum,ThicknessEnum,MaskIceLevelsetEnum); 97 if (iomodel->domaintype == Domain3DsurfaceEnum) iomodel->FetchData(3,MeshLatEnum,MeshLongEnum,MeshREnum); 98 97 99 CreateNumberNodeToElementConnectivity(iomodel); 98 100 … … 103 105 /*Free data: */ 104 106 iomodel->DeleteData(6,MeshXEnum,MeshYEnum,MeshZEnum,BaseEnum,ThicknessEnum,MaskIceLevelsetEnum); 107 if (iomodel->domaintype == Domain3DsurfaceEnum) iomodel->DeleteData(3,MeshLatEnum,MeshLongEnum,MeshREnum); 105 108 } -
issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.cpp
r14999 r19984 9 9 #include "../../toolkits/toolkits.h" 10 10 11 void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz, Vertices* vertices ) {11 void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz, Vertices* vertices,bool spherical) { 12 12 13 13 /*output: */ … … 34 34 for(i=0;i<vertices->Size();i++){ 35 35 Vertex* vertex=(Vertex*)vertices->GetObjectByOffset(i); 36 vertex->VertexCoordinates(vx,vy,vz );36 vertex->VertexCoordinates(vx,vy,vz,spherical); 37 37 } 38 38 -
issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.h
r15000 r19984 8 8 9 9 /* local prototypes: */ 10 void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz, Vertices* vertices );10 void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz, Vertices* vertices,bool spherical=false); 11 11 12 12 #endif /* _VERTEX_COORDINATESX_H */ -
issm/trunk-jpl/src/m/classes/maskpsl.m
r19958 r19984 64 64 end % }}} 65 65 function marshall(self,md,fid) % {{{ 66 WriteData(fid,'object',self,' fieldname','groundedice_levelset','format','DoubleMat','mattype',1);67 WriteData(fid,'object',self,' fieldname','ice_levelset','format','DoubleMat','mattype',1);68 WriteData(fid,'object',self,' fieldname','ocean_levelset','format','DoubleMat','mattype',1);66 WriteData(fid,'object',self,'class','mask','fieldname','groundedice_levelset','format','DoubleMat','mattype',1); 67 WriteData(fid,'object',self,'class','mask','fieldname','ice_levelset','format','DoubleMat','mattype',1); 68 WriteData(fid,'object',self,'class','mask','fieldname','ocean_levelset','format','DoubleMat','mattype',1); 69 69 70 70 % get mask of vertices of elements with ice -
issm/trunk-jpl/src/m/classes/matice.m
r19958 r19984 28 28 mantle_density = 0.; 29 29 30 %slr 31 earth_density = 0; 32 30 33 end 31 34 methods … … 100 103 self.mantle_density = 3.34; % (g/cm^-3) 101 104 105 %SLR 106 self.earth_density= 5512; % average density of the Earth, (kg/m^3) 107 102 108 end % }}} 103 109 function md = checkconsistency(self,md,solution,analyses) % {{{ … … 115 121 md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1); 116 122 md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1); 123 end 124 if ismember(SealevelriseAnalysisEnum(),analyses), 125 md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1); 117 126 end 118 127 … … 140 149 fielddisplay(self,'mantle_shear_modulus','Mantle shear modulus [Pa]'); 141 150 fielddisplay(self,'mantle_density','Mantle density [g/cm^-3]'); 151 fielddisplay(self,'earth_density','Mantle density [kg/m^-3]'); 142 152 end % }}} 143 153 function marshall(self,md,fid) % {{{ … … 163 173 WriteData(fid,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double'); 164 174 WriteData(fid,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10^3); 175 WriteData(fid,'object',self,'class','materials','fieldname','earth_density','format','Double'); 165 176 end % }}} 166 177 function savemodeljs(self,fid,modelname) % {{{ … … 186 197 writejsdouble(fid,[modelname '.materials.mantle_shear_modulus'],self.mantle_shear_modulus); 187 198 writejsdouble(fid,[modelname '.materials.mantle_density'],self.mantle_density); 199 writejsdouble(fid,[modelname '.materials.earth_density'],self.earth_density); 188 200 189 201 end % }}} -
issm/trunk-jpl/src/m/classes/model.m
r19957 r19984 22 22 initialization = 0; 23 23 rifts = 0; 24 slr = 0; 24 25 25 26 debug = 0; … … 1064 1065 md.friction = friction(); 1065 1066 md.rifts = rifts(); 1067 md.slr = slr(); 1066 1068 md.timestepping = timestepping(); 1067 1069 md.groundingline = groundingline(); … … 1238 1240 disp(sprintf('%19s: %-22s -- %s','initialization' ,['[1x1 ' class(self.initialization) ']'],'initial guess/state')); 1239 1241 disp(sprintf('%19s: %-22s -- %s','rifts' ,['[1x1 ' class(self.rifts) ']'],'rifts properties')); 1242 disp(sprintf('%19s: %-22s -- %s','slr' ,['[1x1 ' class(self.slr) ']'],'slr forcings')); 1240 1243 disp(sprintf('%19s: %-22s -- %s','debug' ,['[1x1 ' class(self.debug) ']'],'debugging tools (valgrind, gprof)')); 1241 1244 disp(sprintf('%19s: %-22s -- %s','verbose' ,['[1x1 ' class(self.verbose) ']'],'verbosity level in solve')); -
issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.m
r19744 r19984 85 85 analyses=[FlaimAnalysisEnum()]; 86 86 87 case SealevelriseSolutionEnum(), 88 analyses=[SealevelriseAnalysisEnum()]; 89 87 90 case HydrologySolutionEnum(), 88 91 analyses=[L2ProjectionBaseAnalysisEnum();HydrologyShreveAnalysisEnum();HydrologyDCInefficientAnalysisEnum();HydrologyDCEfficientAnalysisEnum()];
Note:
See TracChangeset
for help on using the changeset viewer.