Changeset 26119
- Timestamp:
- 03/19/21 12:37:01 (4 years ago)
- Location:
- issm/trunk-jpl/src/c/cores
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/cores/cores.h
r26110 r26119 63 63 #endif 64 64 void grd_core(FemModel* femmodel); 65 void grd_core_optim(FemModel* femmodel); 65 66 void solidearthexternal_core(FemModel* femmodel); 66 67 void dynstr_core(FemModel* femmodel); 67 SealevelMasks* sealevel_masks(FemModel* femmodel);68 68 Vector<IssmDouble>* sealevelchange_core_barystatic(FemModel* femmodel,SealevelMasks* mask, IssmDouble* poceanarea); 69 69 Vector<IssmDouble>* sealevelchange_core_sal(FemModel* femmodel,SealevelMasks* masks, Vector<IssmDouble>* RSLg_barystatic,IssmDouble oceanarea); -
issm/trunk-jpl/src/c/cores/sealevelchange_core.cpp
r26110 r26119 17 17 void slcconvergence(bool* pconverged, Vector<IssmDouble>* RSLg,Vector<IssmDouble>* RSLg_old,IssmDouble eps_rel,IssmDouble eps_abs); 18 18 IssmDouble SealevelloadsOceanAverage(Vector<IssmDouble>* sealevelloads,Vector<IssmDouble>* oceanareas, IssmDouble oceanarea); 19 SealevelMasks* sealevel_masks(FemModel* femmodel); 19 20 /*}}}*/ 20 21 … … 390 391 }; /*}}}*/ 391 392 392 void grd_core_optim(FemModel* femmodel ,SealevelMasks* masks) { /*{{{*/393 void grd_core_optim(FemModel* femmodel) { /*{{{*/ 393 394 394 395 /*variables:{{{*/ 395 396 int nel; 396 397 BarystaticContributions* barycontrib=NULL; 398 SealevelMasks* masks=NULL; 397 399 GenericParam<BarystaticContributions*>* barycontribparam=NULL; 398 IssmDouble barystatic;399 400 400 401 Vector<IssmDouble>* loads=NULL; … … 402 403 Vector<IssmDouble>* sealevelloads=NULL; 403 404 Vector<IssmDouble>* oldsealevelloads=NULL; 404 IssmDouble sealevelloadsaverage;405 405 IssmDouble* allsealevelloads=NULL; 406 406 Vector<IssmDouble>* oceanareas=NULL; … … 413 413 int step; 414 414 IssmDouble time; 415 416 IssmDouble cumbslc; 417 IssmDouble cumbslcice; 418 IssmDouble cumbslchydro; 415 416 int modelid,earthid; 417 int horiz; 418 int count,frequency,iscoupling; 419 int grd=0; 419 420 /*}}}*/ 420 421 421 /*retrieve parameters: */ 422 /*Verbose: */ 423 if(VerboseSolution()) _printf0_(" computing GRD patterns\n"); 424 425 /*retrieve parameters:{{{*/ 426 femmodel->parameters->FindParam(&grd,SolidearthSettingsGRDEnum); 427 femmodel->parameters->FindParam(&frequency,SolidearthSettingsRunFrequencyEnum); 428 femmodel->parameters->FindParam(&count,SealevelchangeRunCountEnum); 429 /*}}}*/ 430 431 /*only run if grd was requested, if we are the earth, and we have reached 432 * the necessary number of time steps dictated by :*/ 433 if(!grd) return; 434 if(count!=frequency)return; 435 femmodel->parameters->FindParam(&iscoupling,IsSlcCouplingEnum); 436 if(iscoupling){ 437 femmodel->parameters->FindParam(&modelid,ModelIdEnum); 438 femmodel->parameters->FindParam(&earthid,EarthIdEnum); 439 if(modelid!=earthid)return; 440 } 441 /*retrieve parameters: {{{*/ 422 442 femmodel->parameters->FindParam(&scaleoceanarea,SolidearthSettingsOceanAreaScalingEnum); 423 443 barycontribparam = xDynamicCast<GenericParam<BarystaticContributions*>*>(femmodel->parameters->FindParamObject(BarystaticContributionsEnum)); … … 426 446 femmodel->parameters->FindParam(&eps_rel,SolidearthSettingsReltolEnum); 427 447 femmodel->parameters->FindParam(&eps_abs,SolidearthSettingsAbstolEnum); 428 448 femmodel->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum); 449 /*}}}*/ 450 429 451 /*initialize matrices and vectors:*/ 430 452 femmodel->parameters->FindParam(&nel,MeshNumberofelementsEnum); … … 432 454 sealevelloads=new Vector<IssmDouble>(nel); 433 455 oceanareas=new Vector<IssmDouble>(nel); 456 457 /*call masks core: */ 458 masks=sealevel_masks(femmodel); 434 459 435 460 /*buildup loads: */ … … 439 464 } 440 465 441 // Communicate loads from local to global:466 //broadcast loads 442 467 loads->Assemble(); allloads=loads->ToMPISerial(); 443 468 … … 447 472 element->SealevelchangeInitialConvolution(sealevelloads,oceanareas,allloads,masks); 448 473 } 449 474 sealevelloads->Assemble(); 475 450 476 //Get ocean area: 451 477 oceanareas->Assemble(); oceanareas->Sum(&oceanarea); _assert_(oceanarea>0.); 452 478 if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2 453 479 454 //Get sea level loads ocean average:455 sealevelloadsaverage=SealevelloadsOceanAverage(sealevelloads,oceanareas,oceanarea);456 457 480 //substract ocean average and barystatic contributionfrom sea level loads: 458 barystatic=barycontrib->Total()/oceanarea/rho_water; 459 sealevelloads->Shift(-sealevelloadsaverage+barystatic); 481 sealevelloads->Shift(barycontrib->Total()/oceanarea/rho_water - SealevelloadsOceanAverage(sealevelloads,oceanareas,oceanarea)); 482 483 //broadcast sea level loads 460 484 allsealevelloads=sealevelloads->ToMPISerial(); 461 485 … … 471 495 } 472 496 sealevelloads->Assemble(); 497 473 498 474 499 //substract ocean average and barystatic contribution 475 sealevelloadsaverage=SealevelloadsOceanAverage(sealevelloads,oceanareas,oceanarea); 476 sealevelloads->Shift(-sealevelloadsaverage+barystatic); 477 478 //broadcast loads 500 sealevelloads->Shift(barycontrib->Total()/oceanarea/rho_water - SealevelloadsOceanAverage(sealevelloads,oceanareas,oceanarea)); 501 502 //broadcast sea level loads 479 503 allsealevelloads=sealevelloads->ToMPISerial(); 480 504 … … 484 508 } 485 509 510 /*convolve loads and sea level loads to get the deformation:*/ 511 for(Object* & object : femmodel->elements->objects){ 512 Element* element = xDynamicCast<Element*>(object); 513 //element->SealevelchangeDeformationConvolution(allsealevelloads, allloads,masks); 514 } 515 516 /*Update bedrock motion and geoid:*/ 517 /*inputs->AXPY(SealevelEnum,SealevelGRD,1); 518 inputs->AXPY(BedEnum,BedGRD,1); 519 if(horiz){ 520 inputs->AXPY(BedrockeastEnum,BedEastGRD,1); 521 inputs->AXPY(BedrocknorthEnum,BedNorthGRD,1); 522 }*/ 523 486 524 /*cumulate barystatic contributions and save to results: */ 487 525 barycontrib->Cumulate(femmodel->parameters); 488 526 barycontrib->Save(femmodel->results,femmodel->parameters,oceanarea); 527 489 528 490 529 }
Note:
See TracChangeset
for help on using the changeset viewer.