source:
issm/oecreview/Archive/21337-21723/ISSM-21429-21430.diff@
21726
Last change on this file since 21726 was 21726, checked in by , 8 years ago | |
---|---|
File size: 23.2 KB |
-
../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
18 18 int penalty_lock; 19 19 int hydro_maxiter; 20 20 bool isefficientlayer; 21 IssmDouble sedimentlimit;22 21 IssmDouble penalty_factor; 23 IssmDouble leakagefactor;24 22 IssmDouble rel_tol; 23 IssmDouble leakagefactor; 24 IssmDouble sedimentlimit; 25 25 26 26 /*retrieve some parameters: */ 27 27 iomodel->FindConstant(&hydrology_model,"md.hydrology.model"); … … 29 29 /*Now, do we really want DC?*/ 30 30 if(hydrology_model!=HydrologydcEnum) return; 31 31 32 iomodel->FetchData(&isefficientlayer, "md.hydrology.isefficientlayer");33 32 iomodel->FetchData(&sedimentlimit_flag, "md.hydrology.sedimentlimit_flag" ); 34 33 iomodel->FetchData(&transfer_flag, "md.hydrology.transfer_flag" ); 35 34 iomodel->FetchData(&penalty_factor, "md.hydrology.penalty_factor" ); 36 iomodel->FetchData(&rel_tol, "md.hydrology.rel_tol" ); 37 iomodel->FetchData(&penalty_lock, "md.hydrology.penalty_lock" ); 35 iomodel->FetchData(&isefficientlayer, "md.hydrology.isefficientlayer"); 38 36 iomodel->FetchData(&hydro_maxiter, "md.hydrology.max_iter" ); 37 iomodel->FetchData(&penalty_lock, "md.hydrology.penalty_lock" ); 38 iomodel->FetchData(&rel_tol, "md.hydrology.rel_tol" ); 39 39 40 if(sedimentlimit_flag==1){41 iomodel->FetchData(&sedimentlimit,"md.hydrology.sedimentlimit");42 parameters->AddObject(new DoubleParam(HydrologydcSedimentlimitEnum,sedimentlimit));43 }44 45 if(transfer_flag==1){46 iomodel->FetchData(&leakagefactor,"md.hydrology.leakage_factor");47 parameters->AddObject(new DoubleParam(HydrologydcLeakageFactorEnum,leakagefactor));48 }49 50 parameters->AddObject(new DoubleParam(HydrologydcPenaltyFactorEnum,penalty_factor));51 40 parameters->AddObject(new IntParam(HydrologyModelEnum,hydrology_model)); 52 parameters->AddObject(new BoolParam(HydrologydcIsefficientlayerEnum,isefficientlayer));53 41 parameters->AddObject(new IntParam(HydrologydcSedimentlimitFlagEnum,sedimentlimit_flag)); 54 42 parameters->AddObject(new IntParam(HydrologydcTransferFlagEnum,transfer_flag)); 55 parameters->AddObject(new DoubleParam(HydrologydcRelTolEnum,rel_tol));56 43 parameters->AddObject(new IntParam(HydrologydcPenaltyLockEnum,penalty_lock)); 57 44 parameters->AddObject(new IntParam(HydrologydcMaxIterEnum,hydro_maxiter)); 45 parameters->AddObject(new BoolParam(HydrologydcIsefficientlayerEnum,isefficientlayer)); 46 parameters->AddObject(new DoubleParam(HydrologydcPenaltyFactorEnum,penalty_factor)); 47 parameters->AddObject(new DoubleParam(HydrologydcRelTolEnum,rel_tol)); 48 if(transfer_flag==1){ 49 iomodel->FetchData(&leakagefactor,"md.hydrology.leakage_factor"); 50 parameters->AddObject(new DoubleParam(HydrologydcLeakageFactorEnum,leakagefactor)); 51 } 52 if(sedimentlimit_flag==1){ 53 iomodel->FetchData(&sedimentlimit,"md.hydrology.sedimentlimit"); 54 parameters->AddObject(new DoubleParam(HydrologydcSedimentlimitEnum,sedimentlimit)); 55 } 58 56 }/*}}}*/ 59 57 60 58 void HydrologyDCInefficientAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/ … … 108 106 /*Now, do we really want DC?*/ 109 107 if(hydrology_model!=HydrologydcEnum) return; 110 108 111 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,"md.mesh.vertexonbase","md.mesh.vertexonsurface"); 109 if(iomodel->domaintype!=Domain2DhorizontalEnum){ 110 iomodel->FetchData(2,"md.mesh.vertexonbase","md.mesh.vertexonsurface"); 111 } 112 112 ::CreateNodes(nodes,iomodel,HydrologyDCInefficientAnalysisEnum,P1Enum); 113 113 iomodel->DeleteData(2,"md.mesh.vertexonbase","md.mesh.vertexonsurface"); 114 114 }/*}}}*/ … … 130 130 iomodel->FindConstant(&hydrology_model,"md.hydrology.model"); 131 131 if(hydrology_model!=HydrologydcEnum) return; 132 132 133 if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(1,"md.mesh.vertexonbase"); 134 133 if(iomodel->domaintype==Domain3DEnum){ 134 iomodel->FetchData(1,"md.mesh.vertexonbase"); 135 } 135 136 //create penalties for nodes: no node can have water above the max 136 137 CreateSingleNodeToElementConnectivity(iomodel); 137 138 for(int i=0;i<iomodel->numberofvertices;i++){ … … 189 190 bool active_element,isefficientlayer; 190 191 IssmDouble D_scalar,Jdet,dt; 191 192 IssmDouble sediment_transmitivity; 192 IssmDouble prestep_head,base_elev;193 IssmDouble base_elev; 193 194 IssmDouble transfer,sediment_storing; 194 195 IssmDouble *xyz_list = NULL; 195 196 … … 300 301 IssmDouble Jdet; 301 302 302 303 IssmDouble *xyz_list = NULL; 303 Input* old_wh_input = NULL;304 304 Input* active_element_input = NULL; 305 305 306 306 /*Fetch number of nodes and dof for this finite element*/ … … 320 320 Input* thick_input = basalelement->GetInput(ThicknessEnum); 321 321 Input* base_input = basalelement->GetInput(BaseEnum); 322 322 Input* water_input = basalelement->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(water_input); 323 if(dt!= 0.){old_wh_input = basalelement->GetInput(SedimentHeadOldEnum); _assert_(old_wh_input);}324 323 325 324 /*Transfer related Inputs*/ 326 325 if(isefficientlayer){ 327 326 active_element_input = basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); 328 327 } 329 328 330 331 329 /* Start looping on the number of gaussian points: */ 332 330 Gauss* gauss=basalelement->NewGauss(2); 333 331 for(int ig=gauss->begin();ig<gauss->end();ig++){ 334 332 gauss->GaussPoint(ig); 335 336 333 basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss); 337 334 basalelement->NodalFunctions(basis,gauss); 338 335 … … 358 355 } 359 356 } 360 357 361 362 358 /*Transient and transfer terms*/ 363 359 if(dt!=0.){ 364 old_wh_input ->GetInputValue(&water_head,gauss); 365 sediment_storing = SedimentStoring(basalelement,gauss,sed_head_input,base_input);//sed_head_input 360 sediment_storing = SedimentStoring(basalelement,gauss,sed_head_input,base_input); 366 361 if(isefficientlayer){ 367 362 /*Dealing with the sediment part of the transfer term*/ 368 363 active_element_input->GetInputValue(&active_element); … … 427 422 428 423 void HydrologyDCInefficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 429 424 430 int domaintype; 431 bool converged; 432 int* doflist=NULL; 433 Element* basalelement=NULL; 425 /*Intermediaries*/ 426 int domaintype; 427 Element* basalelement; 428 bool converged; 429 int* doflist = NULL; 434 430 431 /*Get basal element*/ 435 432 element->FindParam(&domaintype,DomainTypeEnum); 436 if(domaintype!=Domain2DhorizontalEnum){ 437 if(!element->IsOnBase()) return; 438 basalelement=element->SpawnBasalElement(); 433 switch(domaintype){ 434 case Domain2DhorizontalEnum: 435 basalelement = element; 436 break; 437 case Domain3DEnum: 438 if(!element->IsOnBase()) return NULL; 439 basalelement = element->SpawnBasalElement(); 440 break; 441 default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet"); 439 442 } 440 else{441 basalelement = element;442 }443 443 444 444 445 /*Fetch number of nodes for this finite element*/ 445 446 int numnodes = basalelement->GetNumberOfNodes(); 446 447 … … 478 479 kappa=kmax*pow(10.,penalty_factor); 479 480 480 481 for(int i=0;i<numnodes;i++){ 481 482 482 GetHydrologyDCInefficientHmax(&h_max,basalelement,basalelement->GetNode(i)); 483 483 if(values[i]>h_max) { 484 484 residual[i] = kappa*(values[i]-h_max); … … 526 526 sed_head_input->GetInputValue(&prestep_head,gauss); 527 527 water_sheet=max(0.0,(prestep_head-(base_elev-sediment_thickness))); 528 528 specific_porosity=sediment_porosity-rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity)); 529 if (water_sheet<=0.9*sediment_thickness){//porosity for unconfined region 529 //porosity for unconfined region 530 if (water_sheet<=0.9*sediment_thickness){ 530 531 sediment_storing=sediment_porosity; 531 532 } 532 else if((water_sheet<sediment_thickness) && (water_sheet>0.9*sediment_thickness)){//continuity ramp 533 //continuity ramp 534 else if((water_sheet<sediment_thickness) && (water_sheet>0.9*sediment_thickness)){ 533 535 sediment_storing=(sediment_thickness-water_sheet)*specific_porosity/(0.1*sediment_thickness)+ 534 536 rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity)); 535 537 } 536 else{//storing coefficient for confined 538 //storing coefficient for confined 539 else{ 537 540 sediment_storing=rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity)); 538 541 } 539 542 return sediment_storing; 540 543 }/*}}}*/ 544 541 545 IssmDouble HydrologyDCInefficientAnalysis::SedimentTransmitivity(Element* element,Gauss* gauss,Input* sed_head_input, Input* base_input,Input* SedTrans_input){/*{{{*/ 542 546 IssmDouble sediment_transmitivity; 543 547 IssmDouble FullLayer_transmitivity; … … 573 577 element->FindParam(&h_max,HydrologydcSedimentlimitEnum); 574 578 break; 575 579 case 2: 576 577 580 rho_water = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum); 578 581 rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum); 579 580 582 _assert_(thick_input); 581 583 _assert_(base_input); 582 583 584 /*Compute max*/ 584 585 thick_input->GetInputValue(&thickness,gauss); 585 586 base_input->GetInputValue(&bed,gauss); … … 633 634 IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* thick_input, Input* base_input){/*{{{*/ 634 635 635 636 int transfermethod; 636 IssmDouble hmax;637 IssmDouble epl_head,sediment_head;638 637 IssmDouble leakage,transfer; 639 IssmDouble continuum, factor;640 641 638 element->FindParam(&transfermethod,HydrologydcTransferFlagEnum); 642 639 643 640 /*Switch between the different transfer methods cases*/ … … 647 644 transfer=0.0; 648 645 break; 649 646 case 1: 650 _assert_(sed_head_input);651 _assert_(epl_head_input);652 653 sed_head_input->GetInputValue(&sediment_head,gauss);654 epl_head_input->GetInputValue(&epl_head,gauss);655 647 element->FindParam(&leakage,HydrologydcLeakageFactorEnum); 656 657 hmax=GetHydrologyDCInefficientHmax(element, gauss, thick_input, base_input);658 659 //Computing continuum function to apply to transfer term, transfer is null only if660 //epl_head>sediment_head AND sediment_head>h_max661 //let's try without that for a while662 /* continuum=((1.0/(1.0+exp(-20.0*(sediment_head-epl_head)))))+(1.0/(1.0+exp(-20.0*(hmax-sediment_head)))); */663 /* factor=min(continuum,1.0); */664 /* transfer=leakage*factor; */665 648 transfer=leakage; 666 667 649 break; 668 650 default: 669 651 _error_("no case higher than 1 for the Transfer method"); … … 674 656 IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* thick_input, Input* base_input){/*{{{*/ 675 657 676 658 int transfermethod; 677 IssmDouble hmax; 678 IssmDouble epl_head,sediment_head; 659 IssmDouble epl_head; 679 660 IssmDouble leakage,transfer; 680 IssmDouble continuum, factor;681 682 661 element->FindParam(&transfermethod,HydrologydcTransferFlagEnum); 683 662 684 663 /*Switch between the different transfer methods cases*/ … … 688 667 transfer=0.0; 689 668 break; 690 669 case 1: 691 _assert_(sed_head_input);692 670 _assert_(epl_head_input); 693 694 sed_head_input->GetInputValue(&sediment_head,gauss);695 671 epl_head_input->GetInputValue(&epl_head,gauss); 696 672 element->FindParam(&leakage,HydrologydcLeakageFactorEnum); 697 698 hmax=GetHydrologyDCInefficientHmax(element, gauss, thick_input, base_input);699 700 //Computing continuum function to apply to transfer term, transfer is null only if701 //epl_head>sediment_head AND sediment_head>h_max702 //let's try without that for a while703 /* continuum=((1.0/(1.0+exp(-20.0*(sediment_head-epl_head)))))+(1.0/(1.0+exp(-20.0*(hmax-sediment_head)))); */704 /* factor=min(continuum,1.0); */705 /* transfer=epl_head*leakage*factor; */706 707 673 transfer=epl_head*leakage; 708 709 674 break; 710 675 default: 711 676 _error_("no case higher than 1 for the Transfer method"); … … 730 695 } 731 696 element->AddInput(new BoolInput(HydrologydcMaskEplactiveEltEnum,element_active)); 732 697 } 698 delete element; 733 699 }/*}}}*/ -
../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
8 8 int HydrologyDCEfficientAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/ 9 9 return 1; 10 10 }/*}}}*/ 11 11 12 void HydrologyDCEfficientAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/ 12 13 13 14 int hydrology_model; … … 32 33 33 34 iomodel->FetchData(&eplthickcomp,"md.hydrology.epl_thick_comp"); 34 35 parameters->AddObject(new IntParam(HydrologydcEplThickCompEnum,eplthickcomp)); 35 36 37 36 }/*}}}*/ 37 38 38 void HydrologyDCEfficientAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/ 39 39 40 40 bool isefficientlayer; … … 82 82 iomodel->FindConstant(&isefficientlayer,"md.hydrology.isefficientlayer"); 83 83 if(!isefficientlayer) return; 84 84 85 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,"md.mesh.vertexonbase","md.mesh.vertexonsurface"); 85 if(iomodel->domaintype!=Domain2DhorizontalEnum){ 86 iomodel->FetchData(2,"md.mesh.vertexonbase","md.mesh.vertexonsurface"); 87 } 86 88 ::CreateNodes(nodes,iomodel,HydrologyDCEfficientAnalysisEnum,P1Enum); 87 89 iomodel->DeleteData(2,"md.mesh.vertexonbase","md.mesh.vertexonsurface"); 88 90 }/*}}}*/ … … 105 107 void HydrologyDCEfficientAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 106 108 /*Nothing for now*/ 107 109 108 /* Fetch parameters:*/110 /*Do we really want DC?*/ 109 111 int hydrology_model; 110 112 iomodel->FindConstant(&hydrology_model,"md.hydrology.model"); 111 113 if(hydrology_model!=HydrologydcEnum) return; 112 114 113 if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(1,"md.mesh.vertexonbase"); 115 /*Do we want an efficient layer*/ 116 bool isefficientlayer; 117 iomodel->FindConstant(&isefficientlayer,"md.hydrology.isefficientlayer"); 118 if(!isefficientlayer) return; 114 119 115 //create penalties for nodes: no node can have water above the max 120 /*Fetch parameters: */ 121 if(iomodel->domaintype==Domain3DEnum){ 122 iomodel->FetchData(1,"md.mesh.vertexonbase"); 123 } 124 125 //Add moulin inputs as loads 116 126 CreateSingleNodeToElementConnectivity(iomodel); 117 127 for(int i=0;i<iomodel->numberofvertices;i++){ 118 128 if (iomodel->domaintype!=Domain3DEnum){ … … 131 141 }/*}}}*/ 132 142 133 143 void HydrologyDCEfficientAnalysis::InitZigZagCounter(FemModel* femmodel){/*{{{*/ 144 134 145 int* eplzigzag_counter =NULL; 135 136 146 eplzigzag_counter=xNewZeroInit<int>(femmodel->nodes->Size()); 137 147 femmodel->parameters->AddObject(new IntVecParam(EplZigZagCounterEnum,eplzigzag_counter,femmodel->nodes->Size())); 138 148 xDelete<int>(eplzigzag_counter); … … 141 151 void HydrologyDCEfficientAnalysis::ResetCounter(FemModel* femmodel){/*{{{*/ 142 152 143 153 int* eplzigzag_counter=NULL; 144 Element* element=NULL;145 146 154 femmodel->parameters->FindParam(&eplzigzag_counter,NULL,EplZigZagCounterEnum); 147 155 for(int i=0;i<femmodel->nodes->Size();i++){ 148 149 156 eplzigzag_counter[i]=0; 150 157 } 151 158 femmodel->parameters->SetParam(eplzigzag_counter,femmodel->nodes->Size(),EplZigZagCounterEnum); … … 298 305 299 306 /*Check that all nodes are active, else return empty matrix*/ 300 307 if(!active_element) { 301 if(domaintype!=Domain2DhorizontalEnum){308 if(domaintype!=Domain2DhorizontalEnum){ 302 309 basalelement->DeleteMaterials(); 303 310 delete basalelement; 304 311 } … … 341 348 Gauss* gauss=basalelement->NewGauss(2); 342 349 for(int ig=gauss->begin();ig<gauss->end();ig++){ 343 350 gauss->GaussPoint(ig); 344 345 351 basalelement ->JacobianDeterminant(&Jdet,xyz_list,gauss); 346 352 basalelement ->NodalFunctions(basis,gauss); 347 353 … … 395 401 396 402 void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 397 403 398 bool active_element; 399 int domaintype,i; 400 Element* basalelement=NULL; 404 /*Intermediaries*/ 405 bool active_element; 406 int domaintype; 407 Element* basalelement; 401 408 409 /*Get basal element*/ 402 410 element->FindParam(&domaintype,DomainTypeEnum); 403 404 if(domaintype!=Domain2DhorizontalEnum){ 405 if(!element->IsOnBase()) return; 406 basalelement=element->SpawnBasalElement(); 411 switch(domaintype){ 412 case Domain2DhorizontalEnum: 413 basalelement = element; 414 break; 415 case Domain3DEnum: 416 if(!element->IsOnBase()) return NULL; 417 basalelement = element->SpawnBasalElement(); 418 break; 419 default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet"); 407 420 } 408 else{ 409 basalelement = element; 410 } 411 421 412 422 /*Intermediary*/ 413 423 int* doflist = NULL; 414 424 … … 469 479 IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* thick_input, Input* base_input){/*{{{*/ 470 480 471 481 int transfermethod; 472 IssmDouble hmax;473 IssmDouble epl_head,sediment_head;474 482 IssmDouble leakage,transfer; 475 IssmDouble continuum, factor;476 HydrologyDCInefficientAnalysis* inefanalysis = NULL;477 483 478 484 element->FindParam(&transfermethod,HydrologydcTransferFlagEnum); 479 485 … … 484 490 transfer=0.0; 485 491 break; 486 492 case 1: 487 _assert_(sed_head_input);488 _assert_(epl_head_input);489 490 inefanalysis = new HydrologyDCInefficientAnalysis();491 hmax = inefanalysis->GetHydrologyDCInefficientHmax(element,gauss,thick_input,base_input);492 delete inefanalysis;493 494 sed_head_input->GetInputValue(&sediment_head,gauss);495 epl_head_input->GetInputValue(&epl_head,gauss);496 493 element->FindParam(&leakage,HydrologydcLeakageFactorEnum); 497 498 //Computing continuum function to apply to transfer term, transfer is null only if499 // epl_head>sediment_head AND sediment_head>h_max500 //let's try without that for a while501 /* continuum=((1.0/(1.0+exp(-20.0*(sediment_head-epl_head)))))+(1.0/(1.0+exp(-20.0*(hmax-sediment_head)))); */502 /* factor=min(continuum,1.0); */503 /* transfer=leakage*factor; */504 494 transfer=leakage; 505 495 break; 506 496 default: … … 512 502 IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* thick_input, Input* base_input){/*{{{*/ 513 503 514 504 int transfermethod; 515 IssmDouble hmax; 516 IssmDouble epl_head,sediment_head; 505 IssmDouble sediment_head; 517 506 IssmDouble leakage,transfer; 518 IssmDouble continuum, factor;519 507 520 HydrologyDCInefficientAnalysis* inefanalysis = NULL;521 522 508 element->FindParam(&transfermethod,HydrologydcTransferFlagEnum); 523 509 524 510 /*Switch between the different transfer methods cases*/ … … 529 515 break; 530 516 case 1: 531 517 _assert_(sed_head_input); 532 _assert_(epl_head_input);533 534 inefanalysis = new HydrologyDCInefficientAnalysis();535 hmax = inefanalysis->GetHydrologyDCInefficientHmax(element,gauss,thick_input,base_input);536 delete inefanalysis;537 538 518 sed_head_input->GetInputValue(&sediment_head,gauss); 539 epl_head_input->GetInputValue(&epl_head,gauss);540 519 element->FindParam(&leakage,HydrologydcLeakageFactorEnum); 541 542 //Computing continuum function to apply to transfer term, transfer is null only if543 // epl_head>sediment_head AND sediment_head>h_max544 //let's try without that for a while545 /* continuum=((1.0/(1.0+exp(-20.0*(sediment_head-epl_head)))))+(1.0/(1.0+exp(-20.0*(hmax-sediment_head)))); */546 /* factor=min(continuum,1.0); */547 /* transfer=sediment_head*leakage*factor; */548 520 transfer=sediment_head*leakage; 549 550 521 break; 551 522 default: 552 523 _error_("no case higher than 1 for the Transfer method"); … … 563 534 IssmDouble dt,A,B; 564 535 IssmDouble EPLgrad2; 565 536 IssmDouble EPL_N; 566 567 537 568 538 femmodel->parameters->FindParam(&domaintype,DomainTypeEnum); 569 539 … … 618 588 element->GetInputListOnVertices(&bed[0],BaseEnum); 619 589 620 590 if(!active_element){ 621 622 591 /*Keeping thickness to initial value if EPL is not active*/ 623 592 for(int i=0;i<numnodes;i++){ 624 593 thickness[i]=init_thick; … … 626 595 } 627 596 else{ 628 597 for(int i=0;i<numnodes;i++){ 629 630 598 /*Compute first the effective pressure in the EPL*/ 631 //EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*max(0.0,(eplhead[i]-bed[i]))));632 //allowing EPLN larger than Pi633 599 EPL_N=gravity*((rho_ice*ice_thickness[i])-(rho_water*(eplhead[i]-bed[i]))); 634 600 if(EPL_N<0.0)EPL_N=0.0; 635 601 /*Get then the square of the gradient of EPL heads*/ 636 602 EPLgrad2 = (epl_slopeX[i]*epl_slopeX[i])+(epl_slopeY[i]*epl_slopeY[i]); 637 638 603 /*And proceed to the real thing*/ 639 /* thickness[i] = old_thickness[i]*(1.0+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2- */640 /* (2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)))); */641 604 thickness[i] = old_thickness[i]* 642 605 (2.0+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-(2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n))))/ 643 606 (2.0-((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2+(2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)))); 644 //thickness[i] = 0.5*(thickness[i]+old_thickness[i]);645 607 /*Take care of otherthikening*/ 646 608 if(thickness[i]>max_thick){ 647 609 thickness[i] = max_thick; … … 694 656 int domaintype; 695 657 IssmDouble h_max; 696 658 IssmDouble sedheadmin; 697 Element* basalelement =NULL;659 Element* basalelement; 698 660 699 661 /*Get basal element*/ 700 662 element->FindParam(&domaintype,DomainTypeEnum); … … 703 665 basalelement = element; 704 666 break; 705 667 case Domain3DEnum: 706 if(!element->IsOnBase()) return ;668 if(!element->IsOnBase()) return NULL; 707 669 basalelement = element->SpawnBasalElement(); 708 670 break; 709 671 default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet"); … … 736 698 if (old_active[i]==0.){ 737 699 epl_thickness[i]=init_thick; 738 700 } 739 740 701 /*Now starting to look at the activations*/ 741 702 if(residual[i]>0.){ 742 703 vec_mask->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL); 743 if(old_active[i]==0.) recurence->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL); 704 if(old_active[i]==0.){ 705 recurence->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL); 706 } 744 707 } 745 708 /*If mask was already one, keep one or colapse*/ 746 709 else if(old_active[i]>0.){ … … 758 721 /*Increase of the domain is on the downstream node in term of sediment head*/ 759 722 if(sedhead[j] == sedheadmin){ 760 723 vec_mask->SetValue(basalelement->nodes[j]->Sid(),1.,INS_VAL); 761 if(old_active[i]==0.) recurence->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL); 724 if(old_active[i]==0.){ 725 recurence->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL); 726 } 762 727 } 763 728 } 764 729 } … … 777 742 void HydrologyDCEfficientAnalysis::HydrologyEPLGetActive(Vector<IssmDouble>* active_vec, Element* element){ 778 743 /*Constants*/ 779 744 int domaintype; 780 Element* basalelement =NULL;745 Element* basalelement; 781 746 782 747 /*Get basal element*/ 783 748 element->FindParam(&domaintype,DomainTypeEnum); … … 786 751 basalelement = element; 787 752 break; 788 753 case Domain3DEnum: 789 if(!element->IsOnBase()) return ;754 if(!element->IsOnBase()) return NULL; 790 755 basalelement = element->SpawnBasalElement(); 791 756 break; 792 757 default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet"); … … 795 760 const int numnodes = basalelement->GetNumberOfNodes(); 796 761 IssmDouble flag = 0.; 797 762 IssmDouble* active = xNew<IssmDouble>(numnodes); 763 bool active_element; 798 764 799 765 /*Pass the activity mask from elements to nodes*/ 800 766 basalelement->GetInputListOnVertices(&active[0],HydrologydcMaskEplactiveNodeEnum); 801 bool active_element;802 767 Input* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); 803 768 active_element_input->GetInputValue(&active_element); 804 769
Note:
See TracBrowser
for help on using the repository browser.