Changeset 350


Ignore:
Timestamp:
05/12/09 10:43:05 (16 years ago)
Author:
seroussi
Message:

added pressure comptute in sing and beam elements

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

Legend:

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

    r322 r350  
    565565
    566566#undef __FUNCT__
     567#define __FUNCT__ "Beam::GetParameterValue"
     568void Beam::GetParameterValue(double* pvalue, double* value_list,double gauss_coord){
     569
     570        double l1l2[2];
     571       
     572        GetNodalFunctions(&l1l2[0],gauss_coord);
     573
     574        *pvalue=l1l2[0]*value_list[0]+l1l2[1]*value_list[1];
     575}
     576
     577
     578#undef __FUNCT__
     579#define __FUNCT__ "Beam::GetNodalFunctions"
     580void Beam::GetNodalFunctions(double* l1l2, double gauss_coord){
     581       
     582        /*This routine returns the values of the nodal functions  at the gaussian point.*/
     583
     584        /*First nodal function: */
     585        l1l2[0]=.5*gauss_coord+.5;
     586
     587        /*Second nodal function: */
     588        l1l2[1]=-.5*gauss_coord+.5;
     589}
     590
     591#undef __FUNCT__
     592#define __FUNCT__ "Beam::GetJacobianDeterminant"
     593void Beam::GetJacobianDeterminant(double* pJdet,double* z_list, double gauss_coord){
     594
     595
     596        double Jdet;
     597
     598        Jdet=1.0/2.0*(z_list[1]-z_list[0]);
     599
     600        if(Jdet<0){
     601                throw ErrorException(__FUNCT__," negative jacobian determinant!");
     602        }
     603       
     604        *pJdet=Jdet;
     605}
     606
     607#undef __FUNCT__
    567608#define __FUNCT__ "Beam::ComputePressure"
    568609void  Beam::ComputePressure(Vec p_g){
    569         throw ErrorException(__FUNCT__," not supported yet!");
    570 }
    571 
    572 #undef __FUNCT__
    573 #define __FUNCT__ "Beam::GetParameterValue"
    574 void Beam::GetParameterValue(double* pvalue, double* value_list,double gauss_coord){
    575 
    576         double l1l2[2];
    577        
    578         GetNodalFunctions(&l1l2[0],gauss_coord);
    579 
    580         *pvalue=l1l2[0]*value_list[0]+l1l2[1]*value_list[1];
    581 }
    582 
    583 
    584 #undef __FUNCT__
    585 #define __FUNCT__ "Beam::GetNodalFunctions"
    586 void Beam::GetNodalFunctions(double* l1l2, double gauss_coord){
    587        
    588         /*This routine returns the values of the nodal functions  at the gaussian point.*/
    589 
    590         /*First nodal function: */
    591         l1l2[0]=.5*gauss_coord+.5;
    592 
    593         /*Second nodal function: */
    594         l1l2[1]=-.5*gauss_coord+.5;
    595 }
    596 
    597 #undef __FUNCT__
    598 #define __FUNCT__ "Beam::GetJacobianDeterminant"
    599 void Beam::GetJacobianDeterminant(double* pJdet,double* z_list, double gauss_coord){
    600 
    601 
    602         double Jdet;
    603 
    604         Jdet=1.0/2.0*(z_list[1]-z_list[0]);
    605 
    606         if(Jdet<0){
    607                 throw ErrorException(__FUNCT__," negative jacobian determinant!");
    608         }
    609        
    610         *pJdet=Jdet;
    611 }
    612 
     610
     611        int i;
     612        const int numgrids=2;
     613        int doflist[numgrids];
     614        double pressure[numgrids];
     615        double rho_ice,g;
     616        double xyz_list[numgrids][3];
     617
     618        /*Get node data: */
     619        GetElementNodeData( &xyz_list[0][0], nodes, numgrids);
     620       
     621        /*Get dof list on which we will plug the pressure values: */
     622        GetDofList1(&doflist[0]);
     623
     624        /*pressure is lithostatic: */
     625        rho_ice=matpar->GetRhoIce();
     626        g=matpar->GetG();
     627        for(i=0;i<numgrids;i++){
     628                pressure[i]=rho_ice*g*(s[i]-xyz_list[i][2]);
     629        }
     630       
     631        /*plug local pressure values into global pressure vector: */
     632        VecSetValues(p_g,numgrids,doflist,(const double*)pressure,INSERT_VALUES);
     633
     634}
     635
  • issm/trunk/src/c/objects/Penta.cpp

    r301 r350  
    17701770        double pressure[numgrids];
    17711771        double rho_ice,g;
    1772         double       xyz_list[numgrids][3];
     1772        double xyz_list[numgrids][3];
    17731773               
    17741774        /*Get node data: */
  • issm/trunk/src/c/objects/Sing.cpp

    r342 r350  
    460460#define __FUNCT__ "Sing::ComputePressure"
    461461void  Sing::ComputePressure(Vec p_g){
    462         throw ErrorException(__FUNCT__," not supported yet!");
    463 }
     462
     463        int i;
     464        const int numgrids=1;
     465        int doflist[numgrids];
     466        double pressure[numgrids];
     467        double rho_ice,g;
     468
     469        /*Get dof list on which we will plug the pressure values: */
     470        GetDofList1(&doflist[0]);
     471
     472        /*pressure is lithostatic: */
     473        rho_ice=matpar->GetRhoIce();
     474        g=matpar->GetG();
     475        pressure[0]=rho_ice*g*h;
     476       
     477        /*plug local pressure values into global pressure vector: */
     478        VecSetValues(p_g,numgrids,doflist,(const double*)pressure,INSERT_VALUES);
     479
     480}
Note: See TracChangeset for help on using the changeset viewer.