Changeset 27104
- Timestamp:
- 06/24/22 10:10:09 (3 years ago)
- Location:
- issm/branches/trunk-larour-SLPS2022/src/c
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/branches/trunk-larour-SLPS2022/src/c/analyses/SealevelchangeAnalysis.cpp
r27084 r27104 9 9 10 10 /*Model processing*/ 11 SealevelchangeAnalysis::~SealevelchangeAnalysis(){/*{{{*/ 12 13 BarystaticContributions* barycontrib=NULL; 14 GenericParam<BarystaticContributions*>* barycontribparam=NULL; 15 16 barycontribparam = xDynamicCast<GenericParam<BarystaticContributions*>*>(femmodel->parameters->FindParamObject(BarystaticContributionsEnum)); 17 barycontrib=barycontribparam->GetParameterValue(); 18 19 delete barycontrib; 20 }/*}}}*/ 11 21 void SealevelchangeAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 12 22 /*No constraints*/ … … 43 53 /*external solidearthsolution: solid-Earth model*/ 44 54 iomodel->FetchData(&isexternal,"md.solidearth.isexternal"); 55 45 56 if(isexternal){ 46 57 iomodel->FetchData(&horiz,"md.solidearth.settings.horiz"); … … 209 220 iomodel->FetchData(&externalnature,"md.solidearth.external.nature"); 210 221 if(externalnature>=3){ 211 intmodelid;222 IssmDouble modelid; 212 223 int nummodels; 213 224 … … 276 287 parameters->AddObject(new DoubleMatParam(LoveTimeFreqEnum,love_timefreq,precomputednt,1)); 277 288 parameters->AddObject(new BoolParam(LoveIsTimeEnum,love_istime)); 289 290 /*Free allocations:*/ 291 xDelete<IssmDouble>(love_timefreq); 278 292 279 293 // AD performance is sensitive to calls to ensurecontiguous. … … 524 538 nt=1; //in elastic, or if we run only selfattraction, we need only one step 525 539 #ifdef _HAVE_AD_ 526 G_viscoelastic_interpolated= G_viscoelastic;527 U_viscoelastic_interpolated= U_viscoelastic;528 if(horiz) H_viscoelastic_interpolated=H_viscoelastic;540 G_viscoelastic_interpolated=xNew<IssmDouble>(M,"t"); 541 U_viscoelastic_interpolated=xNew<IssmDouble>(M,"t"); 542 if(horiz) H_viscoelastic_interpolated=xNew<IssmDouble>(M,"t"); 529 543 #else 530 G_viscoelastic_interpolated= G_viscoelastic;531 U_viscoelastic_interpolated= U_viscoelastic;532 if(horiz) H_viscoelastic_interpolated=H_viscoelastic;544 G_viscoelastic_interpolated=xNew<IssmDouble>(M); 545 U_viscoelastic_interpolated=xNew<IssmDouble>(M); 546 if(horiz) H_viscoelastic_interpolated=xNew<IssmDouble>(M); 533 547 #endif 548 549 550 xMemCpy<IssmDouble>(G_viscoelastic_interpolated,G_viscoelastic,M); 551 xMemCpy<IssmDouble>(U_viscoelastic_interpolated,U_viscoelastic,M); 552 if(horiz) xMemCpy<IssmDouble>(H_viscoelastic_interpolated,H_viscoelastic,M); 534 553 535 554 if(rotation){ //if this cpu handles degree 2 … … 550 569 #endif 551 570 552 Pmtf_col_interpolated =love_pmtf_colinear;553 Pmtf_ortho_interpolated =love_pmtf_ortho;571 Pmtf_col_interpolated[0]=love_pmtf_colinear[0]; 572 Pmtf_ortho_interpolated[0]=love_pmtf_ortho[0]; 554 573 Pmtf_z_interpolated[0]=1.0+love_k[2]; 555 574 Love_tk2_interpolated[0]=love_tk[2]; … … 587 606 xDelete<IssmDouble>(G_viscoelastic); 588 607 xDelete<IssmDouble>(G_viscoelastic_local); 608 xDelete<IssmDouble>(G_viscoelastic_interpolated); 589 609 xDelete<IssmDouble>(U_viscoelastic); 610 xDelete<IssmDouble>(U_viscoelastic_interpolated); 590 611 xDelete<IssmDouble>(U_viscoelastic_local); 591 612 if(horiz){ 592 613 xDelete<IssmDouble>(H_viscoelastic); 614 xDelete<IssmDouble>(H_viscoelastic_interpolated); 593 615 xDelete<IssmDouble>(H_viscoelastic_local); 594 616 } … … 596 618 xDelete<IssmDouble>(love_pmtf_colinear); 597 619 xDelete<IssmDouble>(love_pmtf_ortho); 620 621 xDelete<IssmDouble>(Love_tk2_interpolated); 622 xDelete<IssmDouble>(Love_th2_interpolated); 623 xDelete<IssmDouble>(Pmtf_col_interpolated); 624 xDelete<IssmDouble>(Pmtf_ortho_interpolated); 625 xDelete<IssmDouble>(Pmtf_z_interpolated); 626 if(horiz){ 627 xDelete<IssmDouble>(Love_tl2_interpolated); 628 } 598 629 599 630 } … … 622 653 iomodel->DeleteData(&requestedoutputs,numoutputs,"md.solidearth.requested_outputs"); 623 654 /*}}}*/ 655 624 656 }/*}}}*/ 625 657 -
issm/branches/trunk-larour-SLPS2022/src/c/classes/Elements/Tria.cpp
r26911 r27104 6657 6657 LoveRotRSL = xNewZeroInit<IssmDouble>(nt); 6658 6658 LoveRotU = xNewZeroInit<IssmDouble>(nt); 6659 LoveRothoriz= xNewZeroInit<IssmDouble>(nt);6659 if(horiz)LoveRothoriz= xNewZeroInit<IssmDouble>(nt); 6660 6660 Grot = xNewZeroInit<IssmDouble>(3*3*nt); //3 polar motion components * 3 vertices * number of time steps 6661 6661 GUrot = xNewZeroInit<IssmDouble>(3*3*nt); … … 6743 6743 } 6744 6744 } 6745 /*Free ressources:*/ 6746 xDelete<IssmDouble>(LoveRotRSL); 6747 xDelete<IssmDouble>(LoveRotU); 6748 if(horiz)xDelete<IssmDouble>(LoveRothoriz); 6745 6749 } 6746 6750 /*}}}*/ … … 7466 7470 /*Keep track of barystatic contributions:*/ 7467 7471 barycontrib->Set(this->Sid(),bslcice,bslchydro,bslcbp); 7472 7473 /*Free ressources:*/ 7474 xDelete<IssmDouble>(areae); 7468 7475 7469 7476 } … … 7782 7789 /*Save viscous stack now that we updated the values:*/ 7783 7790 this->inputs->SetArrayInput(viscousenum,this->lid,viscousfield,3*viscousnumsteps); 7791 7792 /*Free ressources:*/ 7793 xDelete<IssmDouble>(grdfieldinterp); 7784 7794 } 7785 7795 … … 7800 7810 for(i=0;i<NUMVERTICES;i++) grdfieldout[i]=grdfield[i*nt+0]; 7801 7811 } 7812 /*Free ressources:*/ 7813 xDelete<IssmDouble>(grdfield); 7802 7814 7803 7815 } /*}}}*/ -
issm/branches/trunk-larour-SLPS2022/src/c/classes/GrdLoads.cpp
r26800 r27104 19 19 GrdLoads::GrdLoads(int nel,SealevelGeometry* slgeom){ /*{{{*/ 20 20 21 /*allocate:*/ 21 22 vloads=new Vector<IssmDouble>(nel); 22 23 for (int i=0;i<SLGEOM_NUMLOADS;i++) vsubloads[i]=new Vector<IssmDouble>(slgeom->nbar[i]); … … 26 27 27 28 vsubsealevelloads=new Vector<IssmDouble>(slgeom->nbar[SLGEOM_OCEAN]); 29 30 /*make sure all pointers that are not allocated are NULL:*/ 31 loads=NULL; 32 for (int i=0;i<SLGEOM_NUMLOADS;i++)subloads[i]=NULL; 33 sealevelloads=NULL; 34 subsealevelloads=NULL; 35 28 36 29 37 }; /*}}}*/ … … 50 58 } 51 59 60 /*Avoid leaks:*/ 61 if(loads)xDelete<IssmDouble>(loads); 62 for (int i=0;i<SLGEOM_NUMLOADS;i++){ 63 if(subloads[i])xDelete<IssmDouble>(subloads[i]); 64 } 65 66 /*Serialize:*/ 52 67 loads=vloads->ToMPISerial(); 53 68 for (int i=0;i<SLGEOM_NUMLOADS;i++){ … … 64 79 void GrdLoads::BroadcastSealevelLoads(void){ /*{{{*/ 65 80 81 /*Avoid leakds:*/ 82 if(sealevelloads)xDelete<IssmDouble>(sealevelloads); 83 if(subsealevelloads)xDelete<IssmDouble>(subsealevelloads); 84 85 /*Serialize:*/ 66 86 sealevelloads=vsealevelloads->ToMPISerial(); 67 87 subsealevelloads=vsubsealevelloads->ToMPISerial(); 68 88 69 89 } /*}}}*/ 70 void GrdLoads::SHDegree2Coefficients(IssmDouble* deg2coeff, FemModel* femmodel, SealevelGeometry* slgeom){ 90 void GrdLoads::SHDegree2Coefficients(IssmDouble* deg2coeff, FemModel* femmodel, SealevelGeometry* slgeom){ /*{{{*/ 71 91 72 92 IssmDouble area,re, S; … … 119 139 ISSM_MPI_Bcast(°2coeff[2],1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 120 140 121 } 141 } /*}}}*/ -
issm/branches/trunk-larour-SLPS2022/src/c/cores/sealevelchange_core.cpp
r27083 r27104 81 81 /*End profiler*/ 82 82 femmodel->profiler->Stop(SLRCORE); 83 84 /*Free ressources:*/ 85 delete slgeom; 86 83 87 } 84 88 /*}}}*/ … … 265 269 /*only run if grd was requested, if we are the earth, and we have reached 266 270 * the necessary number of time steps dictated by :*/ 267 if(!grd) return;271 if(!grd) return; 268 272 if(count!=frequency)return; 269 273 femmodel->parameters->FindParam(&iscoupling,IsSlcCouplingEnum); … … 357 361 358 362 //convergence? 359 if(slcconvergence(loads->vsealevelloads,oldsealevelloads,eps_rel,eps_abs))break; 363 if(slcconvergence(loads->vsealevelloads,oldsealevelloads,eps_rel,eps_abs)){ 364 delete oldsealevelloads; break; 365 } 360 366 361 367 //early return? 362 if(iterations>=max_nonlinear_iterations)break; 368 if(iterations>=max_nonlinear_iterations){ 369 delete oldsealevelloads; break; 370 } 363 371 iterations++; 372 delete oldsealevelloads; 364 373 } 365 374 … … 381 390 if(planethasocean){ 382 391 if (!sealevelloading){ //we haven't done so before, so we need to compute the ocean average and area 383 loads->sealevelloads=NULL; //needed to trigger the calculation of areas392 if(loads->sealevelloads)xDelete<IssmDouble>(loads->sealevelloads); loads->sealevelloads=NULL; //needed to trigger the calculation of areas 384 393 /*retrieve sea level average and ocean area:*/ 385 394 for(Object* & object : femmodel->elements->objects){ … … 423 432 } 424 433 434 /*Free ressources:*/ 435 delete loads; 436 delete subelementoceanareas; 437 delete oceanareas; 438 xDelete<IssmDouble>(sealevelpercpu); 439 425 440 } 426 441 /*}}}*/ … … 607 622 #endif 608 623 624 xDelete<IssmDouble>(xxe); 625 xDelete<IssmDouble>(yye); 626 xDelete<IssmDouble>(zze); 627 xDelete<IssmDouble>(areae); 628 609 629 /*Indicate we won't do this twice: */ 610 630 femmodel->parameters->AddObject(new BoolParam(SealevelchangeGeometryDoneEnum,true)); 631 611 632 612 633 return; … … 675 696 femmodel->parameters->AddObject(new DoubleVecParam(ZzeEnum,zze,nel)); 676 697 femmodel->parameters->AddObject(new DoubleVecParam(AreaeEnum,areae,nel)); 698 699 /*Free ressources:*/ 700 xDelete<IssmDouble>(xxe); 701 xDelete<IssmDouble>(yye); 702 xDelete<IssmDouble>(zze); 703 xDelete<IssmDouble>(areae); 677 704 678 705 return slgeom; … … 873 900 xDelete<IssmDouble>(m3interp); 874 901 } 875 } 902 xDelete<IssmDouble>(viscoustimes); 903 xDelete<IssmDouble>(viscouspolarmotion); 904 } 905 xDelete<IssmDouble>(pmtf_col); 906 xDelete<IssmDouble>(pmtf_ortho); 907 xDelete<IssmDouble>(pmtf_z); 876 908 877 909 } /*}}}*/ -
issm/branches/trunk-larour-SLPS2022/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
r26327 r27104 223 223 { 224 224 Tria* tria= xDynamicCast<Tria*>(element); 225 if(tria->hmaterial)delete tria->hmaterial; 225 226 tria->hmaterial=NULL; 226 227 }
Note:
See TracChangeset
for help on using the changeset viewer.