[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 |
|
---|
[24686] | 12 | /*Early return if no rift and no penalties*/
|
---|
| 13 | if(femmodel->loads->numrifts == 0 && femmodel->loads->numpenalties == 0){
|
---|
| 14 | *pconverged = 0;
|
---|
| 15 | *pnum_unstable_constraints = 0;
|
---|
| 16 | return;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
[8404] | 19 | /*output: */
|
---|
[24686] | 20 | int converged = 1;
|
---|
| 21 | int num_unstable_constraints = 0;
|
---|
| 22 | int min_mechanical_constraints = 0;
|
---|
| 23 | int unstable = 0;
|
---|
| 24 | int sum_num_unstable_constraints = 0;
|
---|
[8404] | 25 | int analysis_type;
|
---|
| 26 |
|
---|
| 27 | /*Display message*/
|
---|
[15396] | 28 | if(VerboseModule()) _printf0_(" Constraining penalties\n");
|
---|
[8404] | 29 |
|
---|
| 30 | /*recover parameters: */
|
---|
[16137] | 31 | femmodel->parameters->FindParam(&min_mechanical_constraints,StressbalanceRiftPenaltyThresholdEnum);
|
---|
| 32 | femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
|
---|
[8404] | 33 |
|
---|
[16560] | 34 | /*Rift penalties first*/
|
---|
[24686] | 35 | if(femmodel->loads->numrifts){
|
---|
[16137] | 36 | RiftConstraintsState(&converged,&num_unstable_constraints,femmodel->loads,min_mechanical_constraints,analysis_type);
|
---|
[8404] | 37 | }
|
---|
[16560] | 38 |
|
---|
| 39 | /*Deal with pengrid*/
|
---|
[24686] | 40 | if(femmodel->loads->numpenalties){
|
---|
[25836] | 41 | for(Object* & object : femmodel->loads->objects){
|
---|
| 42 | Load* load=(Load*)object;
|
---|
[24686] | 43 | if(load->ObjectEnum()==PengridEnum){
|
---|
| 44 | Pengrid* pengrid=(Pengrid*)load;
|
---|
| 45 | pengrid->ConstraintActivate(&unstable);
|
---|
| 46 | num_unstable_constraints += unstable;
|
---|
| 47 | }
|
---|
[16560] | 48 | }
|
---|
[8404] | 49 | }
|
---|
[24686] | 50 |
|
---|
[16560] | 51 | ISSM_MPI_Reduce(&num_unstable_constraints,&sum_num_unstable_constraints,1,ISSM_MPI_INT,ISSM_MPI_SUM,0,IssmComm::GetComm() );
|
---|
[25836] | 52 | ISSM_MPI_Bcast(&sum_num_unstable_constraints,1,ISSM_MPI_INT,0,IssmComm::GetComm());
|
---|
[16560] | 53 | num_unstable_constraints=sum_num_unstable_constraints;
|
---|
[13975] | 54 |
|
---|
[16560] | 55 | /*Have we converged? : */
|
---|
| 56 | if(num_unstable_constraints) converged=0;
|
---|
| 57 |
|
---|
[8404] | 58 | /*Assign output pointers: */
|
---|
[16560] | 59 | *pconverged = converged;
|
---|
| 60 | *pnum_unstable_constraints = num_unstable_constraints;
|
---|
[8404] | 61 | }
|
---|