Changeset 20033
- Timestamp:
- 01/30/16 19:12:44 (9 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/SealevelriseAnalysis.cpp
r20030 r20033 45 45 bool elastic=false; 46 46 IssmDouble* G_elastic = NULL; 47 int M; 47 IssmDouble* G_elastic_local = NULL; 48 int M,m,lower_row,upper_row; 49 IssmDouble degacc=.01; 48 50 49 51 /*some constant parameters: */ … … 63 65 64 66 /*compute elastic green function for a range of angles*/ 65 IssmDouble degacc=.01; M=reCast<int,IssmDouble>(180./degacc+1.); 67 iomodel->FetchData(°acc,SealevelriseDegaccEnum); 68 M=reCast<int>(180/degacc+1); 66 69 G_elastic=xNew<IssmDouble>(M); 67 70 68 71 /*compute combined legendre + love number (elastic green function:*/ 69 for(int i=0;i<M;i++){ //watch out the <= 72 m=DetermineLocalSize(M,IssmComm::GetComm()); 73 GetOwnershipBoundariesFromRange(&lower_row,&upper_row,m,IssmComm::GetComm()); 74 G_elastic_local=xNew<IssmDouble>(m); 75 76 for(int i=lower_row;i<upper_row;i++){ 77 IssmDouble alpha,x; 78 alpha= reCast<IssmDouble>(i)*degacc * PI / 180.0; 79 80 G_elastic_local[i-lower_row]= (love_k[nl-1]-love_h[nl-1])/2.0/sin(alpha/2.0); 81 for (int n=0;n<nl;n++) { 82 IssmDouble Pn,Pn1,Pn2; 83 IssmDouble deltalove; 84 85 deltalove = (love_k[n]-love_k[nl-1]-love_h[n]+love_h[nl-1]); 86 87 if(n==0)Pn=1; 88 else if(n==1)Pn=cos(alpha); 89 else Pn= ( (2*n-1)*cos(alpha)*Pn1 - (n-1)*Pn2 ) /n; 90 Pn2=Pn1; Pn1=Pn; 91 92 G_elastic_local[i-lower_row] += deltalove*Pn; 93 } 94 } 95 96 /*merge G_elastic_local into G_elastic:{{{*/ 97 int* recvcounts=xNew<int>(IssmComm::GetSize()); 98 int* displs=xNew<int>(IssmComm::GetSize()); 99 100 //recvcounts: 101 ISSM_MPI_Allgather(&m,1,ISSM_MPI_INT,recvcounts,1,ISSM_MPI_INT,IssmComm::GetComm()); 102 103 /*displs: */ 104 ISSM_MPI_Allgather(&lower_row,1,ISSM_MPI_INT,displs,1,ISSM_MPI_INT,IssmComm::GetComm()); 105 106 /*All gather:*/ 107 ISSM_MPI_Allgatherv(G_elastic_local, m, ISSM_MPI_DOUBLE, G_elastic, recvcounts, displs, ISSM_MPI_DOUBLE,IssmComm::GetComm()); 108 /*free ressources: */ 109 xDelete<int>(recvcounts); 110 xDelete<int>(displs); 111 112 /*}}}*/ 113 114 /*Old code: {{{*/ 115 /*for(int i=0;i<M;i++){ 70 116 IssmDouble alpha,x; 71 117 alpha= reCast<IssmDouble>(i)*degacc * PI / 180.0; … … 85 131 G_elastic[i] += deltalove*Pn; 86 132 } 87 } 133 }*/ 134 /*}}}*/ 88 135 89 136 /*Avoid singularity at 0: */ … … 91 138 parameters->AddObject(new DoubleVecParam(SealevelriseGElasticEnum,G_elastic,M)); 92 139 93 /*free ressources:*/94 xDelete<IssmDouble>(G_elastic);95 96 140 /*free ressources: */ 97 141 xDelete<IssmDouble>(love_h); 98 142 xDelete<IssmDouble>(love_k); 99 143 xDelete<IssmDouble>(G_elastic); 144 xDelete<IssmDouble>(G_elastic_local); 100 145 } 101 146 -
issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
r20028 r20033 1048 1048 SealevelriseEustaticEnum, 1049 1049 SealevelriseGElasticEnum, 1050 SealevelriseDegaccEnum, 1050 1051 /*}}}*/ 1051 1052 MaximumNumberOfDefinitionsEnum -
issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
r20028 r20033 1002 1002 case SealevelriseEustaticEnum : return "SealevelriseEustatic"; 1003 1003 case SealevelriseGElasticEnum : return "SealevelriseGElastic"; 1004 case SealevelriseDegaccEnum : return "SealevelriseDegacc"; 1004 1005 case MaximumNumberOfDefinitionsEnum : return "MaximumNumberOfDefinitions"; 1005 1006 default : return "unknown"; -
issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
r20028 r20033 1026 1026 else if (strcmp(name,"SealevelriseEustatic")==0) return SealevelriseEustaticEnum; 1027 1027 else if (strcmp(name,"SealevelriseGElastic")==0) return SealevelriseGElasticEnum; 1028 else if (strcmp(name,"SealevelriseDegacc")==0) return SealevelriseDegaccEnum; 1028 1029 else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum; 1029 1030 else stage=10; -
issm/trunk-jpl/src/c/shared/Numerics/legendre.cpp
r20032 r20033 140 140 #include "./recast.h" 141 141 142 IssmDouble *p_polynomial_value ( int m, int n, IssmDouble* x){142 IssmDouble *p_polynomial_value ( int m, int n, IssmDouble* x){ 143 143 144 144 /******************************************************************************{{{/ -
issm/trunk-jpl/src/m/classes/slr.m
r20028 r20033 15 15 elastic = 0; 16 16 eustatic = 0; 17 degacc = 0; 17 18 end 18 19 methods … … 38 39 self.elastic=1; 39 40 self.eustatic=1; 41 42 %numerical discretization accuracy 43 self.degacc=.01; 40 44 41 45 end % }}} … … 49 53 md = checkfield(md,'fieldname','slr.abstol','size',[1 1]); 50 54 md = checkfield(md,'fieldname','slr.maxiter','size',[1 1],'>=',1); 55 md = checkfield(md,'fieldname','slr.degacc','size',[1 1],'>=',1e-10); 51 56 52 57 %check that love numbers are provided at the same level of accuracy: … … 68 73 fielddisplay(self,'elastic','elastic earth graviational potential perturbation'); 69 74 fielddisplay(self,'eustatic','eustatic sea level rise'); 75 fielddisplay(self,'degacc','accuracy (default .01 deg) for numerical discretization of the Green''s functions'); 70 76 71 77 end % }}} … … 80 86 WriteData(fid,'object',self,'class','sealevelrise','fieldname','elastic','format','Boolean'); 81 87 WriteData(fid,'object',self,'class','sealevelrise','fieldname','eustatic','format','Boolean'); 88 WriteData(fid,'object',self,'class','sealevelrise','fieldname','degacc','format','Double'); 82 89 end % }}} 83 90 function savemodeljs(self,fid,modelname) % {{{ … … 91 98 writejsdouble(fid,[modelname '.slr.rigid'],self.rigid); 92 99 writejsdouble(fid,[modelname '.slr.eustatic'],self.eustatic); 100 writejsdouble(fid,[modelname '.slr.degacc'],self.degacc); 93 101 94 102 end % }}} -
issm/trunk-jpl/src/m/enum/EnumDefinitions.js
r20028 r20033 987 987 function SealevelriseEustaticEnum(){ return 983;} 988 988 function SealevelriseGElasticEnum(){ return 984;} 989 function MaximumNumberOfDefinitionsEnum(){ return 985;} 989 function SealevelriseDegaccEnum(){ return 985;} 990 function MaximumNumberOfDefinitionsEnum(){ return 986;} -
issm/trunk-jpl/src/m/enum/EnumDefinitions.py
r20028 r20033 994 994 def SealevelriseEustaticEnum(): return StringToEnum("SealevelriseEustatic")[0] 995 995 def SealevelriseGElasticEnum(): return StringToEnum("SealevelriseGElastic")[0] 996 def SealevelriseDegaccEnum(): return StringToEnum("SealevelriseDegacc")[0] 996 997 def MaximumNumberOfDefinitionsEnum(): return StringToEnum("MaximumNumberOfDefinitions")[0]
Note:
See TracChangeset
for help on using the changeset viewer.