Changeset 600


Ignore:
Timestamp:
05/26/09 15:28:42 (16 years ago)
Author:
seroussi
Message:

added PVector in prognostic

Location:
issm/trunk/src/c/objects
Files:
2 edited

Legend:

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

    r595 r600  
    579579
    580580        /*recover extra inputs from users, at current convergence iteration: */
    581         found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes);
     581        found=inputs->Recover("velocity_average",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes);
    582582        if(!found)throw ErrorException(__FUNCT__," could not find velocity_average  in inputs!");
    583583
     
    728728}
    729729
     730#undef __FUNCT__
     731#define __FUNCT__ "Tria::CreatePVectorPrognostic"
     732void  Tria::CreatePVectorPrognostic(Vec pg ,void* vinputs,int analysis_type,int sub_analysis_type){
     733
     734
     735        /* local declarations */
     736        int             i,j;
     737
     738        /* node data: */
     739        const int    numgrids=3;
     740        const int    NDOF1=1;
     741        const int    numdof=NDOF1*numgrids;
     742        double       xyz_list[numgrids][3];
     743        int          doflist[numdof];
     744        int          numberofdofspernode;
     745       
     746        /* gaussian points: */
     747        int     num_gauss,ig;
     748        double* first_gauss_area_coord  =  NULL;
     749        double* second_gauss_area_coord =  NULL;
     750        double* third_gauss_area_coord  =  NULL;
     751        double* gauss_weights           =  NULL;
     752        double  gauss_weight;
     753        double  gauss_l1l2l3[3];
     754
     755        /* matrix */
     756        double pe_g[numgrids]={0.0};
     757        double L[numgrids];
     758        double Jdettria;
     759       
     760        /*input parameters for structural analysis (diagnostic): */
     761        double  accumulation_list[numgrids]={0.0};
     762        double  accumulation_g;
     763        double  melting_list[numgrids]={0.0};
     764        double  melting_g;
     765        double  thickness_list[numgrids]={0.0};
     766        double  thickness_g;
     767        double  dt;
     768        int     dofs[1]={1};
     769        int     found=0;
     770
     771        ParameterInputs* inputs=NULL;
     772
     773        /*recover pointers: */
     774        inputs=(ParameterInputs*)vinputs;
     775
     776        /*recover extra inputs from users, at current convergence iteration: */
     777        found=inputs->Recover("accumulation",&accumulation_list[0],1,dofs,numgrids,(void**)nodes);
     778        if(!found)throw ErrorException(__FUNCT__," could not find accumulation in inputs!");
     779        found=inputs->Recover("melting",&melting_list[0],1,dofs,numgrids,(void**)nodes);
     780        if(!found)throw ErrorException(__FUNCT__," could not find melting in inputs!");
     781        found=inputs->Recover("thickness",&thickness_list[0],1,dofs,numgrids,(void**)nodes);
     782        if(!found)throw ErrorException(__FUNCT__," could not find thickness in inputs!");
     783        found=inputs->Recover("dt",&dt);
     784        if(!found)throw ErrorException(__FUNCT__," could not find dt in inputs!");
     785
     786        /* Get node coordinates and dof list: */
     787        GetElementNodeData( &xyz_list[0][0], nodes, numgrids);
     788        GetDofList(&doflist[0],&numberofdofspernode);
     789
     790        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     791        GaussTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);
     792
     793        /* Start  looping on the number of gaussian points: */
     794        for (ig=0; ig<num_gauss; ig++){
     795                /*Pick up the gaussian point: */
     796                gauss_weight=*(gauss_weights+ig);
     797                gauss_l1l2l3[0]=*(first_gauss_area_coord+ig);
     798                gauss_l1l2l3[1]=*(second_gauss_area_coord+ig);
     799                gauss_l1l2l3[2]=*(third_gauss_area_coord+ig);
     800
     801                /* Get Jacobian determinant: */
     802                GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss_l1l2l3);
     803
     804                /*Get L matrix: */
     805                GetL(&L[0], &xyz_list[0][0], gauss_l1l2l3,numberofdofspernode);
     806
     807                /* Get accumulation, melting and thickness at gauss point */
     808                GetParameterValue(&accumulation_g, &accumulation_list[0],gauss_l1l2l3);
     809                GetParameterValue(&melting_g, &melting_list[0],gauss_l1l2l3);
     810                GetParameterValue(&thickness_g, &thickness_list[0],gauss_l1l2l3);
     811               
     812                /* Add value into pe_g: */
     813                for( i=0; i<numdof; i++) pe_g[i]+=Jdettria*gauss_weight*(thickness_g+dt*(accumulation_g-melting_g))*L[i];
     814               
     815        } // for (ig=0; ig<num_gauss; ig++)
     816
     817        /*Add pe_g to global matrix Kgg: */
     818        VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
     819
     820        cleanup_and_return:
     821        xfree((void**)&first_gauss_area_coord);
     822        xfree((void**)&second_gauss_area_coord);
     823        xfree((void**)&third_gauss_area_coord);
     824        xfree((void**)&gauss_weights);
     825
     826}
     827
    730828
    731829#undef __FUNCT__
     
    10001098               
    10011099                CreatePVectorSlopeCompute( pg,inputs,analysis_type,sub_analysis_type);
     1100        }
     1101        else if (analysis_type==PrognosticAnalysisEnum()){
     1102
     1103                CreatePVectorPrognostic( pg,inputs,analysis_type,sub_analysis_type);
    10021104        }
    10031105        else{
  • issm/trunk/src/c/objects/Tria.h

    r586 r600  
    115115                void  CreatePVectorThermalSheet( Vec pg, void* vinputs, int analysis_type,int sub_analysis_type);
    116116                void  CreateKMatrixPrognostic(Mat Kgg,void* vinputs,int analysis_type,int sub_analysis_type);
     117                void  CreatePVectorPrognostic(Vec pg,void* vinputs,int analysis_type,int sub_analysis_type);
    117118
    118119
Note: See TracChangeset for help on using the changeset viewer.