Ice Sheet System Model  4.18
Code documentation
Functions
ConstraintsStateLocal.h File Reference

local header files More...

#include "../../classes/classes.h"

Go to the source code of this file.

Functions

void RiftConstraintsState (int *pconverged, int *pnum_unstable_constraints, Loads *loads, int min_mechanical_constraints, int analysis_type)
 
void RiftConstrain (int *pnum_unstable_constraints, Loads *loads, int analysis_type)
 
int RiftIsFrozen (Loads *loads, int analysis_type)
 
void RiftFreezeConstraints (Loads *loads, int analysis_type)
 

Detailed Description

local header files

Definition in file ConstraintsStateLocal.h.

Function Documentation

◆ RiftConstraintsState()

void RiftConstraintsState ( int *  pconverged,
int *  pnum_unstable_constraints,
Loads loads,
int  min_mechanical_constraints,
int  analysis_type 
)

Definition at line 9 of file RiftConstraintsState.cpp.

9  {
10 
11  int num_unstable_constraints=0;
12  int converged=0;
13 
14  RiftConstrain(&num_unstable_constraints,loads,configuration_type);
15  if(num_unstable_constraints==0)converged=1;
16 
17  if(RiftIsFrozen(loads,configuration_type)){
18  converged=1;
19  num_unstable_constraints=0;
20  }
21  else if(num_unstable_constraints<=min_mechanical_constraints){
22  if(VerboseModule()) _printf0_(" freezing constraints\n");
23  RiftFreezeConstraints(loads,configuration_type);
24  }
25 
26  /*Assign output pointers: */
27  *pconverged=converged;
28  *pnum_unstable_constraints=num_unstable_constraints;
29 }

◆ RiftConstrain()

void RiftConstrain ( int *  pnum_unstable_constraints,
Loads loads,
int  analysis_type 
)

Definition at line 32 of file RiftConstraintsState.cpp.

32  {
33 
34  int i;
35 
36  /* generic object pointer: */
37  Riftfront* riftfront=NULL;
38  Load* load=NULL;
39 
40  int unstable;
41  int sum_num_unstable_constraints;
42  int num_unstable_constraints=0;
43 
44  /*Enforce constraints: */
45  for (i=0;i<loads->Size();i++){
46 
47  if (RiftfrontEnum==loads->GetEnum(i)){
48 
49  load=(Load*)loads->GetObjectByOffset(i);
50  riftfront=(Riftfront*)load;
51  riftfront->Constrain(&unstable);
52  num_unstable_constraints+=unstable;
53  }
54  }
55 
56  ISSM_MPI_Reduce (&num_unstable_constraints,&sum_num_unstable_constraints,1,ISSM_MPI_INT,ISSM_MPI_SUM,0,IssmComm::GetComm() );
57  ISSM_MPI_Bcast(&sum_num_unstable_constraints,1,ISSM_MPI_INT,0,IssmComm::GetComm());
58  num_unstable_constraints=sum_num_unstable_constraints;
59 
60  /*Assign output pointers: */
61  *pnum_unstable_constraints=num_unstable_constraints;
62 
63 }

◆ RiftIsFrozen()

int RiftIsFrozen ( Loads loads,
int  analysis_type 
)

Definition at line 66 of file RiftConstraintsState.cpp.

66  {
67 
68  int i;
69 
70  /* generic object pointer: */
71  Load* load=NULL;
72  Riftfront* riftfront=NULL;
73  int found=0;
74  int mpi_found=0;
75 
76  /*Enforce constraints: */
77  for (i=0;i<loads->Size();i++){
78 
79  if (RiftfrontEnum==loads->GetEnum(i)){
80 
81  load=(Load*)loads->GetObjectByOffset(i);
82  riftfront=(Riftfront*)load;
83  if (riftfront->IsFrozen()){
84  found=1;
85  break;
86  }
87  }
88  }
89 
90  /*Is there just one found? that would mean we have frozen! : */
93  found=mpi_found;
94 
95  return found;
96 }

◆ RiftFreezeConstraints()

void RiftFreezeConstraints ( Loads loads,
int  analysis_type 
)

Definition at line 99 of file RiftConstraintsState.cpp.

99  {
100 
101  int i;
102 
103  /* generic object pointer: */
104  Load* load=NULL;
105  Riftfront* riftfront=NULL;
106 
107  /*Enforce constraints: */
108  for (i=0;i<loads->Size();i++){
109 
110  if (RiftfrontEnum==loads->GetEnum(i)){
111  load=(Load*)loads->GetObjectByOffset(i);
112  riftfront=(Riftfront*)load;
113  riftfront->FreezeConstraints();
114  }
115  }
116 
117 }
DataSet::Size
int Size()
Definition: DataSet.cpp:399
_printf0_
#define _printf0_(StreamArgs)
Definition: Print.h:29
ISSM_MPI_SUM
#define ISSM_MPI_SUM
Definition: issmmpi.h:134
IssmComm::GetComm
static ISSM_MPI_Comm GetComm(void)
Definition: IssmComm.cpp:30
ISSM_MPI_MAX
#define ISSM_MPI_MAX
Definition: issmmpi.h:131
Load
Definition: Load.h:22
VerboseModule
bool VerboseModule(void)
Definition: Verbosity.cpp:23
ISSM_MPI_INT
#define ISSM_MPI_INT
Definition: issmmpi.h:127
DataSet::GetEnum
int GetEnum()
Definition: DataSet.cpp:324
Riftfront::FreezeConstraints
void FreezeConstraints(void)
Definition: Riftfront.cpp:675
RiftfrontEnum
@ RiftfrontEnum
Definition: EnumDefinitions.h:1240
ISSM_MPI_Bcast
int ISSM_MPI_Bcast(void *buffer, int count, ISSM_MPI_Datatype datatype, int root, ISSM_MPI_Comm comm)
Definition: issmmpi.cpp:162
Riftfront::Constrain
int Constrain(int *punstable)
Definition: Riftfront.cpp:594
RiftConstrain
void RiftConstrain(int *pnum_unstable_constraints, Loads *loads, int configuration_type)
Definition: RiftConstraintsState.cpp:32
Riftfront::IsFrozen
bool IsFrozen(void)
Definition: Riftfront.cpp:682
DataSet::GetObjectByOffset
Object * GetObjectByOffset(int offset)
Definition: DataSet.cpp:334
RiftFreezeConstraints
void RiftFreezeConstraints(Loads *loads, int configuration_type)
Definition: RiftConstraintsState.cpp:99
ISSM_MPI_Reduce
int ISSM_MPI_Reduce(void *sendbuf, void *recvbuf, int count, ISSM_MPI_Datatype datatype, ISSM_MPI_Op op, int root, ISSM_MPI_Comm comm)
Definition: issmmpi.cpp:373
RiftIsFrozen
int RiftIsFrozen(Loads *loads, int configuration_type)
Definition: RiftConstraintsState.cpp:66
Riftfront
Definition: Riftfront.h:16