Changeset 17516 for issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp
- Timestamp:
- 03/21/14 21:07:11 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp
r17444 r17516 242 242 case HydrologyDCInefficientAnalysisEnum: 243 243 Ke=PenaltyCreateKMatrixHydrologyDCInefficient(kmax); 244 break;245 case DamageEvolutionAnalysisEnum:246 Ke=PenaltyCreateKMatrixDamageEvolution(kmax);247 244 break; 248 245 default: … … 276 273 case HydrologyDCInefficientAnalysisEnum: 277 274 pe=PenaltyCreatePVectorHydrologyDCInefficient(kmax); 278 break;279 case DamageEvolutionAnalysisEnum:280 pe=PenaltyCreatePVectorDamageEvolution(kmax);281 275 break; 282 276 default: … … 417 411 return; 418 412 } 419 else if (analysis_type==DamageEvolutionAnalysisEnum){420 ConstraintActivateDamageEvolution(punstable);421 return;422 }423 424 413 else{ 425 414 _error_("analysis: " << EnumToStringx(analysis_type) << " not supported yet"); … … 710 699 } 711 700 /*}}}*/ 712 /*FUNCTION Pengrid::ConstraintActivateDamageEvolution {{{*/713 void Pengrid::ConstraintActivateDamageEvolution(int* punstable){714 715 // The penalty is stable if it doesn't change during to successive iterations.716 IssmDouble max_damage;717 IssmDouble damage;718 int new_active;719 int unstable=0;720 int penalty_lock;721 722 /*check that pengrid is not a clone (penalty to be added only once)*/723 if (node->IsClone()){724 unstable=0;725 *punstable=unstable;726 return;727 }728 729 //First recover damage using the element: */730 element->GetInputValue(&damage,node,DamageDEnum);731 732 //Recover our data:733 parameters->FindParam(&penalty_lock,DamagePenaltyLockEnum);734 parameters->FindParam(&max_damage,DamageMaxDamageEnum);735 736 //Figure out if damage>max_damage, in which case, this penalty needs to be activated.737 //Would need to do the same for damage<0 if penalties are used. For now, ConstraintStatex738 //is not called in solutionsequence_damage_nonlinear, so no penalties are applied.739 740 if (damage>max_damage){741 new_active=1;742 }743 else{744 new_active=0;745 }746 747 //Figure out stability of this penalty748 if (active==new_active){749 unstable=0;750 }751 else{752 unstable=1;753 if(penalty_lock)zigzag_counter++;754 }755 756 /*If penalty keeps zigzagging more than penalty_lock times: */757 if(penalty_lock){758 if(zigzag_counter>penalty_lock){759 unstable=0;760 active=1;761 }762 }763 764 //Set penalty flag765 active=new_active;766 767 //*Assign output pointers:*/768 *punstable=unstable;769 }770 /*}}}*/771 /*FUNCTION Pengrid::PenaltyCreateKMatrixDamageEvolution {{{*/772 ElementMatrix* Pengrid::PenaltyCreateKMatrixDamageEvolution(IssmDouble kmax){773 774 IssmDouble penalty_factor;775 776 /*Initialize Element matrix and return if necessary*/777 if(!this->active) return NULL;778 ElementMatrix* Ke=new ElementMatrix(&node,NUMVERTICES,this->parameters);779 780 /*recover parameters: */781 parameters->FindParam(&penalty_factor,DamagePenaltyFactorEnum);782 783 Ke->values[0]=kmax*pow(10.,penalty_factor);784 785 /*Clean up and return*/786 return Ke;787 }788 /*}}}*/789 /*FUNCTION Pengrid::PenaltyCreatePVectorDamageEvolution {{{*/790 ElementVector* Pengrid::PenaltyCreatePVectorDamageEvolution(IssmDouble kmax){791 792 IssmDouble penalty_factor;793 IssmDouble max_damage;794 795 /*Initialize Element matrix and return if necessary*/796 if(!this->active) return NULL;797 ElementVector* pe=new ElementVector(&node,1,this->parameters);798 799 //Recover our data:800 parameters->FindParam(&penalty_factor,DamagePenaltyFactorEnum);801 parameters->FindParam(&max_damage,DamageMaxDamageEnum);802 803 //right hand side penalizes to max_damage804 pe->values[0]=kmax*pow(10.,penalty_factor)*max_damage;805 806 /*Clean up and return*/807 return pe;808 }809 /*}}}*/810 701 /*FUNCTION Pengrid::CreatePVectorHydrologyDCInefficient {{{*/ 811 702 ElementVector* Pengrid::CreatePVectorHydrologyDCInefficient(void){
Note:
See TracChangeset
for help on using the changeset viewer.