Changeset 4904
- Timestamp:
- 07/30/10 11:09:56 (15 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r4899 r4904 1962 1962 if(!onbed)return; 1963 1963 1964 /*Depth Averaging Vx and Vy*/ 1965 this->InputDepthAverageAtBase(VxEnum,VxAverageEnum); 1966 this->InputDepthAverageAtBase(VyEnum,VyAverageEnum); 1967 1964 1968 /*Spawn Tria element from the base of the Penta: */ 1965 1969 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. … … 1990 1994 /*Is this element on the bed? :*/ 1991 1995 if(!onbed)return; 1996 1997 /*Depth Averaging Vx and Vy*/ 1998 this->InputDepthAverageAtBase(VxEnum,VxAverageEnum); 1999 this->InputDepthAverageAtBase(VyEnum,VyAverageEnum); 1992 2000 1993 2001 /*Spawn Tria element from the base of the Penta: */ … … 2691 2699 /*}}}*/ 2692 2700 /*FUNCTION Penta::CreateKMatrixPrognostic {{{1*/ 2693 2694 2701 void Penta::CreateKMatrixPrognostic(Mat Kgg){ 2695 2702 … … 2710 2717 /*Is this element on the bed? :*/ 2711 2718 if(!onbed)return; 2719 2720 /*Depth Averaging Vx and Vy*/ 2721 this->InputDepthAverageAtBase(VxEnum,VxAverageEnum); 2722 this->InputDepthAverageAtBase(VyEnum,VyAverageEnum); 2712 2723 2713 2724 /*Spawn Tria element from the base of the Penta: */ … … 2720 2731 /*}}}*/ 2721 2732 /*FUNCTION Penta::CreateKMatrixSlope {{{1*/ 2722 2723 2733 void Penta::CreateKMatrixSlope(Mat Kgg){ 2724 2734 … … 3692 3702 /*}}}*/ 3693 3703 /*FUNCTION Penta::CreatePVectorPrognostic {{{1*/ 3694 3695 3704 void Penta::CreatePVectorPrognostic( Vec pg){ 3696 3705 -
issm/trunk/src/c/objects/Elements/Tria.cpp
r4900 r4904 2321 2321 double v_gauss[2]={0.0}; 2322 2322 2323 2324 2323 double K[2][2]={0.0}; 2325 2324 double KDL[2][2]={0.0}; 2326 2325 int dofs[2]={0,1}; 2327 2326 int found=0; 2327 int dim; 2328 2328 2329 2329 /*inputs: */ … … 2338 2338 /*retrieve some parameters: */ 2339 2339 this->parameters->FindParam(&artdiff,ArtDiffEnum); 2340 this->parameters->FindParam(&dim,DimEnum); 2340 2341 2341 2342 /*Retrieve all inputs we will be needed*/ 2342 vxaverage_input=inputs->GetInput(VxAverageEnum); 2343 vyaverage_input=inputs->GetInput(VyAverageEnum); 2343 if(dim==2){ 2344 vxaverage_input=inputs->GetInput(VxEnum); 2345 vyaverage_input=inputs->GetInput(VyEnum); 2346 } 2347 else{ 2348 vxaverage_input=inputs->GetInput(VxAverageEnum); 2349 vyaverage_input=inputs->GetInput(VyAverageEnum); 2350 } 2344 2351 2345 2352 //Create Artificial diffusivity once for all if requested … … 2476 2483 int dofs[1]={0}; 2477 2484 int found; 2485 int dim; 2478 2486 2479 2487 /*inputs: */ … … 2484 2492 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 2485 2493 GetDofList(&doflist[0],&numberofdofspernode); 2494 this->parameters->FindParam(&dim,DimEnum); 2486 2495 2487 2496 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 2489 2498 2490 2499 /*Retrieve all inputs we will be needed*/ 2491 vx_input=inputs->GetInput(VxEnum); 2492 vy_input=inputs->GetInput(VyEnum); 2500 if(dim==2){ 2501 vx_input=inputs->GetInput(VxEnum); 2502 vy_input=inputs->GetInput(VyEnum); 2503 } 2493 2504 2494 2505 /* Start looping on the number of gaussian points: */ … … 2589 2600 int dofs[2]={0,1}; 2590 2601 int found=0; 2602 int dim; 2591 2603 2592 2604 /*inputs: */ 2593 2605 Input* vxaverage_input=NULL; 2594 2606 Input* vyaverage_input=NULL; 2607 Input* surface_input=NULL; 2595 2608 bool artdiff; 2596 2609 2597 2610 /*retrieve some parameters: */ 2598 2611 this->parameters->FindParam(&artdiff,ArtDiffEnum); 2612 this->parameters->FindParam(&dim,DimEnum); 2599 2613 2600 2614 /* Get node coordinates and dof list: */ … … 2602 2616 GetDofList(&doflist[0],&numberofdofspernode); 2603 2617 2618 /*Retrieve all inputs we will be needed*/ 2619 surface_input=inputs->GetInput(SurfaceEnum); 2620 if(dim==2){ 2621 vxaverage_input=inputs->GetInput(VxEnum); 2622 vyaverage_input=inputs->GetInput(VyEnum); 2623 } 2624 else{ 2625 vxaverage_input=inputs->GetInput(VxAverageEnum); 2626 vyaverage_input=inputs->GetInput(VyAverageEnum); 2627 } 2628 2604 2629 /*Modify z so that it reflects the surface*/ 2605 inputs->GetParameterValues(&surface_list[0],&gaussgrids[0][0],3,SurfaceEnum);2630 surface_input->GetParameterValues(&surface_list[0],&gaussgrids[0][0],3); 2606 2631 for(i=0;i<numgrids;i++) xyz_list[i][2]=surface_list[i]; 2607 2632 2608 2633 /*Get normal vector to the surface*/ 2609 inputs->GetParameterAverage(&nx,VxAverageEnum);2610 inputs->GetParameterAverage(&ny,VyAverageEnum);2634 vxaverage_input->GetParameterAverage(&nx); 2635 vyaverage_input->GetParameterAverage(&ny); 2611 2636 if(nx==0 && ny==0){ 2612 2637 SurfaceNormal(&surface_normal[0],xyz_list); … … 2621 2646 nx=nx/norm; 2622 2647 ny=ny/norm; 2623 2624 /*Retrieve all inputs we will be needed*/2625 vxaverage_input=inputs->GetInput(VxAverageEnum);2626 vyaverage_input=inputs->GetInput(VyAverageEnum);2627 2648 2628 2649 //Create Artificial diffusivity once for all if requested … … 2704 2725 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES); 2705 2726 2706 2707 cleanup_and_return:2708 2727 xfree((void**)&first_gauss_area_coord); 2709 2728 xfree((void**)&second_gauss_area_coord); 2710 2729 xfree((void**)&third_gauss_area_coord); 2711 2730 xfree((void**)&gauss_weights); 2712 2713 2731 } 2714 2732 /*}}}*/ … … 3284 3302 int dofs[2]={0,1}; 3285 3303 int found; 3304 int dim; 3286 3305 3287 3306 /*inputs: */ … … 3293 3312 /*retrieve some parameters: */ 3294 3313 this->parameters->FindParam(&dt,DtEnum); 3314 this->parameters->FindParam(&dim,DimEnum); 3295 3315 this->parameters->FindParam(&artdiff,ArtDiffEnum); 3296 3316 … … 3300 3320 3301 3321 /*Retrieve all inputs we will be needing: */ 3302 vxaverage_input=inputs->GetInput(VxAverageEnum); 3303 vyaverage_input=inputs->GetInput(VyAverageEnum); 3322 if(dim==2){ 3323 vxaverage_input=inputs->GetInput(VxEnum); 3324 vyaverage_input=inputs->GetInput(VyEnum); 3325 } 3326 else{ 3327 vxaverage_input=inputs->GetInput(VxAverageEnum); 3328 vyaverage_input=inputs->GetInput(VyAverageEnum); 3329 } 3304 3330 3305 3331 //Create Artificial diffusivity once for all if requested … … 3405 3431 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES); 3406 3432 3407 3408 cleanup_and_return:3409 3433 xfree((void**)&first_gauss_area_coord); 3410 3434 xfree((void**)&second_gauss_area_coord); … … 3453 3477 int dofs[1]={0}; 3454 3478 int found; 3479 int dim; 3455 3480 3456 3481 /*inputs: */ … … 3461 3486 /*retrieve some parameters: */ 3462 3487 this->parameters->FindParam(&dt,DtEnum); 3488 this->parameters->FindParam(&dim,DimEnum); 3463 3489 3464 3490 /* Get node coordinates and dof list: */ … … 3470 3496 3471 3497 /*Retrieve all inputs we will be needed*/ 3472 vxaverage_input=inputs->GetInput(VxAverageEnum); 3473 vyaverage_input=inputs->GetInput(VyAverageEnum); 3498 if(dim==2){ 3499 vxaverage_input=inputs->GetInput(VxEnum); 3500 vyaverage_input=inputs->GetInput(VyEnum); 3501 } 3502 else{ 3503 vxaverage_input=inputs->GetInput(VxAverageEnum); 3504 vyaverage_input=inputs->GetInput(VyAverageEnum); 3505 } 3474 3506 3475 3507 /* Start looping on the number of gaussian points: */ … … 3525 3557 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES); 3526 3558 3527 3528 cleanup_and_return:3529 3559 xfree((void**)&first_gauss_area_coord); 3530 3560 xfree((void**)&second_gauss_area_coord); … … 3710 3740 void Tria::CreatePVectorBalancedthickness_CG(Vec pg ){ 3711 3741 3712 3713 3742 /* local declarations */ 3714 3743 int i,j; … … 3781 3810 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 3782 3811 3783 cleanup_and_return:3784 3812 xfree((void**)&first_gauss_area_coord); 3785 3813 xfree((void**)&second_gauss_area_coord); 3786 3814 xfree((void**)&third_gauss_area_coord); 3787 3815 xfree((void**)&gauss_weights); 3788 3789 3816 } 3790 3817 /*}}}*/ … … 3866 3893 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 3867 3894 3868 cleanup_and_return:3869 3895 xfree((void**)&first_gauss_area_coord); 3870 3896 xfree((void**)&second_gauss_area_coord); 3871 3897 xfree((void**)&third_gauss_area_coord); 3872 3898 xfree((void**)&gauss_weights); 3873 3874 3899 } 3875 3900 /*}}}*/ 3876 3901 /*FUNCTION Tria::CreatePVectorBalancedvelocities {{{1*/ 3877 3902 void Tria::CreatePVectorBalancedvelocities(Vec pg){ 3878 3879 3903 3880 3904 /* local declarations */ … … 4814 4838 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4815 4839 4816 cleanup_and_return:4817 4840 xfree((void**)&first_gauss_area_coord); 4818 4841 xfree((void**)&second_gauss_area_coord); … … 4901 4924 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4902 4925 4903 cleanup_and_return:4904 4926 xfree((void**)&first_gauss_area_coord); 4905 4927 xfree((void**)&second_gauss_area_coord); … … 5470 5492 /*OK, now we can call input method*/ 5471 5493 this->inputs->GetParameterValue(&value, &gauss_tria[0],enumtype); 5494 5495 /*Assign output pointers:*/ 5496 *pvalue=value; 5497 } 5498 /*}}}*/ 5499 /*FUNCTION Tria::GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,Input* input_in) {{{1*/ 5500 void Tria::GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,Input* input_in){ 5501 5502 /*Output*/ 5503 double value; 5504 5505 /*Intermediaries*/ 5506 const int numnodes=3; 5507 int grid1=-1,grid2=-1; 5508 int grid3; 5509 int i; 5510 double gauss_tria[numnodes]; 5511 5512 /*go through 3 nodes (all nodes for tria) and identify 1st and 2nd nodes: */ 5513 ISSMASSERT(nodes); 5514 for(i=0;i<numnodes;i++){ 5515 if (node1==nodes[i]) grid1=i; 5516 if (node2==nodes[i]) grid2=i; 5517 } 5518 5519 /*Reverse grid1 and 2 if necessary*/ 5520 if (grid1>grid2){ 5521 5522 /*Reverse grid1 and grid2*/ 5523 grid3=grid1; grid1=grid2; grid2=grid3; 5524 5525 /*Change segment gauss point (between -1 and +1)*/ 5526 gauss_seg=-gauss_seg; 5527 } 5528 5529 /*Build Triangle Gauss point*/ 5530 if (grid1==0 && grid2==1){ 5531 /*gauss_seg is between 0 and 1*/ 5532 gauss_tria[0]=0.5*(1.-gauss_seg); 5533 gauss_tria[1]=1.-0.5*(1.-gauss_seg); 5534 gauss_tria[2]=0.; 5535 } 5536 else if (grid1==0 && grid2==2){ 5537 /*gauss_seg is between 0 and 2*/ 5538 gauss_tria[0]=0.5*(1.-gauss_seg); 5539 gauss_tria[1]=0.; 5540 gauss_tria[2]=1.-0.5*(1.-gauss_seg); 5541 } 5542 else if (grid1==1 && grid2==2){ 5543 /*gauss_seg is between 1 and 2*/ 5544 gauss_tria[0]=0.; 5545 gauss_tria[1]=0.5*(1.-gauss_seg); 5546 gauss_tria[2]=1.-0.5*(1.-gauss_seg); 5547 } 5548 else{ 5549 ISSMERROR("The 2 nodes provided are either the same or did not match current Tria nodes"); 5550 } 5551 5552 /*OK, now we can call input method*/ 5553 input_in->GetParameterValue(&value, &gauss_tria[0]); 5472 5554 5473 5555 /*Assign output pointers:*/ -
issm/trunk/src/c/objects/Elements/Tria.h
r4899 r4904 145 145 void GetParameterValue(double* pvalue,Node* node,int enumtype); 146 146 void GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,int enumtype); 147 void GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,Input* input_in); 147 148 void GetSolutionFromInputsDiagnosticHoriz(Vec solution); 148 149 void GetSolutionFromInputsAdjointHoriz(Vec solution); -
issm/trunk/src/c/objects/Inputs/Input.h
r4899 r4904 12 12 class Node; 13 13 class ElementResult; 14 #include "../Node.h"15 14 /*}}}*/ 16 15 -
issm/trunk/src/c/objects/Loads/Numericalflux.cpp
r4765 r4904 401 401 double dt; 402 402 int found; 403 int dim; 403 404 404 405 /*dynamic objects pointed to by hooks: */ 405 406 Node** nodes=NULL; 407 Tria* tria=NULL; 408 Input* vxaverage_input=NULL; 409 Input* vyaverage_input=NULL; 406 410 407 411 /*Retrieve parameters: */ 408 412 this->parameters->FindParam(&analysis_type,AnalysisTypeEnum); 413 parameters->FindParam(&dim,DimEnum); 409 414 410 415 /*recover objects from hooks: */ 411 416 nodes=(Node**)hnodes->deliverp(); 417 tria=(Tria*)helement->delivers(); 412 418 413 419 /*recover parameters: */ … … 428 434 GetNormal(&normal[0],xyz_list); 429 435 436 /*Retrieve all inputs we will be needing: */ 437 if(dim==2){ 438 vxaverage_input=tria->inputs->GetInput(VxEnum); 439 vyaverage_input=tria->inputs->GetInput(VyEnum); 440 } 441 430 442 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ 431 443 num_gauss=2; … … 443 455 444 456 //Get vx, vy and v.n 445 this->GetParameterValue(&vx,gauss_coord, VxAverageEnum);446 this->GetParameterValue(&vy,gauss_coord, VyAverageEnum);457 this->GetParameterValue(&vx,gauss_coord,vxaverage_input); 458 this->GetParameterValue(&vy,gauss_coord,vyaverage_input); 447 459 448 460 UdotN=vx*normal[0]+vy*normal[1]; … … 518 530 int dofs[1]={0}; 519 531 int found; 532 int dim; 520 533 521 534 /*dynamic objects pointed to by hooks: */ 522 535 Node** nodes=NULL; 536 Tria* tria=NULL; 537 Input* vxaverage_input=NULL; 538 Input* vyaverage_input=NULL; 523 539 524 540 /*Retrieve parameters: */ 525 541 this->parameters->FindParam(&analysis_type,AnalysisTypeEnum); 542 parameters->FindParam(&dim,DimEnum); 526 543 527 544 /*recover objects from hooks: */ 528 545 nodes=(Node**)hnodes->deliverp(); 546 tria=(Tria*)helement->delivers(); 529 547 530 548 /*recover parameters: */ … … 545 563 GetNormal(&normal[0],xyz_list); 546 564 565 /*Retrieve all inputs we will be needing: */ 566 if(dim==2){ 567 vxaverage_input=tria->inputs->GetInput(VxEnum); 568 vyaverage_input=tria->inputs->GetInput(VyEnum); 569 } 570 547 571 /*Check wether it is an inflow or outflow BC (0 is the middle of the segment)*/ 548 this->GetParameterValue(&mean_vx,0., VxAverageEnum);549 this->GetParameterValue(&mean_vy,0., VyAverageEnum);572 this->GetParameterValue(&mean_vx,0.,vxaverage_input); 573 this->GetParameterValue(&mean_vy,0.,vyaverage_input); 550 574 UdotN=mean_vx*normal[0]+mean_vy*normal[1]; 551 575 if (UdotN<=0){ … … 569 593 570 594 //Get vx, vy and v.n 571 this->GetParameterValue(&vx,gauss_coord, VxAverageEnum);572 this->GetParameterValue(&vy,gauss_coord, VyAverageEnum);595 this->GetParameterValue(&vx,gauss_coord,vxaverage_input); 596 this->GetParameterValue(&vy,gauss_coord,vyaverage_input); 573 597 574 598 UdotN=vx*normal[0]+vy*normal[1]; … … 645 669 int dofs[1]={0}; 646 670 int found; 671 int dim; 647 672 648 673 /*dynamic objects pointed to by hooks: */ 649 674 Node** nodes=NULL; 675 Tria* tria=NULL; 676 Input* vxaverage_input=NULL; 677 Input* vyaverage_input=NULL; 678 Input* thickness_input=NULL; 650 679 651 680 /*recover objects from hooks: */ 652 681 nodes=(Node**)hnodes->deliverp(); 682 tria=(Tria*)helement->delivers(); 653 683 654 684 /*Retrieve parameters: */ 655 685 this->parameters->FindParam(&analysis_type,AnalysisTypeEnum); 686 parameters->FindParam(&dim,DimEnum); 656 687 657 688 /*recover parameters: */ … … 667 698 } 668 699 700 /*Retrieve all inputs we will be needing: */ 701 if(dim==2){ 702 vxaverage_input=tria->inputs->GetInput(VxEnum); 703 vyaverage_input=tria->inputs->GetInput(VyEnum); 704 } 705 thickness_input=tria->inputs->GetInput(ThicknessEnum); 706 669 707 /* Get node coordinates, dof list and normal vector: */ 670 708 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); … … 673 711 674 712 /*Check wether it is an inflow or outflow BC (0 is the middle of the segment)*/ 675 this->GetParameterValue(&mean_vx,0., VxAverageEnum);676 this->GetParameterValue(&mean_vy,0., VyAverageEnum);713 this->GetParameterValue(&mean_vx,0.,vxaverage_input); 714 this->GetParameterValue(&mean_vy,0.,vyaverage_input); 677 715 UdotN=mean_vx*normal[0]+mean_vy*normal[1]; 678 716 if (UdotN>0){ … … 696 734 697 735 //Get vx, vy and v.n 698 this->GetParameterValue(&vx,gauss_coord, VxAverageEnum);699 this->GetParameterValue(&vy,gauss_coord, VyAverageEnum);700 this->GetParameterValue(&thickness,gauss_coord, ThicknessEnum);736 this->GetParameterValue(&vx,gauss_coord,vxaverage_input); 737 this->GetParameterValue(&vy,gauss_coord,vyaverage_input); 738 this->GetParameterValue(&thickness,gauss_coord,thickness_input); 701 739 702 740 UdotN=vx*normal[0]+vy*normal[1]; … … 846 884 847 885 /*output: */ 848 double value1,value2,value; 849 int type; 886 double value; 850 887 851 888 /*dynamic objects pointed to by hooks: */ … … 853 890 Node** nodes=NULL; 854 891 855 /*recover type: */856 inputs->GetParameterValue(&type,TypeEnum);857 858 859 892 /*recover objects from hooks: */ 860 893 tria=(Tria*)helement->delivers(); … … 868 901 } 869 902 /*}}}*/ 903 /*FUNCTION Numericalflux::GetParameterValue {{{1*/ 904 void Numericalflux::GetParameterValue(double* pvalue, double gauss_coord,Input* input_in){ 905 906 /*output: */ 907 double value; 908 909 /*dynamic objects pointed to by hooks: */ 910 Tria* tria=NULL; 911 Node** nodes=NULL; 912 913 /*recover objects from hooks: */ 914 tria=(Tria*)helement->delivers(); 915 nodes=(Node**)hnodes->deliverp(); 916 917 /*Get value on Element 1*/ 918 tria->GetParameterValue(&value,nodes[0],nodes[1],gauss_coord,input_in); 919 920 /*Assign output pointers:*/ 921 *pvalue=value; 922 } 923 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Numericalflux.h
r4575 r4904 70 70 void GetNormal(double* normal,double xyz_list[4][3]); 71 71 void GetParameterValue(double* pvalue, double gauss_coord,int enumtype); 72 void GetParameterValue(double* pvalue, double gauss_coord,Input* input_in); 72 73 void CreateKMatrixInternal(Mat Kgg); 73 74 void CreateKMatrixBoundary(Mat Kgg);
Note:
See TracChangeset
for help on using the changeset viewer.