source: issm/oecreview/Archive/22819-23185/ISSM-23172-23173.diff

Last change on this file was 23186, checked in by Mathieu Morlighem, 7 years ago

CHG: added Archive/22819-23185

File size: 5.5 KB
RevLine 
[23186]1Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
2===================================================================
3--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp (revision 23172)
4+++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp (revision 23173)
5@@ -55,8 +55,9 @@
6 xDelete<IssmDouble>(mask);
7 }
8 }/*}}}*/
9-void GetMaskOfIceVerticesLSMx(FemModel* femmodel){/*{{{*/
10
11+void GetMaskOfIceVerticesLSMx0(FemModel* femmodel){/*{{{*/
12+
13 /*Initialize vector with number of vertices*/
14 int numvertices=femmodel->vertices->NumberOfVertices();
15 if(numvertices==0) return;
16@@ -82,3 +83,42 @@
17 delete vec_mask_ice;
18 xDelete<IssmDouble>(mask_ice);
19 }/*}}}*/
20+void GetMaskOfIceVerticesLSMx(FemModel* femmodel){/*{{{*/
21+
22+ femmodel->SetCurrentConfiguration(LevelsetAnalysisEnum);
23+
24+ /*Create vector on gset*/
25+ int configuration_type;
26+ femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
27+ int gsize=femmodel->nodes->NumberOfDofs(configuration_type,GsetEnum);
28+ if(gsize==0) return;
29+ Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(gsize);
30+
31+ /*Fill vector with values: */
32+ for(int i=0;i<femmodel->elements->Size();i++){
33+ Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
34+
35+ if(element->IsIceInElement()){
36+ int numnodes = element->GetNumberOfNodes();
37+ int gsize_local=GetNumberOfDofs(element->nodes,numnodes,GsetEnum,NoneEnum);
38+ int* glist_local=GetGlobalDofList(element->nodes,numnodes,GsetEnum,NoneEnum);
39+ IssmDouble* ones = xNew<IssmDouble>(gsize_local);
40+ for(int n=0;n<gsize_local;n++) ones[n] = 1.;
41+ vec_mask_ice->SetValues(gsize_local,glist_local,ones,INS_VAL);
42+ xDelete<IssmDouble>(ones);
43+ xDelete<int>(glist_local);
44+ }
45+ }
46+
47+ /*Assemble vector and serialize */
48+ vec_mask_ice->Assemble();
49+ IssmDouble* mask_ice=vec_mask_ice->ToMPISerial();
50+ delete vec_mask_ice;
51+ for(int i=0;i<femmodel->elements->Size();i++){
52+ Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
53+ element->InputUpdateFromSolutionOneDof(mask_ice,IceMaskNodeActivationEnum);
54+ }
55+
56+ /*Clean up and return*/
57+ xDelete<IssmDouble>(mask_ice);
58+}/*}}}*/
59Index: ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h
60===================================================================
61--- ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h (revision 23172)
62+++ ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h (revision 23173)
63@@ -8,5 +8,6 @@
64 #include "../../classes/classes.h"
65
66 void SetActiveNodesLSMx(FemModel* femmodel);
67+void GetMaskOfIceVerticesLSMx0(FemModel* femmodel);
68 void GetMaskOfIceVerticesLSMx(FemModel* femmodel);
69-#endif /* _UPDATESPCSX_H */
70+#endif /* _SETACTIVENODESLSMX_H*/
71Index: ../trunk-jpl/src/c/classes/FemModel.cpp
72===================================================================
73--- ../trunk-jpl/src/c/classes/FemModel.cpp (revision 23172)
74+++ ../trunk-jpl/src/c/classes/FemModel.cpp (revision 23173)
75@@ -404,7 +404,7 @@
76 VerticesDofx(vertices,parameters);
77
78 if(VerboseMProcessor()) _printf0_(" detecting active vertices\n");
79- GetMaskOfIceVerticesLSMx(this);
80+ GetMaskOfIceVerticesLSMx0(this);
81 }
82
83 if(VerboseMProcessor()) _printf0_(" resolving node constraints\n");
84@@ -2632,7 +2632,7 @@
85 delete this->constraints; this->constraints = new_constraints;
86 delete this->materials; this->materials = new_materials;
87
88- GetMaskOfIceVerticesLSMx(this);
89+ GetMaskOfIceVerticesLSMx0(this);
90
91 /*Insert MISMIP+ bed topography FIXME it could be stay in another place*/
92 this->parameters->FindParam(&basalforcing_model,BasalforcingsEnum);
93Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
94===================================================================
95--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp (revision 23172)
96+++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp (revision 23173)
97@@ -3958,12 +3958,18 @@
98
99 _assert_(fieldvalue==0.); //field value != 0 not implemented yet
100
101+ /*Get field on vertices (we do not allow for higher order elements!!)*/
102+ IssmDouble lsf[NUMVERTICES];
103+ this->GetInputListOnVertices(&lsf[0],fieldenum);
104+
105 /*1. check that we do cross fieldvalue in this element*/
106- Input* input = inputs->GetInput(fieldenum);
107- if(!input) _error_("Cannot calculate distance to "<<EnumToStringx(fieldenum)<<", input not found");
108- IssmDouble minvalue = input->Min();
109+ IssmDouble minvalue = lsf[0];
110+ IssmDouble maxvalue = lsf[0];
111+ for(int i=1;i<NUMVERTICES;i++){
112+ if(lsf[i]>maxvalue) maxvalue = lsf[i];
113+ if(lsf[i]<minvalue) minvalue = lsf[i];
114+ }
115 if(minvalue>fieldvalue) return;
116- IssmDouble maxvalue = input->Max();
117 if(maxvalue<fieldvalue) return;
118
119 /*2. Find coordinates of where levelset crosses 0*/
120@@ -3987,8 +3993,7 @@
121 }
122 }
123 else if(numiceverts==NUMVERTICES){ //NUMVERTICES ice vertices: calving front lies on element edge
124- IssmDouble lsf[NUMVERTICES];
125- this->GetInputListOnVertices(&lsf[0],fieldenum);
126+
127 for(int i=0;i<NUMVERTICES;i++){
128 if(lsf[indices[i]]==0.){
129 x[counter]=xyz_list[indices[i]][0];
130Index: ../trunk-jpl/src/c/classes/Nodes.cpp
131===================================================================
132--- ../trunk-jpl/src/c/classes/Nodes.cpp (revision 23172)
133+++ ../trunk-jpl/src/c/classes/Nodes.cpp (revision 23173)
134@@ -348,11 +348,7 @@
135 /*Grab max of all cpus: */
136 ISSM_MPI_Allreduce((void*)&flag,(void*)&allflag,1,ISSM_MPI_INT,ISSM_MPI_MAX,IssmComm::GetComm());
137
138- if(allflag){
139- return true;
140- }
141- else{
142- return false;
143- }
144+ if(allflag) return true;
145+ else return false;
146 }
147 /*}}}*/
Note: See TracBrowser for help on using the repository browser.