Changeset 17030
- Timestamp:
- 12/19/13 08:25:02 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
r17024 r17030 58 58 iomodel->FetchDataToInput(elements,EplHeadEnum); 59 59 iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum); 60 61 // iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum); 60 62 61 63 elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum); … … 98 100 99 101 /*Finite Element Analysis*/ 100 void 102 void HydrologyDCEfficientAnalysis::Core(FemModel* femmodel){/*{{{*/ 101 103 _error_("not implemented"); 102 104 }/*}}}*/ 105 103 106 ElementVector* HydrologyDCEfficientAnalysis::CreateDVector(Element* element){/*{{{*/ 104 107 /*Default, return NULL*/ 105 108 return NULL; 106 109 }/*}}}*/ 110 107 111 ElementMatrix* HydrologyDCEfficientAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/ 108 112 _error_("Not implemented"); 109 113 }/*}}}*/ 114 110 115 ElementMatrix* HydrologyDCEfficientAnalysis::CreateKMatrix(Element* element){/*{{{*/ 111 116 112 117 /*Intermediaries*/ 113 118 int meshtype; 119 bool active_element; 114 120 Element* basalelement; 121 Input* active_element_input=NULL; 115 122 116 123 /*Get basal element*/ … … 127 134 } 128 135 136 /* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */ 137 /* active_element_input->GetInputValue(&active_element); */ 138 129 139 /*Check that all nodes are active, else return empty matrix*/ 130 140 if(!basalelement->AllActive()) { 131 if(meshtype!=Mesh2DhorizontalEnum){ 141 //if(!active_element){ 142 if(meshtype!=Mesh2DhorizontalEnum){ 132 143 basalelement->DeleteMaterials(); 133 144 delete basalelement; … … 199 210 /*Intermediaries*/ 200 211 int meshtype; 212 bool active_element; 201 213 Element* basalelement; 214 Input* active_element_input=NULL; 215 202 216 203 217 /*Get basal element*/ … … 213 227 default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet"); 214 228 } 229 /* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */ 230 /* active_element_input->GetInputValue(&active_element); */ 215 231 216 232 /*Check that all nodes are active, else return empty matrix*/ 217 if(!basalelement->AllActive()){ 218 if(meshtype!=Mesh2DhorizontalEnum){ 233 if(!basalelement->AllActive()) { 234 //if(!active_element){ 235 if(meshtype!=Mesh2DhorizontalEnum){ 219 236 basalelement->DeleteMaterials(); 220 237 delete basalelement; … … 289 306 return pe; 290 307 }/*}}}*/ 308 291 309 void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 292 310 element->GetSolutionFromInputsOneDof(solution,EplHeadEnum); 293 311 }/*}}}*/ 312 294 313 void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 295 314 int meshtype; … … 315 334 return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity)); 316 335 }/*}}}*/ 336 317 337 void HydrologyDCEfficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 318 338 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. -
issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
r17021 r17030 296 296 return pe; 297 297 }/*}}}*/ 298 298 299 void HydrologyDCInefficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 299 300 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. … … 323 324 xDelete<IssmDouble>(dbasis); 324 325 }/*}}}*/ 326 325 327 void HydrologyDCInefficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 326 328 element->GetSolutionFromInputsOneDof(solution,SedimentHeadEnum); 327 329 }/*}}}*/ 330 328 331 void HydrologyDCInefficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 329 332 … … 395 398 return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity)); 396 399 }/*}}}*/ 400 397 401 void HydrologyDCInefficientAnalysis::ElementizeEplMask(FemModel* femmodel){/*{{{*/ 398 402 -
issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
r17005 r17030 73 73 _error_("not implemented"); 74 74 }/*}}}*/ 75 75 76 ElementVector* L2ProjectionEPLAnalysis::CreateDVector(Element* element){/*{{{*/ 76 77 /*Default, return NULL*/ 77 78 return NULL; 78 79 }/*}}}*/ 80 79 81 ElementMatrix* L2ProjectionEPLAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/ 80 82 _error_("Not implemented"); 81 83 }/*}}}*/ 84 82 85 ElementMatrix* L2ProjectionEPLAnalysis::CreateKMatrix(Element* element){/*{{{*/ 83 86 84 87 /*Intermediaries*/ 85 88 int meshtype; 89 bool active_element; 86 90 Element* basalelement; 91 Input* active_element_input=NULL; 87 92 88 93 /*Get basal element*/ … … 101 106 break; 102 107 default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet"); 108 } 109 110 /* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */ 111 /* active_element_input->GetInputValue(&active_element); */ 112 113 /* Check that all nodes are active, else return empty matrix */ 114 if(!basalelement->AllActive()) { 115 // if(!active_element){ 116 if(meshtype!=Mesh2DhorizontalEnum){ 117 basalelement->DeleteMaterials(); 118 delete basalelement; 119 } 120 return NULL; 103 121 } 104 122 … … 143 161 /*Intermediaries*/ 144 162 int meshtype; 163 bool active_element; 145 164 Element* basalelement; 165 Input* active_element_input=NULL; 146 166 147 167 /*Get basal element*/ … … 158 178 } 159 179 180 /* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */ 181 /* active_element_input->GetInputValue(&active_element); */ 182 183 /*Check that all nodes are active, else return empty matrix*/ 184 if(!basalelement->AllActive()) { 185 /* if(!active_element){ */ 186 if(meshtype!=Mesh2DhorizontalEnum){ 187 basalelement->DeleteMaterials(); 188 delete basalelement; 189 } 190 return NULL; 191 } 192 160 193 /*Intermediaries */ 161 194 int input_enum,index; … … 199 232 return pe; 200 233 }/*}}}*/ 234 201 235 void L2ProjectionEPLAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 202 236 _error_("not implemented yet"); 203 237 }/*}}}*/ 238 204 239 void L2ProjectionEPLAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 205 240 int inputenum,meshtype; -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r17021 r17030 4729 4729 4730 4730 /*Introduce relaxation*/ 4731 wh_trans=old_transfer[i]+0.66*(wh_trans-old_transfer[i]); 4731 // wh_trans=old_transfer[i]+0.66*(wh_trans-old_transfer[i]); 4732 4733 if(this->Id()==27){ 4734 printf("old %e, transfer is %e ,eplhead %e, sedhead %e, factor %e \n",old_transfer[i],wh_trans,epl_head[i],sed_head[i],epl_specificstoring[i]*epl_thickness[i]*sed_trans[i]); 4735 } 4732 4736 4733 4737 /*Assign output pointer*/ … … 4782 4786 IssmDouble residual[numdof]; 4783 4787 4788 bool active_element; 4789 Input* active_element_input=NULL; 4790 4791 active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); 4792 active_element_input->GetInputValue(&active_element); 4793 4784 4794 GetInputListOnVertices(&old_active[0],HydrologydcMaskEplactiveNodeEnum); 4785 4795 GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum); … … 4808 4818 /*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/ 4809 4819 this->GetHydrologyDCInefficientHmax(&h_max,i); 4810 if(eplhead[i]>=h_max && this->AnyActive()){ 4820 //if(eplhead[i]>=h_max && this->AnyActive()){ 4821 if(eplhead[i]>=h_max && active_element){ 4811 4822 for(j=0;j<numdof;j++){ 4812 4823 if(old_active[j]>0.){ … … 4838 4849 IssmDouble ice_thickness[numdof],bed[numdof]; 4839 4850 4851 bool active_element; 4852 Input* active_element_input=NULL; 4840 4853 4841 4854 /*Get the flag to know if the efficient layer is present*/ … … 4854 4867 A = material->GetAbar(); 4855 4868 4856 GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum); 4869 // GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum); 4870 4871 active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); 4872 active_element_input->GetInputValue(&active_element); 4873 4857 4874 GetInputListOnVertices(&eplhead[0],EplHeadEnum); 4858 4875 GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum); … … 4862 4879 GetInputListOnVertices(&bed[0],BedEnum); 4863 4880 4864 if(!this->AnyActive()){ 4881 //if(!this->AnyActive()){ 4882 if(!active_element){ 4865 4883 /*Keeping thickness to initial value if EPL is not active*/ 4866 4884 for(int i=0;i<numdof;i++){ … … 4878 4896 /*And proceed to the real thing*/ 4879 4897 thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n))); 4898 // thickness[i] = old_thickness[i]+0.66*(thickness[i]-old_thickness[i]); 4899 if(this->Id()==27){ 4900 printf("old %e, thickness is %e ,eplhead %e, slopeX %e, slopeY %e\n",old_thickness[i],thickness[i],eplhead[i],epl_slopeX[i],epl_slopeY[i]); 4901 } 4880 4902 } 4881 4903 } -
issm/trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
r17024 r17030 169 169 femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum); 170 170 171 eplconverged = false; 172 171 eplconverged=false; 173 172 for(;;){ 174 173 ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter); 175 174 ug_epl->Copy(ug_epl_sub_iter); 176 175 176 /*Loop on the epl layer to deal with the penalization, have been removed TO CHECK*/ 177 178 SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel); 179 CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum); 180 Reduceloadx(pf,Kfs,ys); delete Kfs; 181 delete uf_epl; 182 Solverx(&uf_epl,Kff,pf,uf_epl_sub_iter,df,femmodel->parameters); 183 delete Kff; delete pf; delete df; 184 delete uf_epl_sub_iter; 185 uf_epl_sub_iter=uf_epl->Duplicate(); 186 uf_epl->Copy(uf_epl_sub_iter); 187 delete ug_epl; 188 Mergesolutionfromftogx(&ug_epl,uf_epl,ys,femmodel->nodes,femmodel->parameters); delete ys; 189 InputUpdateFromSolutionx(femmodel,ug_epl); 190 ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel); 191 177 192 /* {{{ *//*Start by retrieving the EPL head slopes and compute EPL Thickness*/ 178 193 if(VerboseSolution()) _printf0_("computing EPL Head slope...\n"); … … 183 198 femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum); 184 199 solutionsequence_linear(femmodel); 200 femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum); 185 201 femmodel->HydrologyEPLThicknessx(); 202 186 203 //updating mask after the computation of the epl thickness (Allow to close too thin EPL) 187 204 femmodel->HydrologyEPLupdateDomainx(); 188 205 /* }}} */ 189 femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum); 190 191 /* {{{ *//*Loop on the epl layer to deal with the penalization*/ 192 for(;;){ 193 SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel); 194 CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum); 195 Reduceloadx(pf,Kfs,ys); delete Kfs; 196 delete uf_epl; 197 Solverx(&uf_epl,Kff,pf,uf_epl_sub_iter,df,femmodel->parameters); 198 delete Kff; delete pf; delete df; 199 delete uf_epl_sub_iter; 200 uf_epl_sub_iter=uf_epl->Duplicate(); 201 uf_epl->Copy(uf_epl_sub_iter); 202 delete ug_epl; 203 Mergesolutionfromftogx(&ug_epl,uf_epl,ys,femmodel->nodes,femmodel->parameters); delete ys; 204 InputUpdateFromSolutionx(femmodel,ug_epl); 205 ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel); 206 207 if (!eplconverged){ 208 if(VerboseConvergence()) _printf0_(" # EPL unstable constraints = " << num_unstable_constraints << "\n"); 209 if(num_unstable_constraints==0) eplconverged = true; 210 if (eplcount>=hydro_maxiter){ 211 _error_(" maximum number of EPL iterations (" << hydro_maxiter << ") exceeded"); 212 } 213 } 214 /*Add an iteration and get out of the loop if the penalisation is converged*/ 215 eplcount++; 216 if(eplconverged) break; 217 } 218 /* }}} */ /*End of the EPL penalization loop*/ 219 220 eplconverged=false; 206 221 207 /*Update Elemental Mask and compute transfer*/ 222 208 HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis(); … … 224 210 delete analysis; 225 211 femmodel->HydrologyTransferx(); 226 212 227 213 dug=ug_epl_sub_iter->Duplicate();_assert_(dug); 228 214 ug_epl_sub_iter->Copy(dug); … … 235 221 if(VerboseConvergence()) _printf0_(setw(50) << left << " Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n"); 236 222 if((ndu_epl/nu_epl)<eps_hyd) eplconverged=true; 237 223 if (eplcount>=hydro_maxiter){ 224 _error_(" maximum number of EPL iterations (" << hydro_maxiter << ") exceeded"); 225 } 226 eplcount++; 227 238 228 delete ug_epl_sub_iter; 239 229 if(eplconverged){
Note:
See TracChangeset
for help on using the changeset viewer.