Changeset 5910


Ignore:
Timestamp:
09/20/10 15:14:23 (15 years ago)
Author:
seroussi
Message:

clean tria

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r5909 r5910  
    24052405ElementMatrix* Tria::CreateKMatrixBalancedthickness_CG(void){
    24062406
     2407
    24072408        /*Constants*/
    24082409        const int    numdof=NDOF1*NUMVERTICES;
     
    33993400ElementMatrix* Tria::CreateKMatrixThermal(void){
    34003401
     3402        /*Constants*/
    34013403        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};
    34103415        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;
    34183416
    34193417        /*Initialize Element matrix and return if necessary*/
     
    34363434                gauss->GaussPoint(ig);
    34373435               
     3436                GetJacobianDeterminant3d(&Jdet, &xyz_list[0][0], gauss);
    34383437                GetNodalFunctions(&l1l2l3[0], gauss);
    34393438                               
    3440                 GetJacobianDeterminant3d(&Jdet, &xyz_list[0][0], gauss);
    34413439                D_scalar=gauss->weight*Jdet*rho_water*mixed_layer_capacity*thermal_exchange_velocity/(heatcapacity*rho_ice);
    34423440                if(dt) D_scalar=dt*D_scalar;
     
    36643662void Tria::CreatePVectorDiagnosticMacAyeal( Vec pg, Vec pf){
    36653663
    3666         int             i,j,ig;
    3667 
    3668         /* node data: */
     3664        /*Constants*/
    36693665        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;
    36863677        ElementVector* pe=NULL;
    36873678
    3688         /*retrieve inputs :*/
     3679        /*First, if we are on water, return empty vector: */
     3680        if(IsOnWater()) return;
     3681
     3682        /*Retrieve all Inputs and parameters: */
    36893683        inputs->GetParameterValue(&drag_type,DragTypeEnum);
    36903684        Input* thickness_input=inputs->GetInput(ThicknessEnum); ISSMASSERT(thickness_input);
     
    36923686        Input* drag_input=inputs->GetInput(DragCoefficientEnum);ISSMASSERT(drag_input);
    36933687
    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: */
    36983689        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
    36993690
     
    37033694
    37043695                gauss->GaussPoint(ig);
     3696
     3697                GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);
     3698                GetNodalFunctions(l1l2l3, gauss);
    37053699
    37063700                thickness_input->GetParameterValue(&thickness,gauss);
     
    37093703                /*In case we have plastic basal drag, compute plastic stress at gaussian point from k1, k2 and k3 fields in the
    37103704                 * 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
    37223707                driving_stress_baseline=matpar->GetRhoIce()*matpar->GetG()*thickness;
    37233708
     
    37383723                }
    37393724
    3740                 /*Add pe_g_gaussian vector to pe_g: */
    37413725                for( i=0; i<numdof; i++)pe_g[i]+=pe_g_gaussian[i];
    3742 
    3743         }
    3744 
    3745         /*Initialize element vector: */
     3726        }
     3727
    37463728        pe=NewElementVector(nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum);
    3747 
    3748         /*Add pe_g values to pe element stifness load: */
    37493729        pe->AddValues(&pe_g[0]);
    3750 
    3751         /*Add pe element load vector to global load vector: */
    37523730        pe->AddToGlobal(pg,pf);
    37533731
    37543732        /*Free ressources:*/
    37553733        delete pe;
    3756 
    3757         /*Free ressources:*/
    37583734        delete gauss;
    37593735
     
    37643740void Tria::CreatePVectorAdjointBalancedthickness(Vec p_g){
    37653741
    3766         int i;
    3767 
    3768         /* node data: */
     3742        /*Constants*/
    37693743        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};
    37753754        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];
    37893755
    37903756        /* Get node coordinates and dof list: */
     
    37923758        GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
    37933759
    3794         /*Retrieve all inputs we will be needing: */
     3760        /*Retrieve all Inputs and parameters: */
    37953761        Input* thickness_input   =inputs->GetInput(ThicknessEnum);   ISSMASSERT(thickness_input);
    37963762        Input* thicknessobs_input=inputs->GetInput(ThicknessObsEnum);ISSMASSERT(thicknessobs_input);
     
    38033769                gauss->GaussPoint(ig);
    38043770
    3805                 /* Get Jacobian determinant: */
    38063771                GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);
    3807 
    3808                 /* Get nodal functions value at gaussian point:*/
    38093772                GetNodalFunctions(l1l2l3, gauss);
    38103773
    3811                 /*Get parameters at gauss point*/
    38123774                thickness_input->GetParameterValue(&thickness, gauss);
    38133775                thicknessobs_input->GetParameterValue(&thicknessobs, gauss);
     
    38193781
    38203782                /*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
    38273786        VecSetValues(p_g,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    38283787
Note: See TracChangeset for help on using the changeset viewer.