[8404] | 1 | /*!\file ConstraintsStatex
|
---|
| 2 | * \brief: set up penalty constraints on loads
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | #include "./ConstraintsStatex.h"
|
---|
| 6 | #include "./ConstraintsStateLocal.h"
|
---|
| 7 | #include "../../shared/shared.h"
|
---|
| 8 | #include "../../toolkits/toolkits.h"
|
---|
| 9 |
|
---|
[16137] | 10 | void ConstraintsStatex(int* pconverged, int* pnum_unstable_constraints,FemModel* femmodel){
|
---|
[8404] | 11 |
|
---|
| 12 | /*output: */
|
---|
[16560] | 13 | int converged = 1;
|
---|
| 14 | int num_unstable_constraints = 0;
|
---|
| 15 | int min_mechanical_constraints = 0;
|
---|
| 16 | int unstable = 0;
|
---|
| 17 | int sum_num_unstable_constraints = 0;
|
---|
[8404] | 18 | int analysis_type;
|
---|
| 19 |
|
---|
| 20 | /*Display message*/
|
---|
[15396] | 21 | if(VerboseModule()) _printf0_(" Constraining penalties\n");
|
---|
[8404] | 22 |
|
---|
| 23 | /*recover parameters: */
|
---|
[16137] | 24 | femmodel->parameters->FindParam(&min_mechanical_constraints,StressbalanceRiftPenaltyThresholdEnum);
|
---|
| 25 | femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
|
---|
[8404] | 26 |
|
---|
[16560] | 27 | /*Rift penalties first*/
|
---|
[15396] | 28 | #ifdef _HAVE_RIFTS_
|
---|
[16137] | 29 | if(RiftIsPresent(femmodel->loads,analysis_type)){
|
---|
| 30 | RiftConstraintsState(&converged,&num_unstable_constraints,femmodel->loads,min_mechanical_constraints,analysis_type);
|
---|
[8404] | 31 | }
|
---|
[15396] | 32 | #endif
|
---|
[16560] | 33 |
|
---|
| 34 | /*Deal with pengrid*/
|
---|
| 35 | for(int i=0;i<femmodel->loads->Size();i++){
|
---|
| 36 | Load* load=(Load*)femmodel->loads->GetObjectByOffset(i);
|
---|
| 37 | if(load->InAnalysis(analysis_type)){
|
---|
| 38 | if(load->ObjectEnum()==PengridEnum){
|
---|
| 39 | Pengrid* pengrid=(Pengrid*)load;
|
---|
| 40 | pengrid->ConstraintActivate(&unstable);
|
---|
| 41 | num_unstable_constraints += unstable;
|
---|
| 42 | }
|
---|
| 43 | }
|
---|
[8404] | 44 | }
|
---|
[16560] | 45 | ISSM_MPI_Reduce(&num_unstable_constraints,&sum_num_unstable_constraints,1,ISSM_MPI_INT,ISSM_MPI_SUM,0,IssmComm::GetComm() );
|
---|
| 46 | ISSM_MPI_Bcast(&sum_num_unstable_constraints,1,ISSM_MPI_INT,0,IssmComm::GetComm());
|
---|
| 47 | num_unstable_constraints=sum_num_unstable_constraints;
|
---|
[13975] | 48 |
|
---|
[16560] | 49 | /*Have we converged? : */
|
---|
| 50 | if(num_unstable_constraints) converged=0;
|
---|
| 51 |
|
---|
[8404] | 52 | /*Assign output pointers: */
|
---|
[16560] | 53 | *pconverged = converged;
|
---|
| 54 | *pnum_unstable_constraints = num_unstable_constraints;
|
---|
[8404] | 55 | }
|
---|