Changeset 5910
- Timestamp:
- 09/20/10 15:14:23 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Tria.cpp
r5909 r5910 2405 2405 ElementMatrix* Tria::CreateKMatrixBalancedthickness_CG(void){ 2406 2406 2407 2407 2408 /*Constants*/ 2408 2409 const int numdof=NDOF1*NUMVERTICES; … … 3399 3400 ElementMatrix* Tria::CreateKMatrixThermal(void){ 3400 3401 3402 /*Constants*/ 3401 3403 const int numdof=NDOF1*NUMVERTICES; 3402 int i,j; 3403 int ig; 3404 double xyz_list[NUMVERTICES][3]; 3405 double mixed_layer_capacity; 3406 double thermal_exchange_velocity; 3407 double rho_water; 3408 double rho_ice; 3409 double heatcapacity; 3404 3405 /*Intermediaries */ 3406 int i,j,ig; 3407 double mixed_layer_capacity,thermal_exchange_velocity; 3408 double rho_ice,rho_water,heatcapacity; 3409 double Jdet,dt; 3410 double xyz_list[NUMVERTICES][3]; 3411 double l1l2l3[NUMVERTICES]; 3412 double tl1l2l3D[3]; 3413 double D_scalar; 3414 double Ke_gaussian[numdof][numdof]={0.0}; 3410 3415 GaussTria *gauss=NULL; 3411 double Jdet;3412 double K_terms[numdof][numdof]={0.0};3413 double Ke_gaussian[numdof][numdof]={0.0};3414 double l1l2l3[NUMVERTICES];3415 double tl1l2l3D[3];3416 double D_scalar;3417 double dt;3418 3416 3419 3417 /*Initialize Element matrix and return if necessary*/ … … 3436 3434 gauss->GaussPoint(ig); 3437 3435 3436 GetJacobianDeterminant3d(&Jdet, &xyz_list[0][0], gauss); 3438 3437 GetNodalFunctions(&l1l2l3[0], gauss); 3439 3438 3440 GetJacobianDeterminant3d(&Jdet, &xyz_list[0][0], gauss);3441 3439 D_scalar=gauss->weight*Jdet*rho_water*mixed_layer_capacity*thermal_exchange_velocity/(heatcapacity*rho_ice); 3442 3440 if(dt) D_scalar=dt*D_scalar; … … 3664 3662 void Tria::CreatePVectorDiagnosticMacAyeal( Vec pg, Vec pf){ 3665 3663 3666 int i,j,ig; 3667 3668 /* node data: */ 3664 /*Constants*/ 3669 3665 const int numdof=NDOF2*NUMVERTICES; 3670 double xyz_list[NUMVERTICES][3]; 3671 3672 /* parameters: */ 3673 double plastic_stress; 3674 double slope[2]; 3675 double driving_stress_baseline; 3676 GaussTria* gauss=NULL; 3677 3678 double Jdet; 3679 double l1l2l3[3]; 3680 double pe_g[numdof]={0.0}; 3681 double pe_g_gaussian[numdof]; 3682 double thickness; 3683 int drag_type; 3684 3685 /*intermediary: */ 3666 3667 /*Intermediaries */ 3668 int i,j,ig,drag_type; 3669 double plastic_stress,driving_stress_baseline,thickness; 3670 double Jdet; 3671 double xyz_list[NUMVERTICES][3]; 3672 double slope[2]; 3673 double l1l2l3[3]; 3674 double pe_g[numdof]={0.0}; 3675 double pe_g_gaussian[numdof]; 3676 GaussTria* gauss=NULL; 3686 3677 ElementVector* pe=NULL; 3687 3678 3688 /*retrieve inputs :*/ 3679 /*First, if we are on water, return empty vector: */ 3680 if(IsOnWater()) return; 3681 3682 /*Retrieve all Inputs and parameters: */ 3689 3683 inputs->GetParameterValue(&drag_type,DragTypeEnum); 3690 3684 Input* thickness_input=inputs->GetInput(ThicknessEnum); ISSMASSERT(thickness_input); … … 3692 3686 Input* drag_input=inputs->GetInput(DragCoefficientEnum);ISSMASSERT(drag_input); 3693 3687 3694 /*First, if we are on water, return empty vector: */ 3695 if(IsOnWater()) return; 3696 3697 /* Get node coordinates and dof list: */ 3688 /*Get node coordinates and dof list: */ 3698 3689 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3699 3690 … … 3703 3694 3704 3695 gauss->GaussPoint(ig); 3696 3697 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 3698 GetNodalFunctions(l1l2l3, gauss); 3705 3699 3706 3700 thickness_input->GetParameterValue(&thickness,gauss); … … 3709 3703 /*In case we have plastic basal drag, compute plastic stress at gaussian point from k1, k2 and k3 fields in the 3710 3704 * element itself: */ 3711 if(drag_type==1){ 3712 drag_input->GetParameterValue(&plastic_stress,gauss); 3713 } 3714 3715 /* Get Jacobian determinant: */ 3716 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 3717 3718 /*Get nodal functions: */ 3719 GetNodalFunctions(l1l2l3, gauss); 3720 3721 /*Compute driving stress: */ 3705 if(drag_type==1) drag_input->GetParameterValue(&plastic_stress,gauss); 3706 3722 3707 driving_stress_baseline=matpar->GetRhoIce()*matpar->GetG()*thickness; 3723 3708 … … 3738 3723 } 3739 3724 3740 /*Add pe_g_gaussian vector to pe_g: */3741 3725 for( i=0; i<numdof; i++)pe_g[i]+=pe_g_gaussian[i]; 3742 3743 } 3744 3745 /*Initialize element vector: */ 3726 } 3727 3746 3728 pe=NewElementVector(nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum); 3747 3748 /*Add pe_g values to pe element stifness load: */3749 3729 pe->AddValues(&pe_g[0]); 3750 3751 /*Add pe element load vector to global load vector: */3752 3730 pe->AddToGlobal(pg,pf); 3753 3731 3754 3732 /*Free ressources:*/ 3755 3733 delete pe; 3756 3757 /*Free ressources:*/3758 3734 delete gauss; 3759 3735 … … 3764 3740 void Tria::CreatePVectorAdjointBalancedthickness(Vec p_g){ 3765 3741 3766 int i; 3767 3768 /* node data: */ 3742 /*Constants*/ 3769 3743 const int numdof=1*NUMVERTICES; 3770 double xyz_list[NUMVERTICES][3]; 3771 int* doflist=NULL; 3772 3773 /* gaussian points: */ 3774 int ig; 3744 3745 /*Intermediaries */ 3746 int i,ig; 3747 int* doflist=NULL; 3748 double Jdet; 3749 double thickness,thicknessobs,weight; 3750 double xyz_list[NUMVERTICES][3]; 3751 double l1l2l3[3]; 3752 double pe_g_gaussian[numdof]; 3753 double pe_g[numdof] ={0.0}; 3775 3754 GaussTria* gauss=NULL; 3776 3777 /* parameters: */3778 double thickness,thicknessobs,weight;3779 3780 /*element vector : */3781 double pe_g[numdof]={0.0};3782 double pe_g_gaussian[numdof];3783 3784 /* Jacobian: */3785 double Jdet;3786 3787 /*nodal functions: */3788 double l1l2l3[3];3789 3755 3790 3756 /* Get node coordinates and dof list: */ … … 3792 3758 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 3793 3759 3794 /*Retrieve all inputs we will be needing: */3760 /*Retrieve all Inputs and parameters: */ 3795 3761 Input* thickness_input =inputs->GetInput(ThicknessEnum); ISSMASSERT(thickness_input); 3796 3762 Input* thicknessobs_input=inputs->GetInput(ThicknessObsEnum);ISSMASSERT(thicknessobs_input); … … 3803 3769 gauss->GaussPoint(ig); 3804 3770 3805 /* Get Jacobian determinant: */3806 3771 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 3807 3808 /* Get nodal functions value at gaussian point:*/3809 3772 GetNodalFunctions(l1l2l3, gauss); 3810 3773 3811 /*Get parameters at gauss point*/3812 3774 thickness_input->GetParameterValue(&thickness, gauss); 3813 3775 thicknessobs_input->GetParameterValue(&thicknessobs, gauss); … … 3819 3781 3820 3782 /*Add pe_g_gaussian vector to pe_g: */ 3821 for( i=0; i<numdof; i++){ 3822 pe_g[i]+=pe_g_gaussian[i]; 3823 } 3824 } 3825 3826 /*Add pe_g to global vector p_g: */ 3783 for(i=0; i<numdof;i++) pe_g[i]+=pe_g_gaussian[i]; 3784 } 3785 3827 3786 VecSetValues(p_g,numdof,doflist,(const double*)pe_g,ADD_VALUES); 3828 3787
Note:
See TracChangeset
for help on using the changeset viewer.