Changeset 5880
- Timestamp:
- 09/17/10 17:42:40 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Tria.cpp
r5879 r5880 3467 3467 void Tria::CreatePVectorBalancedthickness_CG(Vec pg ){ 3468 3468 3469 /* local declarations */ 3470 int i,j; 3471 3472 /* node data: */ 3469 /*Constants*/ 3473 3470 const int numdof=NDOF1*NUMVERTICES; 3474 double xyz_list[NUMVERTICES][3]; 3475 int* doflist=NULL; 3476 int numberofdofspernode=1; 3477 3478 /* gaussian points: */ 3479 int ig; 3471 3472 /*Intermediaries */ 3473 int i,j,ig; 3474 int* doflist=NULL; 3475 double xyz_list[NUMVERTICES][3]; 3476 double dhdt_g,melting_g,accumulation_g,Jdettria; 3477 double L[NUMVERTICES]; 3478 double pe_g[NUMVERTICES] ={0.0}; 3480 3479 GaussTria* gauss=NULL; 3481 3482 /* matrix */3483 double pe_g[NUMVERTICES]={0.0};3484 double L[NUMVERTICES];3485 double Jdettria;3486 3487 /*input parameters for structural analysis (diagnostic): */3488 double accumulation_g;3489 double melting_g;3490 double dhdt_g;3491 3480 3492 3481 /* Get node coordinates and dof list: */ … … 3505 3494 gauss->GaussPoint(ig); 3506 3495 3507 /* Get Jacobian determinant: */3508 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss);3509 3510 /*Get L matrix: */3511 GetL(&L[0], &xyz_list[0][0], gauss,numberofdofspernode);3512 3513 /* Get accumulation, melting at gauss point */3514 3496 accumulation_input->GetParameterValue(&accumulation_g,gauss); 3515 3497 melting_input->GetParameterValue(&melting_g,gauss); 3516 3498 dhdt_input->GetParameterValue(&dhdt_g,gauss); 3517 3499 3518 /* Add value into pe_g: */ 3500 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 3501 GetL(&L[0], &xyz_list[0][0], gauss,NDOF1); 3502 3519 3503 for( i=0; i<numdof; i++) pe_g[i]+=Jdettria*gauss->weight*(accumulation_g-melting_g-dhdt_g)*L[i]; 3520 3521 } 3522 3523 /*Add pe_g to global matrix Kgg: */ 3504 } 3505 3524 3506 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 3525 3507 … … 3532 3514 void Tria::CreatePVectorBalancedthickness_DG(Vec pg){ 3533 3515 3534 /* local declarations */ 3535 int i,j; 3536 3537 /* node data: */ 3516 /*Constants*/ 3538 3517 const int numdof=NDOF1*NUMVERTICES; 3539 double xyz_list[NUMVERTICES][3]; 3540 int* doflist=NULL; 3541 int numberofdofspernode=1; 3542 3543 /* gaussian points: */ 3544 int ig; 3518 3519 /*Intermediaries */ 3520 int i,j,ig; 3521 int* doflist=NULL; 3522 double xyz_list[NUMVERTICES][3]; 3523 double melting_g,accumulation_g,dhdt_g,Jdettria; 3524 double L[NUMVERTICES]; 3525 double pe_g[NUMVERTICES] ={0.0}; 3545 3526 GaussTria* gauss=NULL; 3546 3547 /* matrix */3548 double pe_g[NUMVERTICES]={0.0};3549 double L[NUMVERTICES];3550 double Jdettria;3551 3552 /*input parameters for structural analysis (diagnostic): */3553 double accumulation_g;3554 double melting_g;3555 double dhdt_g;3556 3527 3557 3528 /* Get node coordinates and dof list: */ … … 3570 3541 gauss->GaussPoint(ig); 3571 3542 3572 /* Get Jacobian determinant: */3573 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss);3574 3575 /*Get L matrix: */3576 GetL(&L[0], &xyz_list[0][0], gauss,numberofdofspernode);3577 3578 /* Get accumulation, melting and thickness at gauss point */3579 3543 accumulation_input->GetParameterValue(&accumulation_g,gauss); 3580 3544 melting_input->GetParameterValue(&melting_g,gauss); 3581 3545 dhdt_input->GetParameterValue(&dhdt_g,gauss); 3582 3546 3583 /* Add value into pe_g: */3584 for( i=0; i<numdof; i++) pe_g[i]+=Jdettria*gauss->weight*(accumulation_g-melting_g-dhdt_g)*L[i];3585 3586 }3587 3588 /*Add pe_g to global matrix Kgg: */ 3547 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 3548 GetL(&L[0], &xyz_list[0][0], gauss,NDOF1); 3549 3550 for(i=0;i<numdof;i++) pe_g[i]+=Jdettria*gauss->weight*(accumulation_g-melting_g-dhdt_g)*L[i]; 3551 } 3552 3589 3553 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 3590 3554 … … 3642 3606 void Tria::CreatePVectorDiagnosticBaseVert(Vec pg){ 3643 3607 3644 int i,j; 3645 3646 /* node data: */ 3608 /*Constants*/ 3647 3609 const int numdof=NDOF1*NUMVERTICES; 3648 double xyz_list[NUMVERTICES][3]; 3649 int* doflist=NULL; 3650 3651 /* gaussian points: */ 3652 int ig; 3610 3611 /*Intermediaries */ 3612 int i,j,ig; 3613 int approximation; 3614 int* doflist=NULL; 3615 double xyz_list[NUMVERTICES][3]; 3616 double Jdet; 3617 double vx,vy,vz,dbdx,dbdy,meltingvalue; 3618 double slope[2]; 3619 double L[NUMVERTICES]; 3620 double pe_g[numdof]={0.0}; 3621 double pe_g_gaussian[numdof]; 3653 3622 GaussTria* gauss=NULL; 3654 3655 /* Jacobian: */3656 double Jdet;3657 3658 /*nodal functions: */3659 double l1l2l3[3];3660 3661 /*element vector at the gaussian points: */3662 double pe_g[numdof]={0.0};3663 double pe_g_gaussian[numdof];3664 3665 /* matrices: */3666 double L[NUMVERTICES];3667 3668 /*input parameters for structural analysis (diagnostic): */3669 double vx,vy,vz;3670 double meltingvalue;3671 double slope[2];3672 double dbdx,dbdy;3673 int approximation;3674 3623 3675 3624 /* Get node coordinates and dof list: */ … … 3679 3628 /*Retrieve all inputs we will be needing: */ 3680 3629 inputs->GetParameterValue(&approximation,ApproximationEnum); 3630 Input* bed_input=inputs->GetInput(BedEnum); ISSMASSERT(bed_input); 3681 3631 Input* melting_input=inputs->GetInput(MeltingRateEnum); ISSMASSERT(melting_input); 3682 3632 Input* vx_input=inputs->GetInput(VxEnum); ISSMASSERT(vx_input); … … 3686 3636 vzstokes_input=inputs->GetInput(VzStokesEnum); ISSMASSERT(vzstokes_input); 3687 3637 } 3688 Input* bed_input=inputs->GetInput(BedEnum); ISSMASSERT(bed_input); 3689 3690 /*For icesheets: */ 3638 3691 3639 /* Start looping on the number of gaussian points: */ 3692 3640 gauss=new GaussTria(2); … … 3695 3643 gauss->GaussPoint(ig); 3696 3644 3697 /*Get melting at gaussian point: */3698 3645 melting_input->GetParameterValue(&meltingvalue, gauss); 3699 3700 /*Get velocity at gaussian point: */ 3646 bed_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],gauss); 3701 3647 vx_input->GetParameterValue(&vx, gauss); 3702 3648 vy_input->GetParameterValue(&vy, gauss); … … 3706 3652 else vz=0; 3707 3653 3708 /*Get bed slope: */3709 bed_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],gauss);3710 3654 dbdx=slope[0]; 3711 3655 dbdy=slope[1]; 3712 3656 3713 /* Get Jacobian determinant: */3714 3657 GetJacobianDeterminant3d(&Jdet, &xyz_list[0][0],gauss); 3715 3716 //Get L matrix if viscous basal drag present:3717 3658 GetL(&L[0], &xyz_list[0][0], gauss,NDOF1); 3718 3659 3719 /*Build gaussian vector: */3720 3660 for(i=0;i<NUMVERTICES;i++){ 3721 3661 pe_g_gaussian[i]=-Jdet*gauss->weight*(vx*dbdx+vy*dbdy-vz-meltingvalue)*L[i]; 3722 3662 } 3723 3663 3724 /*Add pe_g_gaussian vector to pe_g: */3725 3664 for( i=0; i<numdof; i++)pe_g[i]+=pe_g_gaussian[i]; 3726 3727 } 3728 3729 /*Add pe_g to global vector pg: */ 3665 } 3666 3730 3667 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 3731 3668
Note:
See TracChangeset
for help on using the changeset viewer.