Changeset 24916
- Timestamp:
- 05/28/20 23:43:54 (5 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/FemModel.cpp
r24915 r24916 4684 4684 #endif 4685 4685 #ifdef _HAVE_SEALEVELRISE_ 4686 void FemModel::SealevelriseEustatic(Vector<IssmDouble>* pRSLgi, IssmDouble* pe ustatic, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius,int loop) { /*{{{*/4686 void FemModel::SealevelriseEustatic(Vector<IssmDouble>* pRSLgi, IssmDouble* peartharea, IssmDouble* poceanarea, IssmDouble* peustatic, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius,int loop) { /*{{{*/ 4687 4687 4688 4688 /*serialized vectors:*/ … … 4706 4706 /*First, figure out the area of the ocean, which is needed to compute the eustatic component: */ 4707 4707 for(int i=0;i<elements->Size();i++){ 4708 IssmDouble area; 4708 4709 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i)); 4709 oceanarea_cpu += element->OceanArea(); 4710 eartharea_cpu += element->GetAreaSpherical(); 4710 area=element->GetAreaSpherical(); 4711 eartharea_cpu += area; 4712 if (element->IsOceanInElement()) oceanarea_cpu += area; 4711 4713 } 4712 4714 ISSM_MPI_Reduce (&oceanarea_cpu,&oceanarea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() ); … … 4737 4739 4738 4740 /*Assign output pointers:*/ 4741 *peartharea=eartharea; 4742 *poceanarea=oceanarea; 4739 4743 *peustatic=eustatic; 4740 4744 4741 4745 } 4742 4746 /*}}}*/ 4743 void FemModel::SealevelriseNonEustatic(Vector<IssmDouble>* pRSLgo, Vector<IssmDouble>* pRSLg_old, IssmDouble * latitude, IssmDouble* longitude, IssmDouble* radius, bool verboseconvolution,int loop){/*{{{*/4747 void FemModel::SealevelriseNonEustatic(Vector<IssmDouble>* pRSLgo, Vector<IssmDouble>* pRSLg_old, IssmDouble eartharea,IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius, bool verboseconvolution,int loop){/*{{{*/ 4744 4748 4745 4749 /*serialized vectors:*/ 4746 4750 IssmDouble* RSLg_old=NULL; 4747 4748 IssmDouble eartharea=0;4749 IssmDouble eartharea_cpu=0;4750 4751 4751 4752 IssmDouble* RSLgo = NULL; … … 4762 4763 RSLg_old=pRSLg_old->ToMPISerial(); 4763 4764 4764 /*First, figure out the area of the ocean, which is needed to compute the eustatic component: */4765 for(int i=0;i<elements->Size();i++){4766 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));4767 eartharea_cpu += element->GetAreaSpherical();4768 }4769 4770 ISSM_MPI_Reduce (&eartharea_cpu,&eartharea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );4771 ISSM_MPI_Bcast(&eartharea,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());4772 4773 4765 /*Call the sea level rise core: */ 4774 4766 for(int i=0;i<elements->Size();i++){ … … 4786 4778 } 4787 4779 /*}}}*/ 4788 void FemModel::SealevelriseRotationalFeedback(Vector<IssmDouble>* pRSLgo_rot, Vector<IssmDouble>* pRSLg_old, IssmDouble* pIxz, IssmDouble* pIyz, IssmDouble* pIzz, IssmDouble * latitude, IssmDouble* longitude, IssmDouble* radius){/*{{{*/4780 void FemModel::SealevelriseRotationalFeedback(Vector<IssmDouble>* pRSLgo_rot, Vector<IssmDouble>* pRSLg_old, IssmDouble* pIxz, IssmDouble* pIyz, IssmDouble* pIzz, IssmDouble eartharea, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius){/*{{{*/ 4789 4781 4790 4782 /*serialized vectors:*/ 4791 4783 IssmDouble* RSLg_old=NULL; 4792 IssmDouble eartharea=0;4793 IssmDouble eartharea_cpu=0;4794 4784 IssmDouble tide_love_h, tide_love_k, fluid_love, moi_e, moi_p, omega, g; 4795 4785 IssmDouble load_love_k2 = -0.30922675; //degree 2 load Love number … … 4799 4789 /*Serialize vectors from previous iteration:*/ 4800 4790 RSLg_old=pRSLg_old->ToMPISerial(); 4801 4802 /*First, figure out the area of the ocean, which is needed to compute the eustatic component: */4803 for(int i=0;i<elements->Size();i++){4804 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));4805 eartharea_cpu += element->GetAreaSpherical();4806 }4807 ISSM_MPI_Reduce (&eartharea_cpu,&eartharea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );4808 ISSM_MPI_Bcast(&eartharea,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());4809 4791 4810 4792 IssmDouble moi_list[3]={0,0,0}; … … 4872 4854 } 4873 4855 /*}}}*/ 4874 void FemModel::SealevelriseElastic(Vector<IssmDouble>* pUp, Vector<IssmDouble>* pNorth, Vector<IssmDouble>* pEast, Vector<IssmDouble>* pRSLg, IssmDouble * latitude, IssmDouble* longitude, IssmDouble* radius, IssmDouble* xx, IssmDouble* yy, IssmDouble* zz,int loop,int horiz){/*{{{*/4856 void FemModel::SealevelriseElastic(Vector<IssmDouble>* pUp, Vector<IssmDouble>* pNorth, Vector<IssmDouble>* pEast, Vector<IssmDouble>* pRSLg, IssmDouble eartharea, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius, IssmDouble* xx, IssmDouble* yy, IssmDouble* zz,int loop,int horiz){/*{{{*/ 4875 4857 4876 4858 /*serialized vectors:*/ 4877 4859 IssmDouble* RSLg=NULL; 4878 4879 IssmDouble eartharea=0;4880 IssmDouble eartharea_cpu=0;4881 4860 4882 4861 IssmDouble* Up = NULL; … … 4898 4877 indices=xNew<int>(gsize); for (int i=0;i<gsize;i++)indices[i]=i; 4899 4878 4900 /*First, figure out the area of the ocean, which is needed to compute the eustatic component: */4901 for(int i=0;i<elements->Size();i++){4902 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));4903 eartharea_cpu += element->GetAreaSpherical();4904 }4905 ISSM_MPI_Reduce (&eartharea_cpu,&eartharea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );4906 ISSM_MPI_Bcast(&eartharea,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());4907 4908 4879 /*Call the sea level rise core: */ 4909 4880 for(int i=0;i<elements->Size();i++){ … … 4929 4900 } 4930 4901 /*}}}*/ 4931 IssmDouble FemModel::SealevelriseOceanAverage(Vector<IssmDouble>* RSLg ) { /*{{{*/4902 IssmDouble FemModel::SealevelriseOceanAverage(Vector<IssmDouble>* RSLg,IssmDouble oceanarea) { /*{{{*/ 4932 4903 4933 4904 IssmDouble* RSLg_serial=NULL; 4934 4905 IssmDouble oceanvalue,oceanvalue_cpu; 4935 IssmDouble oceanarea,oceanarea_cpu;4936 4906 4937 4907 /*Serialize vectors from previous iteration:*/ … … 4940 4910 /*Initialize:*/ 4941 4911 oceanvalue_cpu=0; 4942 oceanarea_cpu=0;4943 4912 4944 4913 /*Go through elements, and add contribution from each element and divide by overall ocean area:*/ 4945 4914 for(int i=0;i<elements->Size();i++){ 4946 4915 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i)); 4947 oceanarea_cpu += element->OceanArea();4948 4916 oceanvalue_cpu += element->OceanAverage(RSLg_serial); 4949 4917 } 4950 ISSM_MPI_Reduce (&oceanarea_cpu,&oceanarea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() ); 4951 ISSM_MPI_Bcast(&oceanarea,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 4952 4953 //_printf0_("Ocean area: " << oceanarea << "\n"); 4954 4918 4955 4919 ISSM_MPI_Reduce (&oceanvalue_cpu,&oceanvalue,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() ); 4956 4920 ISSM_MPI_Bcast(&oceanvalue,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); -
issm/trunk-jpl/src/c/classes/FemModel.h
r24861 r24916 162 162 #endif 163 163 #ifdef _HAVE_SEALEVELRISE_ 164 void SealevelriseEustatic(Vector<IssmDouble>* pSgi, IssmDouble* pe ustatic, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius,int loop);165 void SealevelriseNonEustatic(Vector<IssmDouble>* pSgo, Vector<IssmDouble>* pSg_old, IssmDouble * latitude, IssmDouble* longitude, IssmDouble* radius,bool verboseconvolution,int loop);166 void SealevelriseRotationalFeedback(Vector<IssmDouble>* pRSLgo_rot, Vector<IssmDouble>* pRSLg_old, IssmDouble* pIxz, IssmDouble* pIyz, IssmDouble* pIzz, IssmDouble * latitude, IssmDouble* longitude, IssmDouble* radius);167 void SealevelriseElastic(Vector<IssmDouble>* pUp, Vector<IssmDouble>* pNorth, Vector<IssmDouble>* pEast, Vector<IssmDouble>* pSg_old, IssmDouble * latitude, IssmDouble* longitude, IssmDouble* radius, IssmDouble* xx, IssmDouble* yy, IssmDouble* zz,int loop,int horiz);168 IssmDouble SealevelriseOceanAverage(Vector<IssmDouble>* Sg );164 void SealevelriseEustatic(Vector<IssmDouble>* pSgi, IssmDouble* peartharea, IssmDouble* poceanarea, IssmDouble* peustatic, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius,int loop); 165 void SealevelriseNonEustatic(Vector<IssmDouble>* pSgo, Vector<IssmDouble>* pSg_old, IssmDouble eartharea, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius,bool verboseconvolution,int loop); 166 void SealevelriseRotationalFeedback(Vector<IssmDouble>* pRSLgo_rot, Vector<IssmDouble>* pRSLg_old, IssmDouble* pIxz, IssmDouble* pIyz, IssmDouble* pIzz, IssmDouble eartharea,IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius); 167 void SealevelriseElastic(Vector<IssmDouble>* pUp, Vector<IssmDouble>* pNorth, Vector<IssmDouble>* pEast, Vector<IssmDouble>* pSg_old, IssmDouble eartharea,IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius, IssmDouble* xx, IssmDouble* yy, IssmDouble* zz,int loop,int horiz); 168 IssmDouble SealevelriseOceanAverage(Vector<IssmDouble>* Sg,IssmDouble oceanarea); 169 169 #endif 170 170 void HydrologyEPLupdateDomainx(IssmDouble* pEplcount); -
issm/trunk-jpl/src/c/cores/cores.h
r24469 r24916 55 55 void geodetic_core(FemModel* femmodel); 56 56 void steric_core(FemModel* femmodel); 57 Vector<IssmDouble>* sealevelrise_core_eustatic(FemModel* femmodel );58 Vector<IssmDouble>* sealevelrise_core_noneustatic(FemModel* femmodel,Vector<IssmDouble>* RSLg_eustatic );59 void sealevelrise_core_elastic(Vector<IssmDouble>** pU_radial, Vector<IssmDouble>** pU_north,Vector<IssmDouble>** pU_east,FemModel* femmodel,Vector<IssmDouble>* RSLg );57 Vector<IssmDouble>* sealevelrise_core_eustatic(FemModel* femmodel,IssmDouble* peartharea,IssmDouble* poceanarea); 58 Vector<IssmDouble>* sealevelrise_core_noneustatic(FemModel* femmodel,Vector<IssmDouble>* RSLg_eustatic,IssmDouble eartharea,IssmDouble oceanarea); 59 void sealevelrise_core_elastic(Vector<IssmDouble>** pU_radial, Vector<IssmDouble>** pU_north,Vector<IssmDouble>** pU_east,FemModel* femmodel,Vector<IssmDouble>* RSLg,IssmDouble eartharea); 60 60 void sealevelrise_core_viscous(Vector<IssmDouble>** pU_gia,Vector<IssmDouble>** pN_gia,FemModel* femmodel,Vector<IssmDouble>* RSLg); 61 61 void sealevelrise_diagnostics(FemModel* femmodel,Vector<IssmDouble>* RSLg); -
issm/trunk-jpl/src/c/cores/sealevelrise_core.cpp
r24904 r24916 92 92 int geodetic=0; 93 93 IssmDouble dt; 94 IssmDouble eartharea,oceanarea; 94 95 95 96 /*Should we even be here?:*/ … … 145 146 146 147 /*call eustatic core (generalized eustatic - Farrel and Clark, Eq 4, 1st, 3rd and 4rd terms on the RHS) */ 147 RSLg_eustatic=sealevelrise_core_eustatic(femmodel );148 RSLg_eustatic=sealevelrise_core_eustatic(femmodel,&eartharea,&oceanarea); 148 149 149 150 /*call non-eustatic core (ocean loading tems - 2nd and 5th terms on the RHS of Farrel and Clark) */ 150 RSLg=sealevelrise_core_noneustatic(femmodel,RSLg_eustatic );151 RSLg=sealevelrise_core_noneustatic(femmodel,RSLg_eustatic,eartharea,oceanarea); 151 152 152 153 /*compute other elastic geodetic signatures, such as components of 3-D crustal motion: */ 153 sealevelrise_core_elastic(&U_esa,&U_north_esa,&U_east_esa,femmodel,RSLg );154 sealevelrise_core_elastic(&U_esa,&U_north_esa,&U_east_esa,femmodel,RSLg,eartharea); 154 155 155 156 /*compute viscosus (GIA) geodetic signatures:*/ … … 303 304 } 304 305 /*}}}*/ 305 Vector<IssmDouble>* sealevelrise_core_eustatic(FemModel* femmodel ){ /*{{{*/306 Vector<IssmDouble>* sealevelrise_core_eustatic(FemModel* femmodel,IssmDouble* peartharea,IssmDouble* poceanarea){ /*{{{*/ 306 307 307 308 /*Eustatic core of the SLR solution (terms that are constant with respect to sea-level)*/ … … 317 318 IssmDouble *radius = NULL; 318 319 int loop; 320 IssmDouble eartharea,oceanarea; 319 321 320 322 /*outputs:*/ … … 334 336 335 337 /*call the eustatic main module: */ 336 femmodel->SealevelriseEustatic(RSLgi,&e ustatic, latitude, longitude, radius,loop); //this computes338 femmodel->SealevelriseEustatic(RSLgi,&eartharea, &oceanarea,&eustatic, latitude, longitude, radius,loop); //this computes 337 339 338 340 /*we need to average RSLgi over the ocean: RHS term 4 in Eq.4 of Farrel and clarke. Only the elements can do that: */ 339 RSLgi_oceanaverage=femmodel->SealevelriseOceanAverage(RSLgi );341 RSLgi_oceanaverage=femmodel->SealevelriseOceanAverage(RSLgi,oceanarea); 340 342 341 343 /*RSLg is the sum of the pure eustatic component (term 3) and the contribution from the perturbation to the graviation potential due to the … … 350 352 xDelete<IssmDouble>(longitude); 351 353 xDelete<IssmDouble>(radius); 354 355 /*Assign output pointers and return: */ 356 *peartharea=eartharea; 357 *poceanarea=oceanarea; 352 358 return RSLgi; 353 359 }/*}}}*/ 354 Vector<IssmDouble>* sealevelrise_core_noneustatic(FemModel* femmodel,Vector<IssmDouble>* RSLg_eustatic ){ /*{{{*/360 Vector<IssmDouble>* sealevelrise_core_noneustatic(FemModel* femmodel,Vector<IssmDouble>* RSLg_eustatic,IssmDouble eartharea,IssmDouble oceanarea){ /*{{{*/ 355 361 356 362 /*sealevelrise_core_noneustatic.cpp //this computes the contributions from Eq.4 of Farrel and Clarke, rhs terms 2 and 5. … … 419 425 420 426 /*call the non eustatic module: */ 421 femmodel->SealevelriseNonEustatic(RSLgo, RSLg_old, latitude,longitude, radius,verboseconvolution,loop);427 femmodel->SealevelriseNonEustatic(RSLgo, RSLg_old, eartharea,latitude,longitude, radius,verboseconvolution,loop); 422 428 423 429 /*assemble solution vector: */ … … 428 434 /*call rotational feedback module: */ 429 435 RSLgo_rot = new Vector<IssmDouble>(gsize); RSLgo_rot->Assemble(); 430 femmodel->SealevelriseRotationalFeedback(RSLgo_rot,RSLg_old,&Ixz,&Iyz,&Izz, latitude,longitude,radius);436 femmodel->SealevelriseRotationalFeedback(RSLgo_rot,RSLg_old,&Ixz,&Iyz,&Izz,eartharea,latitude,longitude,radius); 431 437 RSLgo_rot->Assemble(); 432 438 … … 440 446 441 447 /*we need to average RSLgo over the ocean: RHS term 5 in Eq.4 of Farrel and clarke. Only the elements can do that: */ 442 RSLgo_oceanaverage=femmodel->SealevelriseOceanAverage(RSLgo );448 RSLgo_oceanaverage=femmodel->SealevelriseOceanAverage(RSLgo,oceanarea); 443 449 444 450 /*RSLg is the sum of the eustatic term, and the ocean terms: */ … … 477 483 return RSLg; 478 484 } /*}}}*/ 479 void sealevelrise_core_elastic(Vector<IssmDouble>** pU_esa, Vector<IssmDouble>** pU_north_esa,Vector<IssmDouble>** pU_east_esa,FemModel* femmodel,Vector<IssmDouble>* RSLg ){ /*{{{*/485 void sealevelrise_core_elastic(Vector<IssmDouble>** pU_esa, Vector<IssmDouble>** pU_north_esa,Vector<IssmDouble>** pU_east_esa,FemModel* femmodel,Vector<IssmDouble>* RSLg,IssmDouble eartharea){ /*{{{*/ 480 486 481 487 Vector<IssmDouble> *U_esa = NULL; … … 515 521 516 522 /*call the elastic main modlule:*/ 517 femmodel->SealevelriseElastic(U_esa,U_north_esa,U_east_esa,RSLg, latitude,longitude,radius,xx,yy,zz,loop,horiz);523 femmodel->SealevelriseElastic(U_esa,U_north_esa,U_east_esa,RSLg,eartharea,latitude,longitude,radius,xx,yy,zz,loop,horiz); 518 524 519 525 /*Assign output pointers:*/
Note:
See TracChangeset
for help on using the changeset viewer.