Changeset 3832


Ignore:
Timestamp:
05/18/10 18:31:36 (15 years ago)
Author:
Eric.Larour
Message:

Started using Friction2 object, replacing Friction object

Location:
issm/trunk/src/c
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/Makefile.am

    r3828 r3832  
    5050                                        ./objects/Loads/Friction.h\
    5151                                        ./objects/Loads/Friction.cpp\
     52                                        ./objects/Loads/Friction2.h\
     53                                        ./objects/Loads/Friction2.cpp\
    5254                                        ./objects/DakotaPlugin.h\
    5355                                        ./objects/DakotaPlugin.cpp\
     
    497499                                        ./objects/Loads/Friction.h\
    498500                                        ./objects/Loads/Friction.cpp\
     501                                        ./objects/Loads/Friction2.h\
     502                                        ./objects/Loads/Friction2.cpp\
    499503                                        ./objects/DakotaPlugin.h\
    500504                                        ./objects/DakotaPlugin.cpp\
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r3831 r3832  
    12821282        double  gauss_weight;
    12831283        double  gauss_l1l2l3[3];
    1284         double  gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}};
    12851284
    12861285        /* matrices: */
     
    12991298        double  slope_magnitude;
    13001299
    1301         /*input parameters for structural analysis (diagnostic): */
    1302         double  vx_list[numgrids];
    1303         double  vy_list[numgrids];
    1304         double  thickness_list[numgrids];
    1305         double  bed_list[numgrids];
    1306         double  dragcoefficient_list[numgrids];
    1307         double  drag_p,drag_q;
    1308 
    13091300        /*friction: */
    1310         double alpha2_list[numgrids]={0.0,0.0,0.0};
     1301        Friction2* friction2=NULL;
    13111302        double alpha2;
    13121303
     
    13311322        }
    13321323
     1324        /*build friction object, used later on: */
    13331325        if (drag_type!=2)ISSMERROR(" non-viscous friction not supported yet!");
    1334 
    1335         /*Recover inputs: */
    1336         inputs->GetParameterValues(&vx_list[0],&gaussgrids[0][0],3,VxAverageEnum);
    1337         inputs->GetParameterValues(&vy_list[0],&gaussgrids[0][0],3,VyAverageEnum);
    1338         inputs->GetParameterValues(&dragcoefficient_list[0],&gaussgrids[0][0],3,DragCoefficientEnum);
    1339         inputs->GetParameterValues(&bed_list[0],&gaussgrids[0][0],3,BedEnum);
    1340         inputs->GetParameterValues(&thickness_list[0],&gaussgrids[0][0],3,ThicknessEnum);
    1341         inputs->GetParameterValue(&drag_p,DragPEnum);
    1342         inputs->GetParameterValue(&drag_q,DragQEnum);
    1343 
    1344         /*Build alpha2_list used by drag stiffness matrix*/
    1345         Friction* friction=NewFriction();
    1346        
    1347         /*Initialize all fields: */
    1348         friction->element_type=(char*)xmalloc((strlen("2d")+1)*sizeof(char));
    1349         strcpy(friction->element_type,"2d");
    1350        
    1351         friction->gravity=matpar->GetG();
    1352         friction->rho_ice=matpar->GetRhoIce();
    1353         friction->rho_water=matpar->GetRhoWater();
    1354         friction->K=&dragcoefficient_list[0];
    1355         friction->bed=&bed_list[0];
    1356         friction->thickness=&thickness_list[0];
    1357         friction->vx=&vx_list[0];
    1358         friction->vy=&vy_list[0];
    1359         friction->p=drag_p;
    1360         friction->q=drag_q;
    1361 
    1362         /*Compute alpha2_list: */
    1363         FrictionGetAlpha2(&alpha2_list[0],friction);
    1364 
    1365         /*Erase friction object: */
    1366         DeleteFriction(&friction);
     1326        friction2=new Friction2("2d",inputs,matpar);
    13671327
    13681328        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     
    13781338
    13791339
     1340                /*Friction: */
     1341                friction2->GetAlpha2(&alpha2, gauss_l1l2l3,VxAverageEnum,VyAverageEnum,VzAverageEnum);
     1342
    13801343                // If we have a slope > 6% for this element,  it means  we are on a mountain. In this particular case,
    13811344                //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */
     
    13841347
    13851348                if (slope_magnitude>MAXSLOPE){
    1386                         alpha2_list[0]=pow((double)10,MOUNTAINKEXPONENT);
    1387                         alpha2_list[1]=pow((double)10,MOUNTAINKEXPONENT);
    1388                         alpha2_list[2]=pow((double)10,MOUNTAINKEXPONENT);
     1349                        alpha2=pow((double)10,MOUNTAINKEXPONENT);
    13891350                }
    13901351
     
    13951356                GetL(&L[0][0], &xyz_list[0][0], gauss_l1l2l3,numberofdofspernode);
    13961357
    1397                 /*Now, take care of the basal friction if there is any: */
    1398                 GetParameterValue(&alpha2, &alpha2_list[0],gauss_l1l2l3);
    1399 
     1358               
    14001359                DL_scalar=alpha2*gauss_weight*Jdet;
    14011360                for (i=0;i<2;i++){
     
    14211380        xfree((void**)&third_gauss_area_coord);
    14221381        xfree((void**)&gauss_weights);
     1382        delete friction2;
    14231383
    14241384}       
     
    29402900        double pressure_list[3];
    29412901        double pressure;
    2942         double alpha2_list[3];
    2943         double basalfriction_list[3];
     2902        int    drag_type;
    29442903        double basalfriction;
     2904        Friction2* friction2=NULL;
     2905        double alpha2,vx,vy;
    29452906        double geothermalflux_value;
    2946 
    2947         double  vx_list[numgrids];
    2948         double  vy_list[numgrids];
    2949         double  thickness_list[numgrids];
    2950         double  bed_list[numgrids];
    2951         double  dragcoefficient_list[numgrids];
    2952         double  drag_p,drag_q;
    2953         int     drag_type;
    29542907
    29552908        /* gaussian points: */
     
    29612914        double  gauss_weight;
    29622915        double  gauss_coord[3];
    2963         double  gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}};
    29642916
    29652917        /*matrices: */
     
    29692921        double  scalar;
    29702922
    2971 
    2972         /*retrieve inputs :*/
    2973         inputs->GetParameterValue(&drag_type,DragTypeEnum);
    29742923       
    29752924        /* Get node coordinates and dof list: */
     
    29842933        this->parameters->FindParam(&dt,DtEnum);
    29852934
    2986 
    2987         /*Recover inputs: */
    2988         inputs->GetParameterValues(&vx_list[0],&gaussgrids[0][0],3,VxAverageEnum);
    2989         inputs->GetParameterValues(&vy_list[0],&gaussgrids[0][0],3,VyAverageEnum);
    2990         inputs->GetParameterValues(&dragcoefficient_list[0],&gaussgrids[0][0],3,DragCoefficientEnum);
    2991         inputs->GetParameterValues(&bed_list[0],&gaussgrids[0][0],3,BedEnum);
    2992         inputs->GetParameterValues(&thickness_list[0],&gaussgrids[0][0],3,ThicknessEnum);
    2993         inputs->GetParameterValue(&drag_p,DragPEnum);
    2994         inputs->GetParameterValue(&drag_q,DragQEnum);
    2995 
    2996         /*Build alpha2_list used by drag stiffness matrix*/
    2997         Friction* friction=NewFriction();
    2998        
    2999         /*Initialize all fields: */
     2935        /*Build frictoin element, needed later: */
     2936        inputs->GetParameterValue(&drag_type,DragTypeEnum);
    30002937        if (drag_type!=2)ISSMERROR(" non-viscous friction not supported yet!");
    3001        
    3002         friction->element_type=(char*)xmalloc((strlen("3d")+1)*sizeof(char));
    3003         strcpy(friction->element_type,"3d");
    3004 
    3005         friction->gravity=matpar->GetG();
    3006         friction->rho_ice=matpar->GetRhoIce();
    3007         friction->rho_water=matpar->GetRhoWater();
    3008         friction->K=&dragcoefficient_list[0];
    3009         friction->bed=&bed_list[0];
    3010         friction->thickness=&thickness_list[0];
    3011         friction->vx=&vx_list[0];
    3012         friction->vy=&vy_list[0];
    3013         friction->p=drag_p;
    3014         friction->q=drag_q;
    3015 
    3016         /*Compute alpha2_list: */
    3017         FrictionGetAlpha2(&alpha2_list[0],friction);
    3018 
    3019         /*Erase friction object: */
    3020         DeleteFriction(&friction);
    3021 
    3022         /* Compute basal friction */
    3023         for(i=0;i<numgrids;i++){
    3024                 basalfriction_list[i]= alpha2_list[i]*(pow(vx_list[i],(double)2.0)+pow(vy_list[i],(double)2.0));
    3025         }
     2938        friction2=new Friction2("3d",inputs,matpar);
    30262939       
    30272940        /* Ice/ocean heat exchange flux on ice shelf base */
     
    30432956                /*Get geothermal flux and basal friction */
    30442957                inputs->GetParameterValue(&geothermalflux_value, &gauss_coord[0],GeothermalFluxEnum);
    3045                 GetParameterValue(&basalfriction,&basalfriction_list[0],gauss_coord);
    3046 
     2958       
     2959                friction2->GetAlpha2(&alpha2,&gauss_coord[0],VxAverageEnum,VyAverageEnum,VzAverageEnum);
     2960                inputs->GetParameterValue(&vx, &gauss_coord[0],VxAverageEnum);
     2961                inputs->GetParameterValue(&vy, &gauss_coord[0],VyAverageEnum);
     2962                basalfriction= alpha2*(pow(vx,(double)2.0)+pow(vy,(double)2.0));
     2963               
    30472964                /*Calculate scalar parameter*/
    30482965                scalar=gauss_weight*Jdet*(basalfriction+geothermalflux_value)/(heatcapacity*rho_ice);
     
    30642981        xfree((void**)&third_gauss_area_coord);
    30652982        xfree((void**)&gauss_weights);
     2983        delete friction2;
    30662984
    30672985}
  • issm/trunk/src/c/objects/objects.h

    r3828 r3832  
    2626/*Loads: */
    2727#include "./Loads/Friction.h"
     28#include "./Loads/Friction2.h"
    2829#include "./Loads/Icefront.h"
    2930#include "./Loads/Numericalflux.h"
Note: See TracChangeset for help on using the changeset viewer.