Changeset 17349
- Timestamp:
- 02/25/14 17:45:51 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
r17212 r17349 55 55 iomodel->FetchDataToInput(elements,MeshElementonbedEnum); 56 56 iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum); 57 iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);58 57 iomodel->FetchDataToInput(elements,EplHeadEnum); 58 iomodel->FetchDataToInput(elements,SedimentHeadEnum); 59 59 iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum); 60 iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum); 60 61 61 62 // iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum); … … 140 141 IssmDouble D_scalar,Jdet,dt; 141 142 IssmDouble epl_thickness; 143 IssmDouble transfer; 142 144 IssmDouble *xyz_list = NULL; 143 145 … … 154 156 basalelement->GetVerticesCoordinates(&xyz_list); 155 157 basalelement->FindParam(&dt,TimesteppingTimeStepEnum); 156 Input* thickness_input =basalelement->GetInput(HydrologydcEplThicknessEnum);_assert_(thickness_input);157 IssmDouble epl_specificstoring = EplSpecificStoring(basalelement);158 IssmDouble epl_conductivity = basalelement->GetMaterialParameter(HydrologydcEplConductivityEnum);158 Input* thickness_input = basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input); 159 IssmDouble epl_specificstoring = EplSpecificStoring(basalelement); 160 IssmDouble epl_conductivity = basalelement->GetMaterialParameter(HydrologydcEplConductivityEnum); 159 161 160 162 /* Start looping on the number of gaussian points: */ 161 163 Gauss* gauss=basalelement->NewGauss(2); 162 164 for(int ig=gauss->begin();ig<gauss->end();ig++){ 163 gauss->GaussPoint(ig); 164 165 basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss); 166 thickness_input->GetInputValue(&epl_thickness,gauss); 165 gauss ->GaussPoint(ig); 166 basalelement ->JacobianDeterminant(&Jdet,xyz_list,gauss); 167 thickness_input ->GetInputValue(&epl_thickness,gauss); 167 168 168 169 /*Diffusivity*/ … … 179 180 /*Transient*/ 180 181 if(dt!=0.){ 181 basalelement->NodalFunctions( basis,gauss);182 basalelement->NodalFunctions(&basis[0],gauss); 182 183 D_scalar=epl_specificstoring*epl_thickness*gauss->weight*Jdet; 183 184 TripleMultiply(basis,numnodes,1,0, … … 185 186 basis,1,numnodes,0, 186 187 &Ke->values[0],1); 187 } 188 } 189 188 189 /*Transfer EPL part*/ 190 transfer=GetHydrologyKMatrixTransfer(basalelement,gauss); 191 basalelement->NodalFunctions(&basis[0],gauss); 192 D_scalar=transfer*gauss->weight*Jdet*dt; 193 TripleMultiply(basis,numnodes,1,0, 194 &D_scalar,1,1,0, 195 basis,1,numnodes,0, 196 &Ke->values[0],1); 197 } 198 } 190 199 /*Clean up and return*/ 191 200 xDelete<IssmDouble>(xyz_list); … … 224 233 } 225 234 /*Intermediaries */ 226 IssmDouble dt,scalar,water_head,connectivity; 227 IssmDouble transfer,residual,epl_thickness; 235 IssmDouble dt,scalar,water_head; 236 IssmDouble transfer; 237 IssmDouble epl_thickness; 228 238 IssmDouble Jdet; 239 IssmDouble residual,connectivity; 240 229 241 IssmDouble *xyz_list = NULL; 230 242 Input* old_wh_input = NULL; … … 240 252 /*Retrieve all inputs and parameters*/ 241 253 basalelement->GetVerticesCoordinates(&xyz_list); 254 basalelement->FindParam(&dt,TimesteppingTimeStepEnum); 255 256 Input* residual_input = basalelement->GetInput(SedimentHeadResidualEnum); _assert_(residual_input); 257 Input* thickness_input = basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input); 258 if(dt!= 0.){old_wh_input = basalelement->GetInput(EplHeadOldEnum); _assert_(old_wh_input);} 259 242 260 IssmDouble epl_specificstoring = EplSpecificStoring(basalelement); 243 basalelement->FindParam(&dt,TimesteppingTimeStepEnum);244 Input* residual_input = basalelement->GetInput(SedimentHeadResidualEnum); _assert_(residual_input);245 Input* transfer_input = basalelement->GetInput(WaterTransferEnum); _assert_(transfer_input);246 Input* thickness_input = basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(thickness_input);247 if(dt!= 0.){old_wh_input = basalelement->GetInput(EplHeadOldEnum); _assert_(old_wh_input);}248 261 249 262 /* Start looping on the number of gaussian points: */ … … 252 265 gauss->GaussPoint(ig); 253 266 254 basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss); 255 basalelement->NodalFunctions(basis,gauss); 256 257 /*Loading term*/ 258 transfer_input->GetInputValue(&transfer,gauss); 259 scalar = Jdet*gauss->weight*(-transfer); 260 if(dt!=0.) scalar = scalar*dt; 261 262 for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i]; 263 264 /*Transient term*/ 267 basalelement ->JacobianDeterminant(&Jdet,xyz_list,gauss); 268 basalelement ->NodalFunctions(basis,gauss); 269 270 /*Transient and transfer terms*/ 265 271 if(dt!=0.){ 266 thickness_input->GetInputValue(&epl_thickness,gauss); 267 old_wh_input->GetInputValue(&water_head,gauss); 268 scalar = Jdet*gauss->weight*water_head*epl_specificstoring*epl_thickness; 272 old_wh_input ->GetInputValue(&water_head,gauss); 273 thickness_input ->GetInputValue(&epl_thickness,gauss); 269 274 275 /*Dealing with the sediment part of the transfer term*/ 276 transfer=GetHydrologyPVectorTransfer(basalelement,gauss); 277 scalar = Jdet*gauss->weight*((water_head*epl_specificstoring*epl_thickness)+(transfer*dt)); 270 278 for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i]; 271 279 } … … 281 289 residual_input->GetInputValue(&residual,gauss); 282 290 pe->values[iv]+=residual/connectivity; 291 283 292 } 284 293 … … 318 327 319 328 IssmDouble* eplHeads = xNew<IssmDouble>(numnodes); 320 /* IssmDouble* relaxed = xNew<IssmDouble>(numnodes); */ 321 /* IssmDouble* eplOldHeads = xNew<IssmDouble>(numnodes); */ 322 IssmDouble Stepping; 323 329 IssmDouble* eplOldHeads = xNew<IssmDouble>(numnodes); 324 330 325 331 /*Get previous water head*/ 326 //basalelement->GetInputListOnNodes(&eplOldHeads[0],EplHeadEnum);332 basalelement->GetInputListOnNodes(&eplOldHeads[0],EplHeadEnum); 327 333 328 334 /*Use the dof list to index into the solution vector: */ … … 330 336 eplHeads[i]=solution[doflist[i]]; 331 337 if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector"); 332 } 333 334 /* for(i=0;i<numnodes;i++) { */ 335 /* relaxed[i] = eplOldHeads[i]+0.8*(eplHeads[i]-eplOldHeads[i]); */ 336 /* } */ 338 339 } 337 340 /*Add input to the element: */ 338 341 element->AddBasalInput(EplHeadEnum,eplHeads,P1Enum); … … 358 361 return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity)); 359 362 }/*}}}*/ 363 IssmDouble HydrologyDCEfficientAnalysis::SedimentStoring(Element* element){/*{{{*/ 364 IssmDouble rho_freshwater = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum); 365 IssmDouble g = element->GetMaterialParameter(ConstantsGEnum); 366 IssmDouble sediment_porosity = element->GetMaterialParameter(HydrologydcSedimentPorosityEnum); 367 IssmDouble sediment_thickness = element->GetMaterialParameter(HydrologydcSedimentThicknessEnum); 368 IssmDouble sediment_compressibility = element->GetMaterialParameter(HydrologydcSedimentCompressibilityEnum); 369 IssmDouble water_compressibility = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum); 370 return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity)); 371 }/*}}}*/ 372 IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss){/*{{{*/ 373 int hmax_flag; 374 IssmDouble h_max; 375 IssmDouble rho_ice,rho_water; 376 IssmDouble thickness,bed; 377 /*Get the flag to the limitation method*/ 378 element->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum); 379 380 /*Switch between the different cases*/ 381 switch(hmax_flag){ 382 case 0: 383 h_max=1.0e+10; 384 break; 385 case 1: 386 element->FindParam(&h_max,HydrologydcSedimentlimitEnum); 387 break; 388 case 2: 389 rho_water= element->GetMaterialParameter(MaterialsRhoFreshwaterEnum); 390 rho_ice= element->GetMaterialParameter(MaterialsRhoIceEnum); 391 element->GetInputValue(&thickness,gauss,ThicknessEnum); 392 element->GetInputValue(&bed,gauss,BedEnum); 393 h_max=((rho_ice*thickness)/rho_water)+bed; 394 break; 395 case 3: 396 _error_("Using normal stress not supported yet"); 397 break; 398 default: 399 _error_("no case higher than 3 for SedimentlimitFlag"); 400 } 401 return h_max; 402 }/*}}}*/ 403 IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss){/*{{{*/ 404 405 int transfermethod; 406 IssmDouble epl_thickness; 407 IssmDouble epl_head,sed_head; 408 IssmDouble sediment_transmitivity; 409 IssmDouble leakage,residual,transfer; 410 411 IssmDouble sediment_thickness = element->GetMaterialParameter(HydrologydcSedimentThicknessEnum); 412 IssmDouble sediment_storing = SedimentStoring(element); 413 IssmDouble epl_specificstoring = EplSpecificStoring(element); 414 415 element->FindParam(&transfermethod,HydrologydcTransferFlagEnum); 416 /*Switch between the different transfer methods cases*/ 417 switch(transfermethod){ 418 case 0: 419 /*Just keepping the transfer to zero, should be OK with the initial value of transfer*/ 420 break; 421 case 1: 422 423 element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum); 424 element->GetInputValue(&sed_head,gauss,SedimentHeadEnum); 425 element->GetInputValue(&epl_head,gauss,EplHeadEnum); 426 element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum); 427 element->GetInputValue(&residual,gauss,SedimentHeadResidualEnum); 428 element->FindParam(&leakage,HydrologydcLeakageFactorEnum); 429 430 if(epl_head>sed_head){ 431 if(residual>0.0){ 432 transfer=0.0; 433 } 434 else{ 435 transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage); 436 } 437 } 438 else{ 439 transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage); 440 } 441 break; 442 default: 443 _error_("no case higher than 1 for the Transfer method"); 444 } 445 446 return transfer; 447 }/*}}}*/ 448 449 IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss){/*{{{*/ 450 451 int transfermethod; 452 IssmDouble epl_thickness; 453 IssmDouble epl_head,sediment_head; 454 IssmDouble sediment_transmitivity; 455 IssmDouble leakage,residual,transfer; 456 457 IssmDouble sediment_thickness = element->GetMaterialParameter(HydrologydcSedimentThicknessEnum); 458 IssmDouble sediment_storing = SedimentStoring(element); 459 IssmDouble epl_specificstoring = EplSpecificStoring(element); 460 461 element->FindParam(&transfermethod,HydrologydcTransferFlagEnum); 462 /*Switch between the different transfer methods cases*/ 463 switch(transfermethod){ 464 case 0: 465 /*Just keepping the transfer to zero, should be OK with the initial value of transfer*/ 466 break; 467 case 1: 468 469 element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum); 470 element->GetInputValue(&sediment_head,gauss,SedimentHeadEnum); 471 element->GetInputValue(&epl_head,gauss,EplHeadEnum); 472 element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum); 473 element->GetInputValue(&residual,gauss,SedimentHeadResidualEnum); 474 element->FindParam(&leakage,HydrologydcLeakageFactorEnum); 475 476 if(epl_head>sediment_head){ 477 if(residual>0.0){ 478 transfer=0.0; 479 } 480 else{ 481 transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage); 482 } 483 } 484 else{ 485 transfer=(sediment_storing*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage); 486 } 487 break; 488 default: 489 _error_("no case higher than 1 for the Transfer method"); 490 } 491 return transfer; 492 }/*}}}*/ 493 360 494 void HydrologyDCEfficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 361 495 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. -
issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
r17212 r17349 33 33 void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss); 34 34 IssmDouble EplSpecificStoring(Element* element); 35 IssmDouble SedimentStoring(Element* element); 36 IssmDouble GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss); 37 IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss); 38 IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss); 35 39 }; 36 40 #endif -
issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
r17212 r17349 89 89 iomodel->FetchDataToInput(elements,SedimentHeadEnum); 90 90 iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum); 91 91 92 92 93 if(isefficientlayer)iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum); … … 172 173 173 174 /*Intermediaries */ 175 bool active_element,isefficientlayer; 174 176 IssmDouble D_scalar,Jdet,dt; 175 177 IssmDouble sediment_transmitivity; 178 IssmDouble transfer; 176 179 IssmDouble *xyz_list = NULL; 180 181 /*Define transfer related variables*/ 182 Input* active_element_input =NULL; 177 183 178 184 /*Fetch number of nodes and dof for this finite element*/ … … 186 192 187 193 /*Retrieve all inputs and parameters*/ 188 basalelement ->GetVerticesCoordinates(&xyz_list); 189 IssmDouble sediment_storing = SedimentStoring(basalelement); 190 Input* SedTrans_input=basalelement ->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input); 191 basalelement ->FindParam(&dt,TimesteppingTimeStepEnum); 192 194 basalelement ->GetVerticesCoordinates(&xyz_list); 195 basalelement ->FindParam(&dt,TimesteppingTimeStepEnum); 196 basalelement ->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum); 197 198 Input* SedTrans_input = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input); 199 IssmDouble sediment_storing = SedimentStoring(basalelement); 200 /*Transfer related Inputs*/ 201 if(isefficientlayer){ 202 active_element_input = basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); 203 } 204 193 205 /* Start looping on the number of gaussian points: */ 194 206 Gauss* gauss=basalelement->NewGauss(2); … … 197 209 basalelement -> JacobianDeterminant(&Jdet,xyz_list,gauss); 198 210 SedTrans_input -> GetInputValue(&sediment_transmitivity,gauss); 199 211 200 212 /*Diffusivity*/ 201 213 D_scalar=sediment_transmitivity*gauss->weight*Jdet; … … 205 217 GetB(B,basalelement,xyz_list,gauss); 206 218 TripleMultiply(B,2,numnodes,1, 207 &D[0][0],2,2,0,208 B,2,numnodes,0,209 &Ke->values[0],1);219 &D[0][0],2,2,0, 220 B,2,numnodes,0, 221 &Ke->values[0],1); 210 222 211 223 /*Transient*/ … … 214 226 D_scalar=sediment_storing*gauss->weight*Jdet; 215 227 TripleMultiply(basis,numnodes,1,0, 216 &D_scalar,1,1,0, 217 basis,1,numnodes,0, 218 &Ke->values[0],1); 219 } 220 } 221 228 &D_scalar,1,1,0, 229 basis,1,numnodes,0, 230 &Ke->values[0],1); 231 232 /*Transfer EPL part*/ 233 if(isefficientlayer){ 234 active_element_input->GetInputValue(&active_element); 235 if(active_element){ 236 transfer=GetHydrologyKMatrixTransfer(basalelement,gauss); 237 238 basalelement->NodalFunctions(&basis[0],gauss); 239 D_scalar=transfer*gauss->weight*Jdet*dt; 240 TripleMultiply(basis,numnodes,1,0, 241 &D_scalar,1,1,0, 242 basis,1,numnodes,0, 243 &Ke->values[0],1); 244 } 245 } 246 } 247 } 222 248 /*Clean up and return*/ 223 249 xDelete<IssmDouble>(xyz_list); … … 248 274 249 275 /*Intermediaries */ 276 bool active_element,isefficientlayer; 250 277 IssmDouble dt,scalar,water_head; 251 278 IssmDouble water_load,transfer; 252 279 IssmDouble Jdet; 253 IssmDouble *xyz_list = NULL; 254 Input* old_wh_input = NULL; 280 281 IssmDouble *xyz_list = NULL; 282 Input* old_wh_input = NULL; 283 Input* active_element_input = NULL; 255 284 256 285 /*Fetch number of nodes and dof for this finite element*/ … … 263 292 /*Retrieve all inputs and parameters*/ 264 293 basalelement->GetVerticesCoordinates(&xyz_list); 265 IssmDouble sediment_storing = SedimentStoring(basalelement);266 294 basalelement->FindParam(&dt,TimesteppingTimeStepEnum); 295 basalelement->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum); 296 267 297 Input* water_input = basalelement->GetInput(BasalforcingsMeltingRateEnum); _assert_(water_input); 268 Input* transfer_input = basalelement->GetInput(WaterTransferEnum); _assert_(transfer_input);269 298 if(dt!= 0.){old_wh_input = basalelement->GetInput(SedimentHeadOldEnum); _assert_(old_wh_input);} 299 300 IssmDouble sediment_storing = SedimentStoring(basalelement); 301 302 /*Transfer related Inputs*/ 303 if(isefficientlayer){ 304 active_element_input = basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); 305 } 270 306 271 307 /* Start looping on the number of gaussian points: */ … … 273 309 for(int ig=gauss->begin();ig<gauss->end();ig++){ 274 310 gauss->GaussPoint(ig); 275 311 276 312 basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss); 277 313 basalelement->NodalFunctions(basis,gauss); … … 279 315 /*Loading term*/ 280 316 water_input->GetInputValue(&water_load,gauss); 281 transfer_input->GetInputValue(&transfer,gauss);282 scalar = Jdet*gauss->weight*(water_load +transfer);317 318 scalar = Jdet*gauss->weight*(water_load); 283 319 if(dt!=0.) scalar = scalar*dt; 284 for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i]; 285 286 /*Transient term*/ 320 for(int i=0;i<numnodes;i++){ 321 pe->values[i]+=scalar*basis[i]; 322 } 323 324 /*Transient and transfer terms*/ 287 325 if(dt!=0.){ 288 old_wh_input->GetInputValue(&water_head,gauss); 289 scalar = Jdet*gauss->weight*water_head*sediment_storing; 290 for(int i=0;i<numnodes;i++) pe->values[i]+=scalar*basis[i]; 291 } 292 } 293 326 old_wh_input ->GetInputValue(&water_head,gauss); 327 if(isefficientlayer){ 328 /*Dealing with the sediment part of the transfer term*/ 329 active_element_input->GetInputValue(&active_element); 330 if(active_element){ 331 transfer=GetHydrologyPVectorTransfer(basalelement,gauss); 332 } 333 else{ 334 transfer=0.0; 335 } 336 scalar = Jdet*gauss->weight*((water_head*sediment_storing)+(dt*transfer)); 337 for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i]; 338 } 339 else{ 340 scalar = Jdet*gauss->weight*(water_head*sediment_storing); 341 for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i]; 342 } 343 } 344 } 294 345 /*Clean up and return*/ 295 346 xDelete<IssmDouble>(xyz_list); … … 371 422 372 423 for(int i=0;i<numnodes;i++){ 373 basalelement->GetHydrologyDCInefficientHmax(&h_max, i);424 basalelement->GetHydrologyDCInefficientHmax(&h_max,basalelement->GetNode(i)); 374 425 if(values[i]>h_max) residual[i] = kappa*(values[i]-h_max); 375 426 else residual[i] = 0.; … … 402 453 return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity)); 403 454 }/*}}}*/ 455 456 IssmDouble HydrologyDCInefficientAnalysis::EplSpecificStoring(Element* element){/*{{{*/ 457 IssmDouble rho_freshwater = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum); 458 IssmDouble g = element->GetMaterialParameter(ConstantsGEnum); 459 IssmDouble epl_porosity = element->GetMaterialParameter(HydrologydcEplPorosityEnum); 460 IssmDouble epl_compressibility = element->GetMaterialParameter(HydrologydcEplCompressibilityEnum); 461 IssmDouble water_compressibility = element->GetMaterialParameter(HydrologydcWaterCompressibilityEnum); 462 return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity)); 463 }/*}}}*/ 464 465 IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss){/*{{{*/ 466 int hmax_flag; 467 IssmDouble h_max; 468 IssmDouble rho_ice,rho_water; 469 IssmDouble thickness,bed; 470 /*Get the flag to the limitation method*/ 471 element->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum); 472 473 /*Switch between the different cases*/ 474 switch(hmax_flag){ 475 case 0: 476 h_max=1.0e+10; 477 break; 478 case 1: 479 element->FindParam(&h_max,HydrologydcSedimentlimitEnum); 480 break; 481 case 2: 482 483 rho_water = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum); 484 rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum); 485 486 /*Compute max*/ 487 /* thick_input->GetInputValue(&thickness,gauss); */ 488 /* bed_input->GetInputValue(&bed,gauss); */ 489 element->GetInputValue(&thickness,gauss,ThicknessEnum); 490 element->GetInputValue(&bed,gauss,BedEnum); 491 h_max=((rho_ice*thickness)/rho_water)+bed; 492 break; 493 case 3: 494 _error_("Using normal stress not supported yet"); 495 break; 496 default: 497 _error_("no case higher than 3 for SedimentlimitFlag"); 498 } 499 return h_max; 500 }/*}}}*/ 501 502 IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss){/*{{{*/ 503 504 int transfermethod; 505 IssmDouble epl_thickness; 506 IssmDouble epl_head,sed_head; 507 IssmDouble sediment_transmitivity; 508 IssmDouble leakage,h_max,transfer; 509 510 IssmDouble sediment_thickness = element->GetMaterialParameter(HydrologydcSedimentThicknessEnum); 511 IssmDouble sediment_storing = SedimentStoring(element); 512 IssmDouble epl_specificstoring = EplSpecificStoring(element); 513 514 element->FindParam(&transfermethod,HydrologydcTransferFlagEnum); 515 /*Switch between the different transfer methods cases*/ 516 switch(transfermethod){ 517 case 0: 518 /*Just keepping the transfer to zero, should be OK with the initial value of transfer*/ 519 break; 520 case 1: 521 522 element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum); 523 element->GetInputValue(&sed_head,gauss,SedimentHeadEnum); 524 element->GetInputValue(&epl_head,gauss,EplHeadEnum); 525 element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum); 526 527 element->FindParam(&leakage,HydrologydcLeakageFactorEnum); 528 529 if(epl_head>sed_head){ 530 h_max=GetHydrologyDCInefficientHmax(element,gauss); 531 if(sed_head>=h_max){ 532 transfer=0.0; 533 } 534 else{ 535 transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage); 536 } 537 } 538 else{ 539 transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage); 540 } 541 break; 542 default: 543 _error_("no case higher than 1 for the Transfer method"); 544 } 545 546 return transfer; 547 }/*}}}*/ 548 549 IssmDouble HydrologyDCInefficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss){/*{{{*/ 550 551 int transfermethod; 552 IssmDouble epl_thickness; 553 IssmDouble epl_head,sediment_head; 554 IssmDouble sediment_transmitivity; 555 IssmDouble leakage,h_max,transfer; 556 557 IssmDouble sediment_thickness = element->GetMaterialParameter(HydrologydcSedimentThicknessEnum); 558 IssmDouble sediment_storing = SedimentStoring(element); 559 IssmDouble epl_specificstoring = EplSpecificStoring(element); 560 561 element->FindParam(&transfermethod,HydrologydcTransferFlagEnum); 562 /*Switch between the different transfer methods cases*/ 563 switch(transfermethod){ 564 case 0: 565 /*Just keepping the transfer to zero, should be OK with the initial value of transfer*/ 566 break; 567 case 1: 568 569 element->GetInputValue(&epl_thickness,gauss,HydrologydcEplThicknessEnum); 570 element->GetInputValue(&sediment_head,gauss,SedimentHeadEnum); 571 element->GetInputValue(&epl_head,gauss,EplHeadEnum); 572 element->GetInputValue(&sediment_transmitivity,gauss,HydrologydcSedimentTransmitivityEnum); 573 574 element->FindParam(&leakage,HydrologydcLeakageFactorEnum); 575 if(epl_head>sediment_head){ 576 h_max=GetHydrologyDCInefficientHmax(element,gauss); 577 if(sediment_head>=h_max){ 578 transfer=0.0; 579 } 580 else{ 581 transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*epl_head)/(sediment_thickness*leakage); 582 } 583 } 584 else{ 585 transfer=(sediment_storing*sediment_transmitivity*epl_head)/(sediment_thickness*leakage); 586 } 587 break; 588 default: 589 _error_("no case higher than 1 for the Transfer method"); 590 } 591 return transfer; 592 }/*}}}*/ 593 404 594 void HydrologyDCInefficientAnalysis::ElementizeEplMask(FemModel* femmodel){/*{{{*/ 405 595 -
issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.h
r17212 r17349 33 33 void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss); 34 34 IssmDouble SedimentStoring(Element* element); 35 IssmDouble EplSpecificStoring(Element* element); 36 IssmDouble GetHydrologyDCInefficientHmax(Element* element, Gauss* gauss); 37 IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss); 38 IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss); 35 39 void ElementizeEplMask(FemModel* femmodel); 36 40 }; -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r17338 r17349 283 283 virtual void UpdateConstraintsExtrudeFromTop(void)=0; 284 284 285 virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index)=0;285 // virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index)=0; 286 286 virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode)=0; 287 287 virtual void GetHydrologyTransfer(Vector<IssmDouble>* transfer)=0; -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r17338 r17349 243 243 ElementMatrix* CreateEPLDomainMassMatrix(void); 244 244 void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode); 245 void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};245 // void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");}; 246 246 void GetHydrologyTransfer(Vector<IssmDouble>* transfer); 247 247 void HydrologyEPLGetActive(Vector<IssmDouble>* active_vec); -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r17338 r17349 151 151 152 152 void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");}; 153 void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};153 // void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");}; 154 154 void GetHydrologyTransfer(Vector<IssmDouble>* transfer){_error_("not implemented yet");}; 155 155 void HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r17338 r17349 4465 4465 /*}}}*/ 4466 4466 /*FUNCTION Tria::GetHydrologyDCInefficientHmax{{{*/ 4467 void Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){4468 4469 int hmax_flag;4470 IssmDouble h_max;4471 IssmDouble rho_ice,rho_water;4472 IssmDouble thickness,bed;4473 /*Get the flag to the limitation method*/4474 this->parameters->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);4475 4476 /*Switch between the different cases*/4477 switch(hmax_flag){4478 case 0:4479 h_max=1.0e+10;4480 break;4481 case 1:4482 parameters->FindParam(&h_max,HydrologydcSedimentlimitEnum);4483 break;4484 case 2:4485 rho_ice=matpar->GetRhoIce();4486 rho_water=matpar->GetRhoFreshwater();4487 this->GetInputValue(&thickness,this->nodes[index],ThicknessEnum);4488 this->GetInputValue(&bed,this->nodes[index],BedEnum);4489 h_max=((rho_ice*thickness)/rho_water)+bed;4490 break;4491 case 3:4492 _error_("Using normal stress not supported yet");4493 break;4494 default:4495 _error_("no case higher than 3 for SedimentlimitFlag");4496 }4497 /*Assign output pointer*/4498 *ph_max=h_max;4499 }4500 /*}}}*/4501 /*FUNCTION Tria::GetHydrologyDCInefficientHmax{{{*/4502 4467 void Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){ 4503 4468 … … 4535 4500 /*}}}*/ 4536 4501 /*FUNCTION Tria::GetHydrologyTransfer{{{*/ 4537 void Tria::GetHydrologyTransfer(Vector<IssmDouble>* transfer){ 4538 4539 const int numdof = NDOF1 *NUMVERTICES; 4540 int *doflist = NULL; 4541 int analysis_type; 4542 bool isefficientlayer; 4543 bool active_element; 4544 int transfermethod; 4545 IssmDouble leakage,h_max; 4546 IssmDouble wh_trans,sed_thick; 4547 IssmDouble epl_specificstoring,sedstoring; 4548 IssmDouble activeEpl[numdof],epl_thickness[numdof],old_epl_thickness[numdof]; 4549 IssmDouble epl_head[numdof],sed_head[numdof]; 4550 IssmDouble preceding_transfer[numdof],sed_trans[numdof]; 4551 4552 Input* active_element_input=NULL; 4553 4554 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 4502 /*This thing should be useless and deleted soon*/ 4503 4504 /* void Tria::GetHydrologyTransfer(Vector<IssmDouble>* transfer){ */ 4505 4506 /* const int numdof = NDOF1 *NUMVERTICES; */ 4507 /* int *doflist = NULL; */ 4508 /* int analysis_type; */ 4509 /* bool isefficientlayer; */ 4510 /* bool active_element; */ 4511 /* int transfermethod; */ 4512 /* IssmDouble leakage,h_max,dt,test; */ 4513 /* IssmDouble wh_trans,sed_thick,relaxed; */ 4514 /* IssmDouble epl_specificstoring,sedstoring; */ 4515 /* IssmDouble activeEpl[numdof],epl_thickness[numdof],old_epl_thickness[numdof]; */ 4516 /* IssmDouble epl_head[numdof],sed_head[numdof]; */ 4517 /* IssmDouble epl_head_old[numdof],sed_head_old[numdof]; */ 4518 /* IssmDouble preceding_transfer[numdof],sed_trans[numdof]; */ 4519 4520 /* Input* active_element_input=NULL; */ 4521 4522 4523 /* parameters->FindParam(&analysis_type,AnalysisTypeEnum); */ 4555 4524 4556 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 4557 4558 /*Get the flag to know if the efficient layer is present*/4559 this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum); 4560 4561 if(isefficientlayer){ 4562 /*Also get the flag to the transfer method*/4563 this->parameters->FindParam(&transfermethod,HydrologydcTransferFlagEnum); 4564 4565 /*Switch between the different transfer methods cases*/4566 switch(transfermethod){ 4567 case 0: 4568 /*Just keepping the transfer to zero, should be OK with the initial value of transfer*/4569 break; 4570 case 1: 4525 /* GetDofList(&doflist,NoneApproximationEnum,GsetEnum); */ 4526 4527 /* /\*Get the flag to know if the efficient layer is present*\/ */ 4528 /* this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum); */ 4529 4530 /* if(isefficientlayer){ */ 4531 /* /\*Also get the flag to the transfer method*\/ */ 4532 /* this->parameters->FindParam(&transfermethod,HydrologydcTransferFlagEnum); */ 4533 /* this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); */ 4534 /* /\*Switch between the different transfer methods cases*\/ */ 4535 /* switch(transfermethod){ */ 4536 /* case 0: */ 4537 /* /\*Just keepping the transfer to zero, should be OK with the initial value of transfer*\/ */ 4538 /* break; */ 4539 /* case 1: */ 4571 4540 4572 active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); 4573 active_element_input->GetInputValue(&active_element); 4574 4575 GetInputListOnVertices(&sed_head[0],SedimentHeadEnum); 4576 GetInputListOnVertices(&sed_trans[0],HydrologydcSedimentTransmitivityEnum); 4577 GetInputListOnVertices(&epl_head[0],EplHeadEnum); 4578 GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum); 4579 4580 this->parameters->FindParam(&leakage,HydrologydcLeakageFactorEnum); 4581 4582 sed_thick = matpar->GetSedimentThickness(); 4583 4584 if(!active_element){ 4585 /*No transfer if the EPL is not active*/ 4586 } 4587 else{ 4588 GetInputListOnVertices(&preceding_transfer[0],WaterTransferEnum); 4589 sedstoring=matpar->GetSedimentStoring(); 4590 epl_specificstoring=matpar->GetEplSpecificStoring(); 4541 /* active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */ 4542 /* active_element_input->GetInputValue(&active_element); */ 4543 4544 /* GetInputListOnVertices(&sed_head[0],SedimentHeadEnum); */ 4545 /* GetInputListOnVertices(&sed_head_old[0],SedimentHeadOldEnum); */ 4546 /* GetInputListOnVertices(&sed_trans[0],HydrologydcSedimentTransmitivityEnum); */ 4547 /* GetInputListOnVertices(&epl_head[0],EplHeadEnum); */ 4548 /* GetInputListOnVertices(&epl_head_old[0],EplHeadOldEnum); */ 4549 /* GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum); */ 4550 4551 /* this->parameters->FindParam(&leakage,HydrologydcLeakageFactorEnum); */ 4552 4553 /* sed_thick = matpar->GetSedimentThickness(); */ 4554 4555 /* if(!active_element){ */ 4556 4557 4558 /* /\*No transfer if the EPL is not active*\/ */ 4559 /* } */ 4560 /* else{ */ 4561 /* GetInputListOnVertices(&preceding_transfer[0],WaterTransferEnum); */ 4562 /* sedstoring=matpar->GetSedimentStoring(); */ 4563 /* epl_specificstoring=matpar->GetEplSpecificStoring(); */ 4591 4564 4592 for(int i=0;i<numdof;i++){ 4593 this->GetHydrologyDCInefficientHmax(&h_max,i); 4594 4595 /*EPL head higher than sediment head, transfer from the epl to the sediment*/ 4596 if(epl_head[i]>sed_head[i]){ 4597 wh_trans=epl_specificstoring*epl_thickness[i]*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick); 4598 4599 /*No transfer if the sediment head is allready at the maximum*/ 4600 if(sed_head[i]>=h_max){ 4601 wh_trans=0.0; 4602 } 4603 } 4604 /* EPL head lower than sediment head, transfer from the sediment to the epl */ 4605 else if(epl_head[i]<=sed_head[i]){ 4606 wh_trans=sedstoring*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick); 4607 } 4565 /* for(int i=0;i<numdof;i++){ */ 4566 /* this->GetHydrologyDCInefficientHmax(&h_max,this->nodes[i]); */ 4567 /* /\*EPL head higher than sediment head, transfer from the epl to the sediment*\/ */ 4568 /* if(epl_head[i]>sed_head[i]){ */ 4569 /* if(sed_head[i]>=h_max){ */ 4570 /* wh_trans=0.0; */ 4571 /* } */ 4572 /* else{ */ 4573 /* wh_trans=epl_specificstoring*epl_thickness[i]*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick); */ 4574 /* } */ 4575 /* } */ 4576 /* /\* EPL head lower than sediment head, transfer from the sediment to the epl *\/ */ 4577 /* else if(epl_head[i]<=sed_head[i]){ */ 4578 /* wh_trans=sedstoring*sed_trans[i]*(epl_head[i]-sed_head[i])/(leakage*sed_thick); */ 4579 /* } */ 4608 4580 4609 /*Relaxation stuff*/ 4610 wh_trans=preceding_transfer[i]+0.8*(wh_trans-preceding_transfer[i]); 4611 4612 /*Assign output pointer*/ 4613 transfer->SetValue(doflist[i],wh_trans,INS_VAL); 4614 } 4615 } 4616 break; 4617 default: 4618 _error_("no case higher than 1 for the Transfer method"); 4619 } 4620 } 4621 /*Free ressources:*/ 4622 xDelete<int>(doflist); 4623 } 4581 /* /\*Assign output pointer*\/ */ 4582 /* transfer->SetValue(doflist[i],wh_trans,INS_VAL); */ 4583 /* } */ 4584 /* } */ 4585 /* break; */ 4586 /* default: */ 4587 /* _error_("no case higher than 1 for the Transfer method"); */ 4588 /* } */ 4589 /* } */ 4590 /* /\*Free ressources:*\/ */ 4591 /* xDelete<int>(doflist); */ 4592 /* } */ 4624 4593 /*}}}*/ 4625 4594 /*FUNCTION Tria::HydrologyEPLGetActive {{{*/ … … 4690 4659 if(epl_thickness[i]<0.001*init_thick){ 4691 4660 vec_mask->SetValue(nodes[i]->Sid(),0.,INS_VAL); 4661 epl_thickness[i]=init_thick; 4692 4662 } 4693 4663 } 4694 4664 /*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/ 4695 this->GetHydrologyDCInefficientHmax(&h_max, i);4665 this->GetHydrologyDCInefficientHmax(&h_max,this->nodes[i]); 4696 4666 if(eplhead[i]>=h_max && active_element){ 4697 4667 for(j=0;j<numdof;j++){ … … 4772 4742 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))); 4773 4743 4774 /*Relaxation stuff*/ 4775 if(thickness[i]<10.0*init_thick){ 4776 thickness[i] = preceding_thickness[i]+0.8*(thickness[i]-preceding_thickness[i]); 4777 } 4778 else{ 4744 /*Take care of otherthikening*/ 4745 if(thickness[i]>10.0*init_thick){ 4779 4746 thickness[i] = 10.0*init_thick; 4780 4747 } -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r17338 r17349 254 254 ElementMatrix* CreateEPLDomainMassMatrix(void); 255 255 void CreateHydrologyWaterVelocityInput(void); 256 void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);256 // void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index); 257 257 void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode); 258 258 void GetHydrologyTransfer(Vector<IssmDouble>* transfer); -
issm/trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
r17271 r17349 44 44 IssmDouble ndu_sed,nu_sed; 45 45 IssmDouble ndu_epl,nu_epl; 46 IssmDouble SedConv,EplConv;46 IssmDouble EplConv; 47 47 48 48 /*Recover parameters: */ … … 76 76 /*The real computation starts here, outermost loop is on the two layer system*/ 77 77 for(;;){ 78 79 EplConv=1.0; 78 80 sedcount=1; 79 81 eplcount=1; 80 SedConv=1.0;81 EplConv=1.0;82 82 83 83 /*If there is two layers we need an outer loop value to compute convergence*/ … … 97 97 /*Reset constraint on the ZigZag Lock, this thing doesn't work, it have to disapear*/ 98 98 ResetConstraintsx(femmodel); 99 sedconverged=false; 99 100 100 /* {{{ *//*Treating the sediment*/ 101 101 for(;;){ 102 sedconverged=false; 102 103 uf_sed_sub_iter=uf_sed->Duplicate();_assert_(uf_sed_sub_iter); 103 104 uf_sed->Copy(uf_sed_sub_iter); … … 105 106 for(;;){ 106 107 /* {{{ *//*Core of the computation*/ 108 if(VerboseSolution()) _printf0_("Building Sediment Matrix...\n"); 107 109 SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel); 108 110 CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCInefficientAnalysisEnum); … … 127 129 if(sedconverged)break; 128 130 } 131 129 132 /* }}} *//*End of the sediment penalization loop*/ 133 /*Update EPL mask*/ 134 if(isefficientlayer){ 135 HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis(); 136 analysis->ElementizeEplMask(femmodel); 137 delete analysis; 138 } 139 130 140 sedconverged=false; 131 /*Update Elemental Mask and compute transfer*/ 132 if(isefficientlayer){ 133 if(SedConv<0.3){ 134 HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis(); 135 analysis->ElementizeEplMask(femmodel); 136 delete analysis; 137 femmodel->HydrologyTransferx(); 138 transfered=true; 139 } 140 else{ 141 transfered=false; 142 } 143 } 144 else{ 145 transfered=true; 146 } 141 147 142 /*Checking convegence on the value of the sediment head*/ 148 143 duf=uf_sed_sub_iter->Duplicate();_assert_(duf); … … 154 149 if (xIsNan<IssmDouble>(ndu_sed) || xIsNan<IssmDouble>(nu_sed)) _error_("convergence criterion is NaN!"); 155 150 if (ndu_sed==0.0 && nu_sed==0.0) nu_sed=1.0e-6; /*Hacking the case where the layer is empty*/ 156 if(VerboseConvergence()) _printf0_(setw(50) << left << " Inner Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << " aiming lower than " << eps_hyd*100 << " %\n"); 157 SedConv = ndu_sed/nu_sed*100; 158 if((ndu_sed/nu_sed)<eps_hyd){ 151 if(VerboseConvergence()) _printf0_(setw(50) << left << " Inner Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << "%, aiming lower than " << eps_hyd*10*100 << " %\n"); 152 if((ndu_sed/nu_sed)<eps_hyd*10.){ 159 153 if(VerboseConvergence()) _printf0_(" # Inner sediment convergence achieve \n"); 160 154 sedconverged=true; 161 155 } 162 156 delete uf_sed_sub_iter; 163 if(sedconverged && transfered){157 if(sedconverged){ 164 158 femmodel->parameters->SetParam(sediment_kmax,HydrologySedimentKmaxEnum); 165 159 InputUpdateFromConstantx(femmodel,sedconverged,ConvergedEnum); … … 179 173 InputUpdateFromConstantx(femmodel,false,ConvergedEnum); 180 174 femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum); 181 182 eplconverged=false; 175 EplConv=1.0; 183 176 184 177 for(;;){ 185 178 eplconverged=false; 186 179 ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter); 187 180 ug_epl->Copy(ug_epl_sub_iter); 188 181 189 if(EplConv<0.3){ 190 /* {{{ *//*Retriev the EPL head slopes and compute EPL Thickness*/ 182 /* {{{ *//*Retriev the EPL head slopes and compute EPL Thickness*/ 191 183 if(VerboseSolution()) _printf0_("computing EPL Head slope...\n"); 192 184 femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum); … … 201 193 //updating mask after the computation of the epl thickness (Allow to close too thin EPL) 202 194 femmodel->HydrologyEPLupdateDomainx(); 203 /* }}} */ 204 205 /*Update Elemental Mask and compute transfer*/ 195 206 196 HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis(); 207 197 analysis->ElementizeEplMask(femmodel); 208 198 delete analysis; 209 femmodel->HydrologyTransferx(); 210 transfered=true; 211 } 212 else{ 213 transfered=false; 214 } 215 199 /* }}} */ 200 201 if(VerboseSolution()) _printf0_("Building EPL Matrix...\n"); 216 202 SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel); 217 203 CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum); … … 236 222 if (xIsNan<IssmDouble>(ndu_epl) || xIsNan<IssmDouble>(nu_epl)) _error_("convergence criterion is NaN!"); 237 223 if (ndu_epl==0.0 && nu_epl==0.0) nu_epl=1.0e-6; /*Hacking the case where the EPL is used but empty*/ 238 if(VerboseConvergence()) _printf0_(setw(50) << left << " Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");239 EplConv=ndu_epl/nu_epl *100;240 if((ndu_epl/nu_epl)<eps_hyd ) eplconverged=true;224 if(VerboseConvergence()) _printf0_(setw(50) << left << " Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << "%, aiming lower than " << eps_hyd*10*100 << " %\n"); 225 EplConv=ndu_epl/nu_epl; 226 if((ndu_epl/nu_epl)<eps_hyd*10.) eplconverged=true; 241 227 if (eplcount>=hydro_maxiter){ 242 228 _error_(" maximum number of EPL iterations (" << hydro_maxiter << ") exceeded"); … … 246 232 247 233 delete ug_epl_sub_iter; 248 if(eplconverged && transfered){234 if(eplconverged){ 249 235 if(VerboseSolution()) _printf0_("eplconverged...\n"); 250 236 InputUpdateFromConstantx(femmodel,eplconverged,ConvergedEnum); … … 283 269 } 284 270 else{ 285 if(VerboseConvergence()) _printf0_(setw(50) << left << " Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << " aiming lower than " << eps_hyd*100 << " %\n");286 if(VerboseConvergence()) _printf0_(setw(50) << left << " EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");271 if(VerboseConvergence()) _printf0_(setw(50) << left << " Sediment Convergence criterion:" << ndu_sed/nu_sed*100 << "%, aiming lower than " << eps_hyd*100 << " %\n"); 272 if(VerboseConvergence()) _printf0_(setw(50) << left << " EPL Convergence criterion:" << ndu_epl/nu_epl*100 << "%, aiming lower than " << eps_hyd*100 << " %\n"); 287 273 hydroconverged=false; 288 274 }
Note:
See TracChangeset
for help on using the changeset viewer.