Changeset 17411


Ignore:
Timestamp:
03/11/14 16:45:19 (11 years ago)
Author:
seroussi
Message:

NEW: added ice shelf dampening for FS

Location:
issm/trunk-jpl/src/c/analyses
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp

    r17394 r17411  
    77#include "../cores/cores.h"
    88
    9 //#define FSANALYTICAL 4
     9//#define FSANALYTICAL 10
    1010
    1111/*Model processing*/
     
    28102810        ElementMatrix* Ke1=CreateKMatrixFSViscous(element);
    28112811        ElementMatrix* Ke2=CreateKMatrixFSFriction(element);
    2812         ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
     2812        ElementMatrix* Ke3=CreateKMatrixFSShelf(element);
     2813        ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
    28132814
    28142815        /*clean-up and return*/
    28152816        delete Ke1;
    28162817        delete Ke2;
     2818        delete Ke3;
    28172819        return Ke;
    28182820}/*}}}*/
     
    29792981        xDelete<IssmDouble>(B);
    29802982        xDelete<IssmDouble>(D);
     2983        return Ke;
     2984}/*}}}*/
     2985ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSShelf(Element* element){/*{{{*/
     2986
     2987        if(!element->IsFloating() || !element->IsOnBed()) return NULL;
     2988
     2989        /*If on not water or not FS, skip stiffness: */
     2990        int approximation,shelf_dampening;
     2991        element->GetInputValue(&approximation,ApproximationEnum);
     2992        if(approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum && approximation!=HOFSApproximationEnum) return NULL;
     2993        element->FindParam(&shelf_dampening,StressbalanceShelfDampeningEnum);
     2994        if(shelf_dampening==0) return NULL;
     2995
     2996        /*Intermediaries*/
     2997        bool        mainlyfloating;
     2998        int         j,i,meshtype,dim;
     2999        IssmDouble  Jdet,slope2,scalar,dt;
     3000        IssmDouble  slope[2];
     3001        IssmDouble *xyz_list_base = NULL;
     3002        Gauss*      gauss         = NULL;
     3003
     3004        /*Get problem dimension*/
     3005        element->FindParam(&meshtype,MeshTypeEnum);
     3006        switch(meshtype){
     3007                case Mesh2DverticalEnum: dim = 2;break;
     3008                case Mesh3DEnum:         dim = 3;break;
     3009                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
     3010        }
     3011
     3012        /*Fetch number of nodes and dof for this finite element*/
     3013        int vnumnodes = element->GetNumberOfNodesVelocity();
     3014        int pnumnodes = element->GetNumberOfNodesPressure();
     3015        int numdof    = vnumnodes*dim + pnumnodes;
     3016
     3017        /*Initialize Element matrix and vectors*/
     3018        ElementMatrix* Ke = element->NewElementMatrix(FSvelocityEnum);
     3019        IssmDouble*    vbasis = xNew<IssmDouble>(vnumnodes);
     3020
     3021        /*Retrieve all inputs and parameters*/
     3022        element->GetVerticesCoordinatesBase(&xyz_list_base);
     3023        element->FindParam(&dt,TimesteppingTimeStepEnum);
     3024        if(dt==0) dt=pow(10,5);
     3025        IssmDouble  rho_water =element->GetMaterialParameter(MaterialsRhoWaterEnum);
     3026        IssmDouble  gravity =element->GetMaterialParameter(ConstantsGEnum);
     3027        Input*      surface_input  = element->GetInput(SurfaceEnum); _assert_(surface_input);
     3028
     3029        /* Start  looping on the number of gaussian points: */
     3030        gauss=element->NewGaussBase(3);
     3031        for(int ig=gauss->begin();ig<gauss->end();ig++){
     3032                gauss->GaussPoint(ig);
     3033
     3034                surface_input->GetInputDerivativeValue(&slope[0],xyz_list_base,gauss);
     3035                element->NodalFunctionsVelocity(vbasis,gauss);
     3036                element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
     3037                if(dim==2) slope2=slope[0]*slope[0];
     3038                else if(dim==3) slope2=slope[0]*slope[0]+slope[1]*slope[1];
     3039                scalar  = rho_water*gravity*sqrt(1+slope2)*gauss->weight*Jdet*dt;
     3040                for(i=0;i<vnumnodes;i++){
     3041                        for(j=0;j<vnumnodes;j++){
     3042                                Ke->values[numdof*(i*dim+1)+j*dim+1] += scalar*vbasis[i]*vbasis[j];
     3043                        }
     3044                }
     3045        }
     3046
     3047        /*DO NOT Transform Coordinate System: this stiffness matrix is already expressed in tangential coordinates*/
     3048
     3049        /*Clean up and return*/
     3050        delete gauss;
     3051        xDelete<IssmDouble>(xyz_list_base);
     3052        xDelete<IssmDouble>(vbasis);
    29813053        return Ke;
    29823054}/*}}}*/
  • issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h

    r17297 r17411  
    6969                ElementMatrix* CreateKMatrixFSViscous(Element* element);
    7070                ElementMatrix* CreateKMatrixFSFriction(Element* element);
     71                ElementMatrix* CreateKMatrixFSShelf(Element* element);
    7172                ElementVector* CreatePVectorFS(Element* element);
    7273                ElementVector* CreatePVectorFSViscous(Element* element);
Note: See TracChangeset for help on using the changeset viewer.