Changeset 24921 for issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
- Timestamp:
- 05/29/20 16:03:44 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r24915 r24921 5598 5598 5599 5599 /*elastic green function:*/ 5600 int index; 5600 5601 IssmDouble* G_elastic_precomputed=NULL; 5602 IssmDouble* G_rigid_precomputed=NULL; 5601 5603 int M; 5602 5604 … … 5649 5651 5650 5652 /*recover elastic green function:*/ 5653 DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGRigidEnum)); _assert_(parameter); 5654 parameter->GetParameterValueByPointer(&G_rigid_precomputed,&M); 5655 5651 5656 if(computeelastic){ 5652 DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGElasticEnum)); 5653 _assert_(parameter); 5657 parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGElasticEnum)); _assert_(parameter); 5654 5658 parameter->GetParameterValueByPointer(&G_elastic_precomputed,&M); 5655 5659 } … … 5748 5752 for(int i=0;i<gsize;i++){ 5749 5753 5750 IssmDouble G_rigid=0; //do not remove =0!5751 5754 IssmDouble G_elastic=0; //do not remove =0! 5752 5755 5753 /*Compute alpha angle between centroid and current vertex : */5756 /*Compute alpha angle between centroid and current vertex and index into precomputed tables: */ 5754 5757 lati=latitude[i]/180*PI; longi=longitude[i]/180*PI; 5755 5756 5758 delPhi=fabs(lati-late); delLambda=fabs(longi-longe); 5757 5759 alpha=2.*asin(sqrt(pow(sin(delPhi/2),2.0)+cos(lati)*cos(late)*pow(sin(delLambda/2),2))); 5758 5759 //Rigid earth gravitational perturbation: 5760 if(computerigid)G_rigid=1.0/2.0/sin(alpha/2.0); 5760 index=reCast<int,IssmDouble>(alpha/PI*reCast<IssmDouble,int>(M-1)); 5761 5761 5762 5762 //Elastic component (from Eq 17 in Adhikari et al, GMD 2015) 5763 if(computeelastic){ 5764 int index=reCast<int,IssmDouble>(alpha/PI*reCast<IssmDouble,int>(M-1)); 5765 G_elastic += G_elastic_precomputed[index]; 5766 } 5763 if(computeelastic) G_elastic += G_elastic_precomputed[index]; 5767 5764 5768 5765 /*Add all components to the Sgi or Sgo solution vectors:*/ 5769 Sgi[i]+=3*rho_ice/rho_earth*area/eartharea*I*(G_rigid+G_elastic); 5770 5766 Sgi[i]+=3*rho_ice/rho_earth*area/eartharea*I*(G_rigid_precomputed[index]+G_elastic); 5771 5767 } 5772 5768 } … … 5940 5936 5941 5937 /*precomputed elastic green functions:*/ 5938 IssmDouble* G_rigid_precomputed = NULL; 5942 5939 IssmDouble* G_elastic_precomputed = NULL; 5943 5940 int M; 5944 5945 /*computation of Green functions:*/ 5946 IssmDouble* G_elastic= NULL; 5947 IssmDouble* G_rigid= NULL; 5941 int index; 5942 IssmDouble alpha; 5943 IssmDouble delPhi,delLambda; 5948 5944 5949 5945 /*optimization:*/ … … 6020 6016 /*}}}*/ 6021 6017 6018 /*recover rigid and elastic green functions:*/ 6019 DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGRigidEnum)); _assert_(parameter); 6020 parameter->GetParameterValueByPointer(&G_rigid_precomputed,&M); 6021 6022 6022 if(computeelastic){ 6023 6024 6023 /*recover elastic green function:*/ 6025 DoubleVecParam*parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGElasticEnum)); _assert_(parameter);6024 parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGElasticEnum)); _assert_(parameter); 6026 6025 parameter->GetParameterValueByPointer(&G_elastic_precomputed,&M); 6027 6028 /*initialize G_elastic:*/ 6029 G_elastic=xNewZeroInit<IssmDouble>(gsize); 6030 } 6031 if(computerigid) G_rigid=xNewZeroInit<IssmDouble>(gsize); 6032 6033 IssmDouble alpha; 6034 IssmDouble delPhi,delLambda; 6035 6026 } 6027 6028 6036 6029 for(int i=0;i<gsize;i++){ 6037 6030 6038 6031 /*Compute alpha angle between centroid and current vertex : */ 6039 6032 lati=latitude[i]/180*PI; longi=longitude[i]/180*PI; 6040 6041 6033 delPhi=fabs(lati-late); delLambda=fabs(longi-longe); 6042 6034 alpha=2.*asin(sqrt(pow(sin(delPhi/2),2.0)+cos(lati)*cos(late)*pow(sin(delLambda/2),2))); 6035 index=reCast<int,IssmDouble>(alpha/PI*(M-1)); 6043 6036 6044 6037 /*Rigid earth gravitational perturbation: */ 6045 6038 if(computerigid){ 6046 G_rigid[i]=1.0/2.0/sin(alpha/2.0); 6047 //values[i]+=3*rho_water/rho_earth*area/eartharea*S*G_rigid[i]; 6048 Sgo[i]+=3*rho_water/rho_earth*area/eartharea*S*G_rigid[i]; 6039 Sgo[i]+=3*rho_water/rho_earth*area/eartharea*S*G_rigid_precomputed[index]; 6049 6040 } 6050 6041 6051 6042 /*Elastic component (from Eq 17 in Adhikari et al, GMD 2015): */ 6052 6043 if(computeelastic){ 6053 int index=reCast<int,IssmDouble>(alpha/PI*(M-1)); 6054 G_elastic[i] += G_elastic_precomputed[index]; 6055 //values[i]+=3*rho_water/rho_earth*area/eartharea*S*G_elastic[i]; 6056 Sgo[i]+=3*rho_water/rho_earth*area/eartharea*S*G_elastic[i]; 6057 } 6058 } 6059 6060 6061 /*Free ressources:*/ 6062 if(computeelastic) xDelete<IssmDouble>(G_elastic); 6063 if(computerigid) xDelete<IssmDouble>(G_rigid); 6044 Sgo[i]+=3*rho_water/rho_earth*area/eartharea*S*G_elastic_precomputed[index]; 6045 } 6046 } 6047 6064 6048 6065 6049 return;
Note:
See TracChangeset
for help on using the changeset viewer.