Changeset 5639
- Timestamp:
- 08/31/10 16:00:44 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk/src/c/objects/Elements/Tria.cpp ¶
r5638 r5639 4677 4677 4678 4678 /* gaussian points: */ 4679 int num_gauss,ig; 4680 double* first_gauss_area_coord = NULL; 4681 double* second_gauss_area_coord = NULL; 4682 double* third_gauss_area_coord = NULL; 4683 double* gauss_weights = NULL; 4684 double gauss_weight; 4685 double gauss_l1l2l3[3]; 4679 int ig; 4680 GaussTria* gauss=NULL; 4686 4681 4687 4682 /* parameters: */ … … 4712 4707 weights_input =inputs->GetInput(WeightsEnum);ISSMASSERT(weights_input); 4713 4708 4714 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */4715 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);4716 4717 4709 /* Start looping on the number of gaussian points: */ 4718 for (ig=0; ig<num_gauss; ig++){ 4719 /*Pick up the gaussian point: */ 4720 gauss_weight=*(gauss_weights+ig); 4721 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 4722 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 4723 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 4710 gauss=new GaussTria(2); 4711 for(ig=gauss->begin();ig<gauss->end();ig++){ 4712 4713 gauss->GaussPoint(ig); 4724 4714 4725 4715 /* Get Jacobian determinant: */ 4726 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss _l1l2l3);4716 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 4727 4717 4728 4718 /* Get nodal functions value at gaussian point:*/ 4729 GetNodalFunctions(l1l2l3, gauss _l1l2l3);4719 GetNodalFunctions(l1l2l3, gauss); 4730 4720 4731 4721 /*Get parameters at gauss point*/ 4732 thickness_input->GetParameterValue(&thickness, &gauss_l1l2l3[0]);4733 thicknessobs_input->GetParameterValue(&thicknessobs, &gauss_l1l2l3[0]);4734 weights_input->GetParameterValue(&weight, &gauss_l1l2l3[0]);4722 thickness_input->GetParameterValue(&thickness, gauss); 4723 thicknessobs_input->GetParameterValue(&thicknessobs, gauss); 4724 weights_input->GetParameterValue(&weight, gauss); 4735 4725 4736 4726 for (i=0;i<numvertices;i++){ 4737 pe_g_gaussian[i]=(thicknessobs-thickness)*weight*Jdet*gauss _weight*l1l2l3[i];4727 pe_g_gaussian[i]=(thicknessobs-thickness)*weight*Jdet*gauss->weight*l1l2l3[i]; 4738 4728 } 4739 4729 … … 4747 4737 VecSetValues(p_g,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4748 4738 4749 /*Free ressources:*/ 4750 xfree((void**)&first_gauss_area_coord); 4751 xfree((void**)&second_gauss_area_coord); 4752 xfree((void**)&third_gauss_area_coord); 4753 xfree((void**)&gauss_weights); 4739 /*Clean up and return*/ 4740 delete gauss; 4754 4741 xfree((void**)&doflist); 4755 4742 } … … 4777 4764 4778 4765 /* gaussian points: */ 4779 int num_gauss,ig; 4780 double* first_gauss_area_coord = NULL; 4781 double* second_gauss_area_coord = NULL; 4782 double* third_gauss_area_coord = NULL; 4783 double* gauss_weights = NULL; 4784 double gauss_weight; 4785 double gauss_l1l2l3[3]; 4766 int ig; 4767 GaussTria* gauss=NULL; 4786 4768 4787 4769 /* parameters: */ … … 4945 4927 } 4946 4928 4947 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */4948 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);4949 4950 4929 /* Start looping on the number of gaussian points: */ 4951 for (ig=0; ig<num_gauss; ig++){ 4952 /*Pick up the gaussian point: */ 4953 gauss_weight=*(gauss_weights+ig); 4954 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 4955 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 4956 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 4930 gauss=new GaussTria(2); 4931 for(ig=gauss->begin();ig<gauss->end();ig++){ 4932 4933 gauss->GaussPoint(ig); 4957 4934 4958 4935 /* Get Jacobian determinant: */ 4959 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss _l1l2l3);4936 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 4960 4937 4961 4938 /* Get nodal functions value at gaussian point:*/ 4962 GetNodalFunctions(l1l2l3, gauss _l1l2l3);4939 GetNodalFunctions(l1l2l3, gauss); 4963 4940 4964 4941 /*Build due_g_gaussian vector: we have three cases here, according to which type of misfit we are using. */ 4965 4942 4966 4943 /*Compute absolute(x/y) at gaussian point: */ 4967 TriaRef::GetParameterValue(&dux, &dux_list[0],gauss _l1l2l3);4968 TriaRef::GetParameterValue(&duy, &duy_list[0],gauss _l1l2l3);4944 TriaRef::GetParameterValue(&dux, &dux_list[0],gauss); 4945 TriaRef::GetParameterValue(&duy, &duy_list[0],gauss); 4969 4946 4970 4947 /*compute Du*/ 4971 4948 for (i=0;i<numvertices;i++){ 4972 pe_g_gaussian[i*NDOF2+0]=dux*Jdet*gauss _weight*l1l2l3[i];4973 pe_g_gaussian[i*NDOF2+1]=duy*Jdet*gauss _weight*l1l2l3[i];4949 pe_g_gaussian[i*NDOF2+0]=dux*Jdet*gauss->weight*l1l2l3[i]; 4950 pe_g_gaussian[i*NDOF2+1]=duy*Jdet*gauss->weight*l1l2l3[i]; 4974 4951 } 4975 4952 … … 4983 4960 VecSetValues(p_g,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4984 4961 4985 /*Free ressources:*/ 4986 xfree((void**)&first_gauss_area_coord); 4987 xfree((void**)&second_gauss_area_coord); 4988 xfree((void**)&third_gauss_area_coord); 4989 xfree((void**)&gauss_weights); 4962 /*Clean up and return*/ 4963 delete gauss; 4990 4964 xfree((void**)&doflist); 4991 4965 } … … 5013 4987 5014 4988 /* gaussian points: */ 5015 int num_gauss,ig; 5016 double* first_gauss_area_coord = NULL; 5017 double* second_gauss_area_coord = NULL; 5018 double* third_gauss_area_coord = NULL; 5019 double* gauss_weights = NULL; 5020 double gauss_weight; 5021 double gauss_l1l2l3[3]; 4989 int ig; 4990 GaussTria* gauss=NULL; 5022 4991 5023 4992 /* parameters: */ … … 5181 5150 } 5182 5151 5183 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */5184 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);5185 5186 5152 /* Start looping on the number of gaussian points: */ 5187 for (ig=0; ig<num_gauss; ig++){ 5188 /*Pick up the gaussian point: */ 5189 gauss_weight=*(gauss_weights+ig); 5190 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 5191 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 5192 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 5153 gauss=new GaussTria(2); 5154 for(ig=gauss->begin();ig<gauss->end();ig++){ 5155 5156 gauss->GaussPoint(ig); 5193 5157 5194 5158 /* Get Jacobian determinant: */ 5195 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss _l1l2l3);5159 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 5196 5160 5197 5161 /* Get nodal functions value at gaussian point:*/ 5198 GetNodalFunctions(l1l2l3, gauss _l1l2l3);5162 GetNodalFunctions(l1l2l3, gauss); 5199 5163 5200 5164 /*Build due_g_gaussian vector: we have three cases here, according to which type of misfit we are using. */ 5201 5165 5202 5166 /*Compute absolute(x/y) at gaussian point: */ 5203 TriaRef::GetParameterValue(&dux, &dux_list[0],gauss _l1l2l3);5204 TriaRef::GetParameterValue(&duy, &duy_list[0],gauss _l1l2l3);5167 TriaRef::GetParameterValue(&dux, &dux_list[0],gauss); 5168 TriaRef::GetParameterValue(&duy, &duy_list[0],gauss); 5205 5169 5206 5170 /*compute Du*/ 5207 5171 for (i=0;i<numvertices;i++){ 5208 pe_g[i*NDOF4+0]+=dux*Jdet*gauss _weight*l1l2l3[i];5209 pe_g[i*NDOF4+1]+=duy*Jdet*gauss _weight*l1l2l3[i];5172 pe_g[i*NDOF4+0]+=dux*Jdet*gauss->weight*l1l2l3[i]; 5173 pe_g[i*NDOF4+1]+=duy*Jdet*gauss->weight*l1l2l3[i]; 5210 5174 } 5211 5175 } … … 5214 5178 VecSetValues(p_g,numdof,doflist,(const double*)pe_g,ADD_VALUES); 5215 5179 5216 /*Free ressources:*/ 5217 xfree((void**)&first_gauss_area_coord); 5218 xfree((void**)&second_gauss_area_coord); 5219 xfree((void**)&third_gauss_area_coord); 5220 xfree((void**)&gauss_weights); 5180 /*Clean up and return*/ 5181 delete gauss; 5221 5182 xfree((void**)&doflist); 5222 5183 } … … 5244 5205 Input* slopey_input=NULL; 5245 5206 Input* thickness_input=NULL; 5246 double gauss[numvertices][numvertices] = {{1,0,0},{0,1,0},{0,0,1}}; //TO BE DELETED5207 GaussTria* gauss=NULL; 5247 5208 5248 5209 /*recover some inputs: */ … … 5266 5227 5267 5228 /*Spawn 3 sing elements: */ 5268 for(i=0;i<3;i++){ 5229 gauss=new GaussTria(); 5230 for(i=0;i<numvertices;i++){ 5231 5232 gauss->GaussVertex(i); 5233 5269 5234 connectivity=nodes[i]->GetConnectivity(); 5270 5235 5271 thickness_input->GetParameterValue(&thickness, &gauss[i][0]);5272 slopex_input->GetParameterValue(&slope[0], &gauss[i][0]);5273 slopey_input->GetParameterValue(&slope[1], &gauss[i][0]);5236 thickness_input->GetParameterValue(&thickness,gauss); 5237 slopex_input->GetParameterValue(&slope[0],gauss); 5238 slopey_input->GetParameterValue(&slope[1],gauss); 5274 5239 slope2=pow(slope[0],2)+pow(slope[1],2); 5275 5240 … … 5287 5252 5288 5253 VecSetValues(pg,numdofs,doflist,(const double*)pe_g,ADD_VALUES); 5289 5290 /*Free ressources:*/ 5254 5255 /*Clean up and return*/ 5256 delete gauss; 5291 5257 xfree((void**)&doflist); 5292 5258 } … … 5294 5260 /*FUNCTION Tria::CreatePVectorPrognostic_CG {{{1*/ 5295 5261 void Tria::CreatePVectorPrognostic_CG(Vec pg){ 5296 5297 5262 5298 5263 /* local declarations */ … … 5308 5273 5309 5274 /* gaussian points: */ 5310 int num_gauss,ig; 5311 double* first_gauss_area_coord = NULL; 5312 double* second_gauss_area_coord = NULL; 5313 double* third_gauss_area_coord = NULL; 5314 double* gauss_weights = NULL; 5315 double gauss_weight; 5316 double gauss_l1l2l3[3]; 5275 int ig; 5276 GaussTria* gauss=NULL; 5317 5277 5318 5278 /* matrix */ … … 5339 5299 GetDofList(&doflist); 5340 5300 5341 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */5342 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);5343 5344 5301 /*Retrieve all inputs we will be needing: */ 5345 5302 accumulation_input=inputs->GetInput(AccumulationRateEnum); … … 5348 5305 5349 5306 /* Start looping on the number of gaussian points: */ 5350 for (ig=0; ig<num_gauss; ig++){ 5351 /*Pick up the gaussian point: */ 5352 gauss_weight=*(gauss_weights+ig); 5353 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 5354 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 5355 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 5307 gauss=new GaussTria(2); 5308 for(ig=gauss->begin();ig<gauss->end();ig++){ 5309 5310 gauss->GaussPoint(ig); 5356 5311 5357 5312 /* Get Jacobian determinant: */ 5358 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss _l1l2l3);5313 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 5359 5314 5360 5315 /*Get L matrix: */ 5361 GetL(&L[0], &xyz_list[0][0], gauss _l1l2l3,numberofdofspernode);5316 GetL(&L[0], &xyz_list[0][0], gauss,numberofdofspernode); 5362 5317 5363 5318 /* Get accumulation, melting and thickness at gauss point */ 5364 accumulation_input->GetParameterValue(&accumulation_g, &gauss_l1l2l3[0]);5365 melting_input->GetParameterValue(&melting_g, &gauss_l1l2l3[0]);5366 thickness_input->GetParameterValue(&thickness_g, &gauss_l1l2l3[0]);5319 accumulation_input->GetParameterValue(&accumulation_g,gauss); 5320 melting_input->GetParameterValue(&melting_g,gauss); 5321 thickness_input->GetParameterValue(&thickness_g,gauss); 5367 5322 5368 5323 /* Add value into pe_g: */ 5369 for( i=0; i<numdof; i++) pe_g[i]+=Jdettria*gauss _weight*(thickness_g+dt*(accumulation_g-melting_g))*L[i];5324 for( i=0; i<numdof; i++) pe_g[i]+=Jdettria*gauss->weight*(thickness_g+dt*(accumulation_g-melting_g))*L[i]; 5370 5325 5371 5326 } // for (ig=0; ig<num_gauss; ig++) … … 5374 5329 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 5375 5330 5376 /*Free ressources:*/ 5377 xfree((void**)&first_gauss_area_coord); 5378 xfree((void**)&second_gauss_area_coord); 5379 xfree((void**)&third_gauss_area_coord); 5380 xfree((void**)&gauss_weights); 5331 /*Clean up and return*/ 5332 delete gauss; 5381 5333 xfree((void**)&doflist); 5382 5334 … … 5398 5350 5399 5351 /* gaussian points: */ 5400 int num_gauss,ig; 5401 double* first_gauss_area_coord = NULL; 5402 double* second_gauss_area_coord = NULL; 5403 double* third_gauss_area_coord = NULL; 5404 double* gauss_weights = NULL; 5405 double gauss_weight; 5406 double gauss_l1l2l3[3]; 5352 int ig; 5353 GaussTria* gauss=NULL; 5407 5354 5408 5355 /* matrix */ … … 5427 5374 GetDofList(&doflist); 5428 5375 5429 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */5430 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);5431 5432 5376 /*Retrieve all inputs we will be needing: */ 5433 5377 accumulation_input=inputs->GetInput(AccumulationRateEnum); … … 5436 5380 5437 5381 /* Start looping on the number of gaussian points: */ 5438 for (ig=0; ig<num_gauss; ig++){ 5439 /*Pick up the gaussian point: */ 5440 gauss_weight=*(gauss_weights+ig); 5441 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 5442 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 5443 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 5382 gauss=new GaussTria(2); 5383 for(ig=gauss->begin();ig<gauss->end();ig++){ 5384 5385 gauss->GaussPoint(ig); 5444 5386 5445 5387 /* Get Jacobian determinant: */ 5446 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss _l1l2l3);5388 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 5447 5389 5448 5390 /*Get L matrix: */ 5449 GetL(&L[0], &xyz_list[0][0], gauss _l1l2l3,numberofdofspernode);5391 GetL(&L[0], &xyz_list[0][0], gauss,numberofdofspernode); 5450 5392 5451 5393 /* Get accumulation, melting and thickness at gauss point */ 5452 accumulation_input->GetParameterValue(&accumulation_g, &gauss_l1l2l3[0]);5453 melting_input->GetParameterValue(&melting_g, &gauss_l1l2l3[0]);5454 thickness_input->GetParameterValue(&thickness_g, &gauss_l1l2l3[0]);5394 accumulation_input->GetParameterValue(&accumulation_g,gauss); 5395 melting_input->GetParameterValue(&melting_g,gauss); 5396 thickness_input->GetParameterValue(&thickness_g,gauss); 5455 5397 5456 5398 /* Add value into pe_g: */ 5457 for( i=0; i<numdof; i++) pe_g[i]+=Jdettria*gauss _weight*(thickness_g+dt*(accumulation_g-melting_g))*L[i];5399 for( i=0; i<numdof; i++) pe_g[i]+=Jdettria*gauss->weight*(thickness_g+dt*(accumulation_g-melting_g))*L[i]; 5458 5400 5459 5401 } // for (ig=0; ig<num_gauss; ig++) … … 5462 5404 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 5463 5405 5464 /*Free ressources:*/ 5465 xfree((void**)&first_gauss_area_coord); 5466 xfree((void**)&second_gauss_area_coord); 5467 xfree((void**)&third_gauss_area_coord); 5468 xfree((void**)&gauss_weights); 5406 /*Clean up and return*/ 5407 delete gauss; 5469 5408 xfree((void**)&doflist); 5470 5409 } … … 5483 5422 5484 5423 /* gaussian points: */ 5485 int num_gauss,ig; 5486 double* first_gauss_area_coord = NULL; 5487 double* second_gauss_area_coord = NULL; 5488 double* third_gauss_area_coord = NULL; 5489 double* gauss_weights = NULL; 5490 double gauss_weight; 5491 double gauss_l1l2l3[3]; 5424 int ig; 5425 GaussTria* gauss=NULL; 5492 5426 5493 5427 /* Jacobian: */ … … 5513 5447 GetDofList(&doflist); 5514 5448 5515 /* Get gaussian points and weights: */5516 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2); /*We need higher order because our load is order 2*/5517 5518 5449 /*Retrieve all inputs we will be needing: */ 5519 5450 if ( (analysis_type==SurfaceSlopeXAnalysisEnum) || (analysis_type==SurfaceSlopeYAnalysisEnum)){ … … 5525 5456 5526 5457 /* Start looping on the number of gaussian points: */ 5527 for (ig=0; ig<num_gauss; ig++){ 5528 /*Pick up the gaussian point: */ 5529 gauss_weight=*(gauss_weights+ig); 5530 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 5531 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 5532 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 5533 5534 slope_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0]); 5458 gauss=new GaussTria(2); 5459 for(ig=gauss->begin();ig<gauss->end();ig++){ 5460 5461 gauss->GaussPoint(ig); 5462 5463 slope_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],gauss); 5535 5464 5536 5465 /* Get Jacobian determinant: */ 5537 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss _l1l2l3);5466 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 5538 5467 5539 5468 /*Get nodal functions: */ 5540 GetNodalFunctions(l1l2l3, gauss _l1l2l3);5469 GetNodalFunctions(l1l2l3, gauss); 5541 5470 5542 5471 /*Build pe_g_gaussian vector: */ 5543 5472 if ( (analysis_type==SurfaceSlopeXAnalysisEnum) || (analysis_type==BedSlopeXAnalysisEnum)){ 5544 for(i=0;i<numdof;i++) pe_g_gaussian[i]=Jdet*gauss _weight*slope[0]*l1l2l3[i];5473 for(i=0;i<numdof;i++) pe_g_gaussian[i]=Jdet*gauss->weight*slope[0]*l1l2l3[i]; 5545 5474 } 5546 5475 if ( (analysis_type==SurfaceSlopeYAnalysisEnum) || (analysis_type==BedSlopeYAnalysisEnum)){ 5547 for(i=0;i<numdof;i++) pe_g_gaussian[i]=Jdet*gauss _weight*slope[1]*l1l2l3[i];5476 for(i=0;i<numdof;i++) pe_g_gaussian[i]=Jdet*gauss->weight*slope[1]*l1l2l3[i]; 5548 5477 } 5549 5478 … … 5556 5485 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 5557 5486 5558 /*Free ressources:*/ 5559 xfree((void**)&first_gauss_area_coord); 5560 xfree((void**)&second_gauss_area_coord); 5561 xfree((void**)&third_gauss_area_coord); 5562 xfree((void**)&gauss_weights); 5487 /*Clean up and return*/ 5488 delete gauss; 5563 5489 xfree((void**)&doflist); 5564 5490 } … … 5588 5514 5589 5515 /* gaussian points: */ 5590 int num_area_gauss,ig; 5591 double* gauss_weights = NULL; 5592 double* first_gauss_area_coord = NULL; 5593 double* second_gauss_area_coord = NULL; 5594 double* third_gauss_area_coord = NULL; 5595 double gauss_weight; 5596 double gauss_coord[3]; 5516 int ig; 5517 GaussTria* gauss=NULL; 5597 5518 5598 5519 /*matrices: */ … … 5625 5546 /* Ice/ocean heat exchange flux on ice shelf base */ 5626 5547 5627 GaussLegendreTria (&num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);5628 5629 5548 /*Retrieve all inputs we will be needing: */ 5630 5549 pressure_input=inputs->GetInput(PressureEnum); 5631 5550 5632 5551 /* Start looping on the number of gauss 2d (nodes on the bedrock) */ 5633 for (ig=0; ig<num_area_gauss; ig++){ 5634 gauss_weight=*(gauss_weights+ig); 5635 gauss_coord[0]=*(first_gauss_area_coord+ig); 5636 gauss_coord[1]=*(second_gauss_area_coord+ig); 5637 gauss_coord[2]=*(third_gauss_area_coord+ig); 5552 gauss=new GaussTria(2); 5553 for(ig=gauss->begin();ig<gauss->end();ig++){ 5554 5555 gauss->GaussPoint(ig); 5638 5556 5639 5557 //Get the Jacobian determinant 5640 GetJacobianDeterminant3d(&Jdet, &xyz_list[0][0], gauss _coord);5558 GetJacobianDeterminant3d(&Jdet, &xyz_list[0][0], gauss); 5641 5559 5642 5560 /*Get nodal functions values: */ 5643 GetNodalFunctions(&l1l2l3[0], gauss _coord);5561 GetNodalFunctions(&l1l2l3[0], gauss); 5644 5562 5645 5563 /*Get geothermal flux and basal friction */ 5646 pressure_input->GetParameterValue(&pressure, &gauss_coord[0]);5564 pressure_input->GetParameterValue(&pressure,gauss); 5647 5565 t_pmp=meltingpoint-beta*pressure; 5648 5566 5649 5567 /*Calculate scalar parameter*/ 5650 scalar_ocean=gauss _weight*Jdet*rho_water*mixed_layer_capacity*thermal_exchange_velocity*(t_pmp)/(heatcapacity*rho_ice);5568 scalar_ocean=gauss->weight*Jdet*rho_water*mixed_layer_capacity*thermal_exchange_velocity*(t_pmp)/(heatcapacity*rho_ice); 5651 5569 if(dt){ 5652 5570 scalar_ocean=dt*scalar_ocean; … … 5661 5579 VecSetValues(pg,numdof,doflist,(const double*)P_terms,ADD_VALUES); 5662 5580 5663 /*Free ressources:*/ 5664 xfree((void**)&first_gauss_area_coord); 5665 xfree((void**)&second_gauss_area_coord); 5666 xfree((void**)&third_gauss_area_coord); 5667 xfree((void**)&gauss_weights); 5581 /*Clean up and return*/ 5582 delete gauss; 5668 5583 xfree((void**)&doflist); 5669 5584 } … … 5693 5608 double geothermalflux_value; 5694 5609 double alpha2_list[numvertices]; //TO BE DELETED 5695 double gauss [numvertices][numvertices] = {{1,0,0},{0,1,0},{0,0,1}}; //TO BE DELETED5610 double gaussgrids[numvertices][numvertices] = {{1,0,0},{0,1,0},{0,0,1}}; //TO BE DELETED 5696 5611 double vx_list[numvertices]; //TO BE DELETED 5697 5612 double vy_list[numvertices]; //TO BE DELETED … … 5699 5614 5700 5615 /* gaussian points: */ 5701 int num_area_gauss,ig; 5702 double* gauss_weights = NULL; 5703 double* first_gauss_area_coord = NULL; 5704 double* second_gauss_area_coord = NULL; 5705 double* third_gauss_area_coord = NULL; 5706 double gauss_weight; 5707 double gauss_coord[3]; 5616 int ig; 5617 GaussTria* gauss=NULL; 5708 5618 5709 5619 /*matrices: */ … … 5748 5658 /*COMPUT alpha2_list and basalfriction_list (TO BE DELETED)*/ 5749 5659 for(i=0;i<numvertices;i++){ 5750 friction->GetAlpha2(&alpha2_list[i],&gauss [i][0],VxEnum,VyEnum,VzEnum); //TO BE DELETED5751 } 5752 vx_input->GetParameterValues(&vx_list[0],&gauss [0][0],3); //TO BE DELETED5753 vy_input->GetParameterValues(&vy_list[0],&gauss [0][0],3); //TO BE DELETED5660 friction->GetAlpha2(&alpha2_list[i],&gaussgrids[i][0],VxEnum,VyEnum,VzEnum); //TO BE DELETED 5661 } 5662 vx_input->GetParameterValues(&vx_list[0],&gaussgrids[0][0],3); //TO BE DELETED 5663 vy_input->GetParameterValues(&vy_list[0],&gaussgrids[0][0],3); //TO BE DELETED 5754 5664 for(i=0;i<numvertices;i++){ 5755 5665 basalfriction_list[i]=alpha2_list[i]*(pow(vx_list[i],(double)2.0)+pow(vy_list[i],(double)2.0)); //TO BE DELETED … … 5757 5667 5758 5668 /* Ice/ocean heat exchange flux on ice shelf base */ 5759 GaussLegendreTria (&num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);5760 5669 5761 5670 /* Start looping on the number of gauss 2d (nodes on the bedrock) */ 5762 for (ig=0; ig<num_area_gauss; ig++){ 5763 gauss_weight=*(gauss_weights+ig); 5764 gauss_coord[0]=*(first_gauss_area_coord+ig); 5765 gauss_coord[1]=*(second_gauss_area_coord+ig); 5766 gauss_coord[2]=*(third_gauss_area_coord+ig); 5671 gauss=new GaussTria(2); 5672 for(ig=gauss->begin();ig<gauss->end();ig++){ 5673 5674 gauss->GaussPoint(ig); 5767 5675 5768 5676 //Get the Jacobian determinant 5769 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0], gauss _coord);5677 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0], gauss); 5770 5678 5771 5679 /*Get nodal functions values: */ 5772 GetNodalFunctions(&l1l2l3[0], gauss _coord);5680 GetNodalFunctions(&l1l2l3[0], gauss); 5773 5681 5774 5682 /*Get geothermal flux and basal friction */ 5775 geothermalflux_input->GetParameterValue(&geothermalflux_value, &gauss_coord[0]);5683 geothermalflux_input->GetParameterValue(&geothermalflux_value,gauss); 5776 5684 5777 5685 /*Friction: */ 5778 5686 //friction->GetAlpha2(&alpha2,&gauss_coord[0],VxEnum,VyEnum,VzEnum); 5779 TriaRef::GetParameterValue(&basalfriction,&basalfriction_list[0],gauss _coord); // TO BE DELETED5687 TriaRef::GetParameterValue(&basalfriction,&basalfriction_list[0],gauss); // TO BE DELETED 5780 5688 5781 5689 /*Calculate scalar parameter*/ 5782 scalar=gauss _weight*Jdet*(basalfriction+geothermalflux_value)/(heatcapacity*rho_ice);5690 scalar=gauss->weight*Jdet*(basalfriction+geothermalflux_value)/(heatcapacity*rho_ice); 5783 5691 if(dt){ 5784 5692 scalar=dt*scalar; … … 5794 5702 VecSetValues(pg,numdof,doflist,(const double*)P_terms,ADD_VALUES); 5795 5703 5796 /*Free ressources:*/ 5797 xfree((void**)&first_gauss_area_coord); 5798 xfree((void**)&second_gauss_area_coord); 5799 xfree((void**)&third_gauss_area_coord); 5800 xfree((void**)&gauss_weights); 5704 /*Clean up and return*/ 5705 delete gauss; 5706 delete friction; 5801 5707 xfree((void**)&doflist); 5802 delete friction;5803 5708 } 5804 5709 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.