Changeset 26230
- Timestamp:
- 05/03/21 12:34:53 (4 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Element.h
r26227 r26230 397 397 virtual void SealevelchangeGeometrySubElementLoads(SealevelGeometry* slgeom, IssmDouble* areae)=0; 398 398 virtual void SealevelchangeBarystaticLoads(GrdLoads* loads, BarystaticContributions* barycontrib, SealevelGeometry* slgeom)=0; 399 virtual void SealevelchangeConvolution(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* rotationvector,SealevelGeometry* slgeom)=0; 399 virtual void SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom)=0; 400 virtual void SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom)=0; 400 401 virtual void SealevelchangeDeformationConvolution(GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom)=0; 401 402 virtual void SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom)=0; -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r26227 r26230 230 230 void SealevelchangeGeometrySubElementLoads(SealevelGeometry* slgeom, IssmDouble* areae){_error_("not implemented yet");}; 231 231 void SealevelchangeBarystaticLoads(GrdLoads* loads, BarystaticContributions* barycontrib, SealevelGeometry* slgeom){_error_("not implemented yet");}; 232 void SealevelchangeConvolution(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 232 void SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 233 void SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom){_error_("not implemented yet");}; 233 234 void SealevelchangeDeformationConvolution(GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 234 235 void SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r26227 r26230 185 185 void SealevelchangeGeometrySubElementLoads(SealevelGeometry* slgeom, IssmDouble* areae){_error_("not implemented yet");}; 186 186 void SealevelchangeBarystaticLoads(GrdLoads* loads, BarystaticContributions* barycontrib, SealevelGeometry* slgeom){_error_("not implemented yet");}; 187 void SealevelchangeConvolution(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 187 void SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 188 void SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom){_error_("not implemented yet");}; 188 189 void SealevelchangeDeformationConvolution(GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 189 190 void SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Tetra.h
r26227 r26230 192 192 void SealevelchangeGeometrySubElementLoads(SealevelGeometry* slgeom, IssmDouble* areae){_error_("not implemented yet");}; 193 193 void SealevelchangeBarystaticLoads(GrdLoads* loads, BarystaticContributions* barycontrib, SealevelGeometry* slgeom){_error_("not implemented yet");}; 194 void SealevelchangeConvolution(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 194 void SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 195 void SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom){_error_("not implemented yet");}; 195 196 void SealevelchangeDeformationConvolution(GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");}; 196 197 void SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r26227 r26230 6305 6305 #endif 6306 6306 /*}}}*/ 6307 6308 6309 6307 return; 6310 6308 … … 6351 6349 slgeom->isoceanin[this->lid]=isocean; //keep track for later. 6352 6350 area=areae[this->sid]; 6351 6352 /*Compute element ids, used to speed up computations in convolution phase:{{{*/ 6353 for(int i=0;i<NUMVERTICES;i++){ 6354 slgeom->lids[this->vertices[i]->lid]=this->lid; 6355 } 6356 /*}}}*/ 6353 6357 6354 6358 /*set barycentre for all elements, to be updated for fractional loads in the next routine: */ … … 6884 6888 } 6885 6889 /*}}}*/ 6886 void Tria::SealevelchangeConvolution( GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* rotationvector,SealevelGeometry* slgeom){ /*{{{*/6890 void Tria::SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){ /*{{{*/ 6887 6891 6888 6892 /*sal green function:*/ … … 6896 6900 bool sal = false; 6897 6901 bool rotation= false; 6902 bool percpu= false; 6898 6903 int size; 6899 6904 int nel,nbar; … … 6907 6912 this->parameters->FindParam(&rho_water,MaterialsRhoSeawaterEnum); 6908 6913 6914 if(sal){ 6915 this->inputs->GetArrayPtr(SealevelchangeGEnum,this->lid,&G,&size); 6916 this->inputs->GetArrayPtr(SealevelchangeGsubelIceEnum,this->lid,&Gsub[SLGEOM_ICE],&size); 6917 this->inputs->GetArrayPtr(SealevelchangeGsubelHydroEnum,this->lid,&Gsub[SLGEOM_WATER],&size); 6918 this->inputs->GetArrayPtr(SealevelchangeGsubelOceanEnum,this->lid,&Gsub[SLGEOM_OCEAN],&size); 6919 6920 this->SealevelchangeGxL(sealevelpercpu, G, Gsub, loads, slgeom, nel,percpu=true); 6921 } 6922 6909 6923 if(rotation){ 6910 6924 Element::GetInputListOnVertices(&Grotm1[0],SealevelGrotm1Enum); … … 6912 6926 Element::GetInputListOnVertices(&Grotm3[0],SealevelGrotm3Enum); 6913 6927 6914 for(int i=0;i<NUMVERTICES;i++) SealevelGRD[i]+=Grotm1[i]*rotationvector[0]+Grotm2[i]*rotationvector[1]+Grotm3[i]*rotationvector[2]; 6915 } 6916 6917 if(sal){ 6918 this->inputs->GetArrayPtr(SealevelchangeGEnum,this->lid,&G,&size); 6919 this->inputs->GetArrayPtr(SealevelchangeGsubelIceEnum,this->lid,&Gsub[SLGEOM_ICE],&size); 6920 this->inputs->GetArrayPtr(SealevelchangeGsubelHydroEnum,this->lid,&Gsub[SLGEOM_WATER],&size); 6921 this->inputs->GetArrayPtr(SealevelchangeGsubelOceanEnum,this->lid,&Gsub[SLGEOM_OCEAN],&size); 6922 6923 this->SealevelchangeGxL(&SealevelGRD[0],G, Gsub, loads, slgeom, nel); 6924 } 6928 for(int i=0;i<NUMVERTICES;i++){ 6929 if(slgeom->lids[this->vertices[i]->lid]==this->lid){ 6930 sealevelpercpu[this->vertices[i]->lid]+=Grotm1[i]*rotationvector[0]+Grotm2[i]*rotationvector[1]+Grotm3[i]*rotationvector[2]; 6931 } 6932 } 6933 } 6934 return; 6935 } /*}}}*/ 6936 void Tria::SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom){ /*{{{*/ 6937 6938 /*sal green function:*/ 6939 IssmDouble* G=NULL; 6940 IssmDouble* Gsub[SLGEOM_NUMLOADS]; 6941 IssmDouble oceanaverage=0; 6942 IssmDouble oceanarea=0; 6943 IssmDouble rho_water; 6944 6945 this->parameters->FindParam(&rho_water,MaterialsRhoSeawaterEnum); 6925 6946 6926 6947 /*retrieve ocean average and area:*/ 6927 6948 for(int i=0;i<NUMVERTICES;i++){ 6928 oceanaverage+= SealevelGRD[i]*slgeom->LoadWeigths[SLGEOM_OCEAN][i][this->lid];6949 oceanaverage+=sealevelpercpu[this->vertices[i]->lid]*slgeom->LoadWeigths[SLGEOM_OCEAN][i][this->lid]; 6929 6950 } 6930 6951 #ifdef _ISSM_DEBUG_ … … 6940 6961 else loads->vsealevelloads->SetValue(this->sid,oceanaverage*rho_water,INS_VAL); 6941 6962 6963 /*add ocean area into a global oceanareas vector:*/ 6942 6964 if(!loads->sealevelloads){ 6943 6965 oceanareas->SetValue(this->sid,oceanarea,INS_VAL); … … 6947 6969 } 6948 6970 } 6949 6950 6971 6951 6972 return; … … 6976 6997 bool rotation= false; 6977 6998 bool elastic=false; 6999 bool percpu=false; 6978 7000 6979 7001 this->parameters->FindParam(&nel,MeshNumberofelementsEnum); … … 6983 7005 this->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum); 6984 7006 6985 if(rotation){ 6986 Element::GetInputListOnVertices(&Grotm1[0],SealevelGrotm1Enum); 6987 Element::GetInputListOnVertices(&Grotm2[0],SealevelGrotm2Enum); 6988 Element::GetInputListOnVertices(&Grotm3[0],SealevelGrotm3Enum); 6989 6990 for(int i=0;i<NUMVERTICES;i++) SealevelRSL[i]+=Grotm1[i]*rotationvector[0]+Grotm2[i]*rotationvector[1]+Grotm3[i]*rotationvector[2]; 6991 } 7007 6992 7008 6993 7009 if(sal){ … … 7016 7032 } 7017 7033 7018 this->SealevelchangeGxL(&SealevelRSL[0],G, Gsub, loads, slgeom, nel );7034 this->SealevelchangeGxL(&SealevelRSL[0],G, Gsub, loads, slgeom, nel,percpu=false); 7019 7035 7020 7036 if(elastic){ 7021 this->SealevelchangeGxL(&SealevelU[0],GU, GUsub, loads, slgeom, nel );7037 this->SealevelchangeGxL(&SealevelU[0],GU, GUsub, loads, slgeom, nel,percpu=false); 7022 7038 if(horiz ){ 7023 this->SealevelchangeGxL(&SealevelN[0],GN, GNsub, loads, slgeom, nel); 7024 this->SealevelchangeGxL(&SealevelE[0],GE, GEsub, loads, slgeom, nel); 7039 this->SealevelchangeGxL(&SealevelN[0],GN, GNsub, loads, slgeom, nel,percpu=false); 7040 this->SealevelchangeGxL(&SealevelE[0],GE, GEsub, loads, slgeom, nel,percpu=false); 7041 } 7042 } 7043 } 7044 7045 if(rotation){ 7046 Element::GetInputListOnVertices(&Grotm1[0],SealevelGrotm1Enum); 7047 Element::GetInputListOnVertices(&Grotm2[0],SealevelGrotm2Enum); 7048 Element::GetInputListOnVertices(&Grotm3[0],SealevelGrotm3Enum); 7049 7050 for(int i=0;i<NUMVERTICES;i++){ 7051 if(slgeom->lids[this->vertices[i]->lid]==this->lid){ 7052 SealevelRSL[i]+=Grotm1[i]*rotationvector[0]+Grotm2[i]*rotationvector[1]+Grotm3[i]*rotationvector[2]; 7025 7053 } 7026 7054 } … … 7040 7068 7041 7069 } /*}}}*/ 7042 void Tria::SealevelchangeGxL(IssmDouble* sealevel, IssmDouble* G, IssmDouble** Gsub, GrdLoads* loads, SealevelGeometry* slgeom, int nel) { /*{{{*/ 7070 void Tria::SealevelchangeGxL(IssmDouble* sealevelout, IssmDouble* G, IssmDouble** Gsub, GrdLoads* loads, SealevelGeometry* slgeom, int nel, bool percpu) { /*{{{*/ 7071 7072 IssmDouble sealevel[3]={0}; 7043 7073 7044 7074 if(loads->sealevelloads){ 7045 7075 for(int i=0;i<NUMVERTICES;i++) { 7076 if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue; 7046 7077 for (int e=0;e<nel;e++){ 7047 7078 sealevel[i]+=G[i*nel+e]*(loads->sealevelloads[e]+loads->loads[e]); … … 7062 7093 else{ //this is the initial convolution where only loads are provided 7063 7094 for(int i=0;i<NUMVERTICES;i++) { 7095 if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue; 7064 7096 for (int e=0;e<nel;e++){ 7065 7097 sealevel[i]+=G[i*nel+e]*(loads->loads[e]); … … 7072 7104 } 7073 7105 } 7106 } 7107 7108 /*store values computed on vertices, but don't repeat the computation if another element already computed it!:*/ 7109 if(percpu){ 7110 for(int i=0;i<NUMVERTICES;i++){ 7111 if(slgeom->lids[this->vertices[i]->lid]==this->lid)sealevelout[this->vertices[i]->lid]=sealevel[i]; 7112 } 7113 } 7114 else{ 7115 for(int i=0;i<NUMVERTICES;i++) sealevelout[i]=sealevel[i]; 7074 7116 } 7075 7117 -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r26227 r26230 174 174 void SealevelchangeGeometryCentroidLoads(SealevelGeometry* slgeom, IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae); 175 175 void SealevelchangeBarystaticLoads(GrdLoads* loads, BarystaticContributions* barycontrib, SealevelGeometry* slgeom); 176 void SealevelchangeConvolution(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* rotationvector,SealevelGeometry* slgeom); 176 void SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom); 177 void SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom); 177 178 void SealevelchangeDeformationConvolution(GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom); 178 179 void SealevelchangeShift(GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom); … … 242 243 void UpdateConstraintsExtrudeFromBase(void); 243 244 void UpdateConstraintsExtrudeFromTop(void); 244 void SealevelchangeGxL(IssmDouble* sealevel, IssmDouble* G, IssmDouble** Gsub, GrdLoads* loads, SealevelGeometry* slgeom, int nel );245 void SealevelchangeGxL(IssmDouble* sealevel, IssmDouble* G, IssmDouble** Gsub, GrdLoads* loads, SealevelGeometry* slgeom, int nel, bool optimize); 245 246 /*}}}*/ 246 247 -
issm/trunk-jpl/src/c/classes/SealevelGeometry.cpp
r26223 r26230 17 17 18 18 /*Object constructors and destructor*/ 19 SealevelGeometry::SealevelGeometry(int localnelin ){ /*{{{*/19 SealevelGeometry::SealevelGeometry(int localnelin,int localnodsin){ /*{{{*/ 20 20 localnel=localnelin; 21 21 for(int i=0;i<SLGEOM_NUMLOADS;i++){ … … 39 39 longe=xNew<IssmDouble>(localnel); 40 40 isoceanin=xNew<bool>(localnel); 41 lids=xNew<int>(localnodsin); 41 42 42 43 }; /*}}}*/ … … 59 60 xDelete<IssmDouble>(longe); 60 61 xDelete<bool>(isoceanin); 62 xDelete<int>(lids); 61 63 }; /*}}}*/ 62 64 -
issm/trunk-jpl/src/c/classes/SealevelGeometry.h
r26223 r26230 35 35 int nsubel[SLGEOM_NUMLOADS]; 36 36 int nbar[SLGEOM_NUMLOADS]; 37 int* lids; 37 38 38 SealevelGeometry(int localnel );39 SealevelGeometry(int localnel,int localnods); 39 40 ~SealevelGeometry(); 40 41 void InitializeMappingsAndBarycentres(void); -
issm/trunk-jpl/src/c/cores/sealevelchange_core.cpp
r26227 r26230 245 245 int grdmodel; 246 246 int computesealevel=0; 247 IssmDouble* sealevelpercpu=NULL; 247 248 248 249 /*}}}*/ … … 292 293 subelementoceanareas=new Vector<IssmDouble>(slgeom->nbar[SLGEOM_OCEAN]); 293 294 oceanareas=new Vector<IssmDouble>(nel); 295 sealevelpercpu=xNewZeroInit<IssmDouble>(femmodel->vertices->Size()); 294 296 295 297 if(VerboseSolution()) _printf0_(" starting GRD convolutions\n"); … … 322 324 for(Object* & object : femmodel->elements->objects){ 323 325 Element* element = xDynamicCast<Element*>(object); 324 element->SealevelchangeConvolution(loads, oceanareas, subelementoceanareas, rotationaxismotionvector,slgeom); 326 element->SealevelchangeConvolution(sealevelpercpu, loads , rotationaxismotionvector,slgeom); 327 } 328 329 /*retrieve sea level average and ocean area:*/ 330 for(Object* & object : femmodel->elements->objects){ 331 Element* element = xDynamicCast<Element*>(object); 332 element->SealevelchangeOceanAverage(loads, oceanareas, subelementoceanareas, sealevelpercpu, slgeom); 325 333 } 326 334 … … 535 543 femmodel->parameters->FindParam(&grdmodel,GrdModelEnum); 536 544 nel=femmodel->elements->NumberOfElements(); 537 545 538 546 /*early return?:*/ 539 547 if(grdmodel==IvinsEnum) return; … … 594 602 595 603 /*initialize SealevelMasks structure: */ 596 slgeom=new SealevelGeometry(femmodel->elements->Size() );604 slgeom=new SealevelGeometry(femmodel->elements->Size(),femmodel->vertices->Size()); 597 605 598 606 /*Verbose: */
Note:
See TracChangeset
for help on using the changeset viewer.