Changeset 16364


Ignore:
Timestamp:
10/10/13 10:00:54 (11 years ago)
Author:
Mathieu Morlighem
Message:

NEW: adding front to FS

Location:
issm/trunk-jpl/src/c/classes/Elements
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r16361 r16364  
    34563456        if(!isfront) return NULL;
    34573457
    3458         _error_("STOP");
     3458        /*Intermediaries*/
     3459        IssmDouble  rho_ice,rho_water,gravity,y_g;
     3460        IssmDouble  Jdet,water_pressure,air_pressure,pressure;
     3461        IssmDouble  xyz_list_front[2][3];
     3462        IssmDouble  area_coordinates[2][3];
     3463        IssmDouble  normal[2];
     3464        GaussTria*  gauss = NULL;
     3465
     3466        /*Fetch number of nodes and dof for this finite element*/
     3467        int vnumnodes = this->NumberofNodesVelocity();
     3468        int pnumnodes = this->NumberofNodesPressure();
     3469
     3470        /*Prepare coordinate system list*/
     3471        int* cs_list = xNew<int>(vnumnodes+pnumnodes);
     3472        for(i=0;i<vnumnodes;i++) cs_list[i]           = XYEnum;
     3473        for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
     3474
     3475        /*Initialize Element matrix and vectors*/
     3476        GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
     3477        ElementVector* pe     = new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum);
     3478        IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
     3479
     3480        /*Retrieve all inputs and parameters*/
     3481        rho_water = matpar->GetRhoWater();
     3482        gravity   = matpar->GetG();
     3483        GetZeroLevelsetCoordinates(&xyz_list_front[0][0],xyz_list,MaskIceLevelsetEnum);
     3484        GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
     3485        GetSegmentNormal(&normal[0],xyz_list_front);
     3486
     3487        /*Start looping on Gaussian points*/
     3488        IssmDouble ymax=max(xyz_list_front[0][1],xyz_list_front[1][1]);
     3489        IssmDouble ymin=min(xyz_list_front[0][1],xyz_list_front[1][1]);
     3490        if(ymax>0. && ymin<0.) gauss=new GaussTria(area_coordinates,30); //refined in vertical because of the sea level discontinuity
     3491        else                   gauss=new GaussTria(area_coordinates,3);
     3492
     3493        for(int ig=gauss->begin();ig<gauss->end();ig++){
     3494
     3495                gauss->GaussPoint(ig);
     3496                y_g=GetYcoord(gauss);
     3497                GetNodalFunctionsVelocity(vbasis,gauss);
     3498                GetSegmentJacobianDeterminant(&Jdet,&xyz_list_front[0][0],gauss);
     3499
     3500                water_pressure = rho_water*gravity*min(0.,y_g); //0 if the gaussian point is above water level
     3501                air_pressure   = 0.;
     3502                pressure       = water_pressure + air_pressure;
     3503
     3504                for(i=0;i<vnumnodes;i++){
     3505                        pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*vbasis[i];
     3506                        pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*vbasis[i];
     3507                }
     3508        }
     3509
     3510
     3511        /*Transform coordinate system*/
     3512        TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
     3513
     3514        /*Clean up and return*/
     3515        xDelete<int>(cs_list);
     3516        xDelete<IssmDouble>(vbasis);
     3517        delete gauss;
     3518        return pe;
     3519
    34593520}
    34603521/*}}}*/
     
    35793640        }
    35803641
     3642        pe->CheckConsistency();
    35813643        /*Transform coordinate system*/
    35823644        TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list);
     3645        pe->CheckConsistency();
    35833646
    35843647        /*Clean up and return*/
     
    39854048        delete gauss;
    39864049        xDelete<int>(doflist);
     4050}
     4051/*}}}*/
     4052/*FUNCTION Tria::GetYcoord {{{*/
     4053IssmDouble Tria::GetYcoord(GaussTria* gauss){
     4054
     4055        IssmDouble y;
     4056        IssmDouble xyz_list[NUMVERTICES][3];
     4057        IssmDouble y_list[NUMVERTICES];
     4058
     4059        GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
     4060        for(int i=0;i<NUMVERTICES;i++) y_list[i]=xyz_list[i][1];
     4061        TriaRef::GetInputValue(&y,&y_list[0],gauss,P1Enum);
     4062
     4063        return y;
    39874064}
    39884065/*}}}*/
  • issm/trunk-jpl/src/c/classes/Elements/Tria.h

    r16350 r16364  
    248248                ElementVector* CreatePVectorStressbalanceFSShelf(void);
    249249                ElementMatrix* CreateJacobianStressbalanceSSA(void);
    250                 void      GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solution);
    251                 void      GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solution);
    252                 void      GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solution);
    253                 void      InputUpdateFromSolutionStressbalanceHoriz( IssmDouble* solution);
    254                 void      InputUpdateFromSolutionStressbalanceFS( IssmDouble* solution);
    255                 void      InputUpdateFromSolutionStressbalanceSIA( IssmDouble* solution);
     250                void             GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solution);
     251                void             GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solution);
     252                void             GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solution);
     253                IssmDouble     GetYcoord(GaussTria* gauss);
     254                void             InputUpdateFromSolutionStressbalanceHoriz( IssmDouble* solution);
     255                void             InputUpdateFromSolutionStressbalanceFS( IssmDouble* solution);
     256                void             InputUpdateFromSolutionStressbalanceSIA( IssmDouble* solution);
    256257                #endif
    257258
  • issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp

    r16350 r16364  
    533533}
    534534/*}}}*/
    535 /*FUNCTION TriaRef::GetNodalFunctions{{{*/
     535/*FUNCTION TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss){{{*/
    536536void TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss){
    537537        /*This routine returns the values of the nodal functions  at the gaussian point.*/
    538538
    539539        _assert_(basis);
    540 
    541         switch(this->element_type){
     540        GetNodalFunctions(basis,gauss,this->element_type);
     541
     542}
     543/*}}}*/
     544/*FUNCTION TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss,int interpolation){{{*/
     545void TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss,int interpolation){
     546        /*This routine returns the values of the nodal functions  at the gaussian point.*/
     547
     548        _assert_(basis);
     549
     550        switch(interpolation){
    542551                case P1Enum: case P1DGEnum:
    543552                        basis[0]=gauss->coord1;
     
    867876}
    868877/*}}}*/
    869 /*FUNCTION TriaRef::GetInputValue{{{*/
     878/*FUNCTION TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss){{{*/
    870879void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss){
     880
     881        GetInputValue(p,plist,gauss,this->element_type);
     882}
     883/*}}}*/
     884/*FUNCTION TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss,int interpolation){{{*/
     885void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss,int interpolation){
    871886
    872887        /*Output*/
     
    874889
    875890        /*Fetch number of nodes for this finite element*/
    876         int numnodes = this->NumberofNodes();
     891        int numnodes = this->NumberofNodes(interpolation);
    877892
    878893        /*Get nodal functions*/
    879894        IssmDouble* basis=xNew<IssmDouble>(numnodes);
    880         GetNodalFunctions(basis, gauss);
     895        GetNodalFunctions(basis, gauss,interpolation);
    881896
    882897        /*Calculate parameter for this Gauss point*/
     
    888903}
    889904/*}}}*/
    890 /*FUNCTION TriaRef::NumberofNodes{{{*/
     905/*FUNCTION TriaRef::NumberofNodes(){{{*/
    891906int TriaRef::NumberofNodes(void){
    892907
    893         switch(this->element_type){
     908        return this->NumberofNodes(this->element_type);
     909}
     910/*}}}*/
     911/*FUNCTION TriaRef::NumberofNodes(int interpolation){{{*/
     912int TriaRef::NumberofNodes(int interpolation){
     913
     914        switch(interpolation){
    894915                case P1Enum:                return NUMNODESP1;
    895916                case P1DGEnum:              return NUMNODESP1;
  • issm/trunk-jpl/src/c/classes/Elements/TriaRef.h

    r16350 r16364  
    3838                void GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,GaussTria* gauss);
    3939                void GetNodalFunctions(IssmDouble* basis,GaussTria* gauss);
     40                void GetNodalFunctions(IssmDouble* basis,GaussTria* gauss,int interpolation);
    4041                void GetNodalFunctionsVelocity(IssmDouble* basis, GaussTria* gauss);
    4142                void GetNodalFunctionsPressure(IssmDouble* basis, GaussTria* gauss);
     
    4849                void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTria* gauss);
    4950                void GetInputValue(IssmDouble* pp, IssmDouble* plist, GaussTria* gauss);
     51                void GetInputValue(IssmDouble* pp, IssmDouble* plist, GaussTria* gauss,int interpolation);
    5052                void GetInputDerivativeValue(IssmDouble* pp, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss);
    5153
    5254                int  NumberofNodes(void);
     55                int  NumberofNodes(int interpolation);
    5356                int  NumberofNodesVelocity(void);
    5457                int  NumberofNodesPressure(void);
Note: See TracChangeset for help on using the changeset viewer.