Changeset 5933
- Timestamp:
- 09/21/10 16:56:47 (15 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r5932 r5933 752 752 case DiagnosticHorizAnalysisEnum: 753 753 pe=CreatePVectorDiagnosticHoriz(); 754 if(pe) pe->AddToGlobal(pg,pf);755 if(pe) delete pe;756 754 break; 757 755 case AdjointHorizAnalysisEnum: 758 756 pe=CreatePVectorAdjointHoriz(); 759 if(pe) pe->AddToGlobal(pg,pf);760 if(pe) delete pe;761 757 break; 762 758 case DiagnosticHutterAnalysisEnum: 763 759 pe=CreatePVectorDiagnosticHutter(); 764 if(pe) pe->AddToGlobal(pg,pf);765 if(pe) delete pe;766 760 break; 767 761 case DiagnosticVertAnalysisEnum: 768 CreatePVectorDiagnosticVert( pg);762 pe=CreatePVectorDiagnosticVert(); 769 763 break; 770 764 case BedSlopeXAnalysisEnum: case SurfaceSlopeXAnalysisEnum: case BedSlopeYAnalysisEnum: case SurfaceSlopeYAnalysisEnum: 771 765 pe=CreatePVectorSlope(); 772 if(pe) pe->AddToGlobal(pg,pf);773 if(pe) delete pe;774 766 break; 775 767 case PrognosticAnalysisEnum: 776 768 pe=CreatePVectorPrognostic(); 777 if(pe) pe->AddToGlobal(pg,pf);778 if(pe) delete pe;779 769 break; 780 770 case BalancedthicknessAnalysisEnum: 781 771 pe=CreatePVectorBalancedthickness(); 782 if(pe) pe->AddToGlobal(pg,pf);783 if(pe) delete pe;784 772 break; 785 773 case BalancedvelocitiesAnalysisEnum: 786 774 pe=CreatePVectorBalancedvelocities(); 787 if(pe) pe->AddToGlobal(pg,pf);788 if(pe) delete pe;789 775 break; 790 776 case ThermalAnalysisEnum: 791 777 pe=CreatePVectorThermal(); 792 if(pe) pe->AddToGlobal(pg,pf);793 if(pe) delete pe;794 778 break; 795 779 case MeltingAnalysisEnum: 796 780 pe=CreatePVectorMelting(); 797 if(pe) pe->AddToGlobal(pg,pf);798 if(pe) delete pe;799 781 break; 800 782 default: … … 802 784 } 803 785 786 /*Add to global Vector*/ 787 if(pe){ 788 pe->AddToGlobal(pg,pf); 789 delete pe; 790 } 804 791 } 805 792 /*}}}*/ … … 3058 3045 ElementVector* Penta::CreatePVectorCouplingPattynStokes(void){ 3059 3046 3060 /*compute all load vectors for this element*/3047 /*compute all load vectors for this element*/ 3061 3048 ElementVector* pe1=CreatePVectorCouplingPattynStokesViscous(); 3062 3049 ElementVector* pe2=CreatePVectorCouplingPattynStokesFriction(); … … 3253 3240 ElementVector* Penta::CreatePVectorDiagnosticMacAyealPattyn(void){ 3254 3241 3255 /*compute all load vectors for this element*/3242 /*compute all load vectors for this element*/ 3256 3243 ElementVector* pe1=CreatePVectorDiagnosticMacAyeal(); 3257 3244 ElementVector* pe2=CreatePVectorDiagnosticPattyn(); … … 3267 3254 ElementVector* Penta::CreatePVectorDiagnosticPattynStokes(void){ 3268 3255 3269 /*compute all load vectors for this element*/3256 /*compute all load vectors for this element*/ 3270 3257 ElementVector* pe1=CreatePVectorDiagnosticPattyn(); 3271 3258 ElementVector* pe2=CreatePVectorDiagnosticStokes(); … … 3435 3422 ElementVector* Penta::CreatePVectorDiagnosticStokes(void){ 3436 3423 3437 /*compute all load vectors for this element*/3424 /*compute all load vectors for this element*/ 3438 3425 ElementVector* pe1=CreatePVectorDiagnosticStokesViscous(); 3439 3426 ElementVector* pe2=CreatePVectorDiagnosticStokesShelf(); … … 3642 3629 /*}}}*/ 3643 3630 /*FUNCTION Penta::CreatePVectorDiagnosticVert {{{1*/ 3644 void Penta::CreatePVectorDiagnosticVert( Vec pg){ 3645 3646 int i; 3647 3648 /* node data: */ 3631 ElementVector* Penta::CreatePVectorDiagnosticVert(void){ 3632 3633 /*compute all load vectors for this element*/ 3634 ElementVector* pe1=CreatePVectorDiagnosticVertVolume(); 3635 ElementVector* pe2=CreatePVectorDiagnosticVertBase(); 3636 ElementVector* pe =new ElementVector(pe1,pe2); 3637 3638 /*clean-up and return*/ 3639 delete pe1; 3640 delete pe2; 3641 return pe; 3642 } 3643 /*}}}*/ 3644 /*FUNCTION Penta::CreatePVectorDiagnosticVertVolume {{{1*/ 3645 ElementVector* Penta::CreatePVectorDiagnosticVertVolume(void){ 3646 3649 3647 const int numdof=NDOF1*NUMVERTICES; 3650 3648 double xyz_list[NUMVERTICES][3]; 3651 3649 int* doflist=NULL; 3652 3653 /* gaussian points: */ 3650 int i; 3654 3651 int ig; 3655 3652 GaussPenta *gauss=NULL; 3656 3657 /* Jacobian: */3658 3653 double Jdet; 3659 3660 /*element vector at the gaussian points: */3661 double pe_g[numdof]={0.0};3662 double pe_g_gaussian[numdof];3663 3654 double l1l6[6]; 3664 3665 /*Spawning: */3666 3655 Tria* tria=NULL; 3667 3668 /*input parameters for structural analysis (diagnostic): */3669 3656 double du[3]; 3670 3657 double dv[3]; 3671 3658 double dw[3]; 3672 3659 double dudx,dvdy,dwdz; 3673 3674 /*Get some parameters*/3675 3660 int approximation; 3676 3661 3677 /*If on water, skip: */ 3678 if(IsOnWater())return; 3662 /*Initialize Element vector and return if necessary*/ 3663 if(IsOnWater()) return NULL; 3664 ElementVector* pe=NewElementVector(nodes,NUMVERTICES,this->parameters); 3665 3666 /*Retrieve all inputs and parameters*/ 3667 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3679 3668 inputs->GetParameterValue(&approximation,ApproximationEnum); 3680 3681 /*If we are on the bedrock, spawn a tria on the bedrock, and use it to build the3682 *diagnostic base vertical stifness: */3683 if(IsOnBed()){3684 tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 are on the bedrock3685 tria->CreatePVectorDiagnosticBaseVert(pg);3686 delete tria->matice; delete tria;3687 }3688 3689 /*Now, handle the standard penta element: */3690 /* Get node coordinates and dof list: */3691 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);3692 GetDofList(&doflist,NoneApproximationEnum,GsetEnum);3693 3694 /*Retrieve all inputs we will be needing: */3695 3669 Input* vx_input=inputs->GetInput(VxEnum); ISSMASSERT(vx_input); 3696 3670 Input* vy_input=inputs->GetInput(VyEnum); ISSMASSERT(vy_input); … … 3706 3680 gauss->GaussPoint(ig); 3707 3681 3708 /*Get velocity derivative, with respect to x and y: */3709 3682 vx_input->GetParameterDerivativeValue(&du[0],&xyz_list[0][0],gauss); 3710 3683 vy_input->GetParameterDerivativeValue(&dv[0],&xyz_list[0][0],gauss); … … 3717 3690 dvdy=dv[1]; 3718 3691 3719 /* Get Jacobian determinant: */3720 3692 GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss); 3721 3722 /*Get nodal functions: */3723 3693 GetNodalFunctionsP1(l1l6, gauss); 3724 3694 3725 /*Build pe_g_gaussian vector: */ 3726 for (i=0;i<NUMVERTICES;i++){ 3727 pe_g_gaussian[i]=(dudx+dvdy+dwdz)*Jdet*gauss->weight*l1l6[i]; 3728 } 3729 3730 /*Add pe_g_gaussian vector to pe_g: */ 3731 for( i=0; i<numdof; i++)pe_g[i]+=pe_g_gaussian[i]; 3732 } 3733 3734 /*Add pe_g to global vector pg: */ 3735 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 3736 3737 xfree((void**)&doflist); 3695 for (i=0;i<numdof;i++) pe->values[i] += (dudx+dvdy+dwdz)*Jdet*gauss->weight*l1l6[i]; 3696 } 3697 3698 /*Clean up and return*/ 3738 3699 delete gauss; 3700 return pe; 3701 } 3702 /*}}}*/ 3703 /*FUNCTION Penta::CreatePVectorDiagnosticVertBase {{{1*/ 3704 ElementVector* Penta::CreatePVectorDiagnosticVertBase(void){ 3705 3706 if (!IsOnBed() || IsOnWater()) return NULL; 3707 3708 /*Call Tria function*/ 3709 Tria* tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. 3710 ElementVector* pe=tria->CreatePVectorDiagnosticBaseVert(); 3711 delete tria->matice; delete tria; 3712 3713 /*Clean up and return*/ 3714 return pe; 3739 3715 } 3740 3716 /*}}}*/ … … 3783 3759 ElementVector* Penta::CreatePVectorThermal(void){ 3784 3760 3785 /*compute all load vectors for this element*/3761 /*compute all load vectors for this element*/ 3786 3762 ElementVector* pe1=CreatePVectorThermalVolume(); 3787 3763 ElementVector* pe2=CreatePVectorThermalSheet(); -
issm/trunk/src/c/objects/Elements/Penta.h
r5932 r5933 168 168 ElementVector* CreatePVectorDiagnosticStokesShelf(void); 169 169 ElementVector* CreatePVectorAdjointStokes(void); 170 void CreatePVectorDiagnosticVert( Vec pg); 170 ElementVector* CreatePVectorDiagnosticVert(void); 171 ElementVector* CreatePVectorDiagnosticVertVolume(void); 172 ElementVector* CreatePVectorDiagnosticVertBase(void); 171 173 ElementVector* CreatePVectorMelting(void); 172 174 ElementVector* CreatePVectorPrognostic(void); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r5932 r5933 3595 3595 /*}}}*/ 3596 3596 /*FUNCTION Tria::CreatePVectorDiagnosticBaseVert {{{1*/ 3597 void Tria::CreatePVectorDiagnosticBaseVert(Vec pg){3597 ElementVector* Tria::CreatePVectorDiagnosticBaseVert(void){ 3598 3598 3599 3599 /*Constants*/ … … 3603 3603 int i,j,ig; 3604 3604 int approximation; 3605 int* doflist=NULL;3606 3605 double xyz_list[NUMVERTICES][3]; 3607 3606 double Jdet; … … 3609 3608 double slope[2]; 3610 3609 double L[NUMVERTICES]; 3611 double pe_g[numdof]={0.0};3612 double pe_g_gaussian[numdof];3613 3610 GaussTria* gauss=NULL; 3614 3611 3615 /* Get node coordinates and dof list: */ 3612 /*Initialize Element vector and return if necessary*/ 3613 if(IsOnWater()) return NULL; 3614 ElementVector* pe=NewElementVector(nodes,NUMVERTICES,this->parameters); 3615 3616 /*Retrieve all inputs and parameters*/ 3616 3617 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3617 GetDofList(&doflist,NoneApproximationEnum,GsetEnum);3618 3619 /*Retrieve all inputs we will be needing: */3620 3618 inputs->GetParameterValue(&approximation,ApproximationEnum); 3621 3619 Input* bed_input=inputs->GetInput(BedEnum); ISSMASSERT(bed_input); … … 3649 3647 GetL(&L[0], &xyz_list[0][0], gauss,NDOF1); 3650 3648 3651 for(i=0;i<NUMVERTICES;i++){ 3652 pe_g_gaussian[i]=-Jdet*gauss->weight*(vx*dbdx+vy*dbdy-vz-meltingvalue)*L[i]; 3653 } 3654 3655 for( i=0; i<numdof; i++)pe_g[i]+=pe_g_gaussian[i]; 3656 } 3657 3658 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 3649 for(i=0;i<numdof;i++) pe->values[i]+=-Jdet*gauss->weight*(vx*dbdx+vy*dbdy-vz-meltingvalue)*L[i]; 3650 } 3659 3651 3660 3652 /*Clean up and return*/ 3661 3653 delete gauss; 3662 xfree((void**)&doflist);3654 return pe; 3663 3655 } 3664 3656 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Tria.h
r5932 r5933 142 142 ElementVector* CreatePVectorBalancedthickness_CG(void); 143 143 ElementVector* CreatePVectorBalancedvelocities(void); 144 void CreatePVectorDiagnosticBaseVert(Vec pg);144 ElementVector* CreatePVectorDiagnosticBaseVert(void); 145 145 ElementVector* CreatePVectorDiagnosticMacAyeal(void); 146 146 ElementVector* CreatePVectorAdjointHoriz(void);
Note:
See TracChangeset
for help on using the changeset viewer.