Changeset 5810


Ignore:
Timestamp:
09/14/10 17:14:45 (15 years ago)
Author:
seroussi
Message:

added PVectorCouplingPattynStokes

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

Legend:

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

    r5808 r5810  
    809809                        CreatePVectorDiagnosticPattyn( pg);
    810810                        CreatePVectorDiagnosticStokes( pg);
    811                         //CreatePVectorDiagnosticPattynStokes( pg);
     811                        CreatePVectorCouplingPattynStokes( pg);
    812812                }
    813813                else ISSMERROR("Approximation %s not supported yet",EnumToString(approximation));
     
    31603160}
    31613161/*}}}*/
     3162/*FUNCTION Penta::CreatePVectorCouplingPattynStokes {{{1*/
     3163void Penta::CreatePVectorCouplingPattynStokes( Vec pg){
     3164
     3165        /*indexing: */
     3166        int i,j;
     3167        const int numdof=NUMVERTICES*NDOF4;
     3168        int*      doflist=NULL;
     3169
     3170        /*parameters: */
     3171        double             xyz_list_tria[NUMVERTICES2D][3];
     3172        double         xyz_list[NUMVERTICES][3];
     3173        double             bed_normal[3];
     3174
     3175        /* gaussian points: */
     3176        int     ig;
     3177        GaussPenta *gauss=NULL;
     3178
     3179        double  epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
     3180        double  viscosity, w, alpha2_gauss;
     3181        double  dw[3];
     3182
     3183        /*matrices: */
     3184        double     Pe_gaussian[24]={0.0}; //for the six nodes
     3185        double     l1l6[6]; //for the six nodes of the penta
     3186        double     dh1dh6[3][6]; //for the six nodes of the penta
     3187        double     Jdet;
     3188        double     Jdet2d;
     3189
     3190        Tria*     tria=NULL;
     3191        Friction* friction=NULL;
     3192
     3193        /*parameters: */
     3194        double stokesreconditioning;
     3195        int    approximation;
     3196        int    analysis_type;
     3197
     3198        /*retrieve inputs :*/
     3199        inputs->GetParameterValue(&approximation,ApproximationEnum);
     3200
     3201        /*retrieve some parameters: */
     3202        parameters->FindParam(&analysis_type,AnalysisTypeEnum);
     3203        this->parameters->FindParam(&stokesreconditioning,StokesReconditioningEnum);
     3204
     3205        /*If on water or not Stokes, skip load: */
     3206        if(IsOnWater() || approximation!=PattynStokesApproximationEnum) return;
     3207
     3208        /* Get node coordinates and dof list: */
     3209        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
     3210        GetDofList(&doflist,StokesApproximationEnum,GsetEnum);
     3211
     3212        /*Retrieve all inputs we will be needing: */
     3213        Input* vx_input=inputs->GetInput(VxEnum);               ISSMASSERT(vx_input);
     3214        Input* vy_input=inputs->GetInput(VyEnum);               ISSMASSERT(vy_input);
     3215        Input* vz_input=inputs->GetInput(VzEnum);               ISSMASSERT(vz_input);
     3216        Input* vzpattyn_input=inputs->GetInput(VzPattynEnum);   ISSMASSERT(vzpattyn_input);
     3217
     3218        /* Start  looping on the number of gaussian points: */
     3219        gauss=new GaussPenta(5,5);
     3220        for (ig=gauss->begin();ig<gauss->end();ig++){
     3221
     3222                gauss->GaussPoint(ig);
     3223
     3224                /*Compute strain rate and viscosity: */
     3225                this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
     3226                matice->GetViscosity3dStokes(&viscosity,&epsilon[0]);
     3227
     3228                /* Get Jacobian determinant: */
     3229                GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
     3230
     3231                /* Get nodal functions */
     3232                GetNodalFunctionsP1(&l1l6[0], gauss);
     3233                GetNodalFunctionsP1Derivatives(&dh1dh6[0][0],&xyz_list[0][0], gauss);
     3234
     3235                /*Compute the derivative of VzPattyn*/
     3236                vzpattyn_input->GetParameterDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
     3237
     3238                /* Build gaussian vector */
     3239                for(i=0;i<NUMVERTICES;i++){
     3240                        Pe_gaussian[i*NDOF4+0]+=-Jdet*gauss->weight*viscosity*dw[0]*dh1dh6[2][i]/2;
     3241                        Pe_gaussian[i*NDOF4+1]+=-Jdet*gauss->weight*viscosity*dw[1]*dh1dh6[2][i]/2;
     3242                        Pe_gaussian[i*NDOF4+2]+=-Jdet*gauss->weight*viscosity*(dw[0]*dh1dh6[0][i]+dw[1]*dh1dh6[1][i]+dw[2]*dh1dh6[2][i])/2;
     3243                        Pe_gaussian[i*NDOF4+3]+=Jdet*gauss->weight*stokesreconditioning*dw[2]*l1l6[i];
     3244                }
     3245        }
     3246        delete gauss;
     3247
     3248        /*Deal with 2d friction at the bedrock interface: */
     3249        if(IsOnBed() && !IsOnShelf()){
     3250
     3251                for(i=0;i<NUMVERTICES2D;i++){
     3252                        for(j=0;j<3;j++){
     3253                                xyz_list_tria[i][j]=xyz_list[i][j];
     3254                        }
     3255                }
     3256
     3257                /*build friction object, used later on: */
     3258                friction=new Friction("3d",inputs,matpar,analysis_type);
     3259
     3260                /* Start looping on the number of gauss 2d (nodes on the bedrock) */
     3261                gauss=new GaussPenta(0,1,2,2);
     3262                for(ig=gauss->begin();ig<gauss->end();ig++){
     3263
     3264                        gauss->GaussPoint(ig);
     3265
     3266                        /*Get the Jacobian determinant */
     3267                        GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
     3268
     3269                        /*Get L matrix : */
     3270                        GetNodalFunctionsP1(l1l6, gauss);
     3271
     3272                        /*Get normal vecyor to the bed */
     3273                        BedNormal(&bed_normal[0],xyz_list_tria);
     3274
     3275                        /*Get Viscosity*/
     3276                        this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
     3277                        matice->GetViscosity3dStokes(&viscosity,&epsilon[0]);
     3278
     3279                        /*Get friction*/
     3280                        friction->GetAlpha2(&alpha2_gauss, gauss,VxEnum,VyEnum,VzEnum);
     3281
     3282                        /*Get w and its derivatives*/
     3283                        vzpattyn_input->GetParameterValue(&w, gauss);
     3284                        vzpattyn_input->GetParameterDerivativeValue(&dw[0],&xyz_list[0][0],gauss);
     3285
     3286                        for(i=0;i<NUMVERTICES2D;i++){
     3287                                Pe_gaussian[i*NDOF4+0]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[0]*bed_normal[2]+viscosity*dw[2]*bed_normal[0])*l1l6[i];
     3288                                Pe_gaussian[i*NDOF4+1]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[1]*bed_normal[2]+viscosity*dw[2]*bed_normal[1])*l1l6[i];
     3289                                Pe_gaussian[i*NDOF4+2]+=Jdet2d*gauss->weight*viscosity*(dw[0]*bed_normal[0]+dw[1]*bed_normal[1]+dw[2]*bed_normal[2])*l1l6[i];
     3290                        }
     3291                }
     3292                /*Free ressources:*/
     3293                delete gauss;
     3294        } //if ( (IsOnBed()==1) && (IsOnShelf()==1))
     3295
     3296        /*Add Pe_reduced to global vector pg: */
     3297        VecSetValues(pg,numdof,doflist,(const double*)Pe_gaussian,ADD_VALUES);
     3298
     3299        /*Free ressources:*/
     3300        xfree((void**)&doflist);
     3301
     3302}
     3303/*}}}*/
    31623304/*FUNCTION Penta::CreatePVectorDiagnosticHutter{{{1*/
    31633305void  Penta::CreatePVectorDiagnosticHutter(Vec pg){
  • issm/trunk/src/c/objects/Elements/Penta.h

    r5808 r5810  
    135135                void      CreatePVectorAdjointMacAyeal( Vec pg);
    136136                void      CreatePVectorAdjointPattyn( Vec pg);
     137                void      CreatePVectorCouplingPattynStokes( Vec pg);
    137138                void      CreatePVectorDiagnosticHutter( Vec pg);
    138139                void      CreatePVectorDiagnosticMacAyeal( Vec pg);
Note: See TracChangeset for help on using the changeset viewer.