Changeset 8410 for issm/trunk/src/c/objects/Elements/Penta.cpp
- Timestamp:
- 05/24/11 11:29:04 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r8409 r8410 2984 2984 ElementVector* Penta::CreatePVectorThermalShelf(void){ 2985 2985 2986 /*Constants*/ 2987 const int numdof=NUMVERTICES*NDOF1; 2988 2989 /*Intermediaries */ 2990 int i,j,ig; 2991 double Jdet2d; 2992 double mixed_layer_capacity,thermal_exchange_velocity; 2993 double rho_ice,rho_water,pressure,dt,scalar_ocean; 2994 double meltingpoint,beta,heatcapacity,t_pmp; 2995 double xyz_list[NUMVERTICES][3]; 2996 double xyz_list_tria[NUMVERTICES2D][3]; 2997 double l1l6[NUMVERTICES]; 2998 GaussPenta* gauss=NULL; 2999 3000 /*Initialize Element vector*/ 3001 ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters); 3002 2986 3003 /* Ice/ocean heat exchange flux on ice shelf base */ 2987 3004 if (!IsOnBed() || !IsOnShelf()) return NULL; 2988 3005 2989 /*Call Tria function*/ 2990 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 2991 ElementVector* pe=tria->CreatePVectorThermalShelf(); 2992 delete tria->matice; delete tria; 3006 /*Retrieve all inputs and parameters*/ 3007 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3008 for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j]; 3009 mixed_layer_capacity=matpar->GetMixedLayerCapacity(); 3010 thermal_exchange_velocity=matpar->GetThermalExchangeVelocity(); 3011 rho_water=matpar->GetRhoWater(); 3012 rho_ice=matpar->GetRhoIce(); 3013 heatcapacity=matpar->GetHeatCapacity(); 3014 beta=matpar->GetBeta(); 3015 meltingpoint=matpar->GetMeltingPoint(); 3016 this->parameters->FindParam(&dt,DtEnum); 3017 Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input); 3018 3019 /* Start looping on the number of gauss 2d (nodes on the bedrock) */ 3020 gauss=new GaussPenta(0,1,2,2); 3021 for(ig=gauss->begin();ig<gauss->end();ig++){ 3022 3023 gauss->GaussPoint(ig); 3024 3025 GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss); 3026 GetNodalFunctionsP1(&l1l6[0], gauss); 3027 3028 pressure_input->GetParameterValue(&pressure,gauss); 3029 t_pmp=meltingpoint-beta*pressure; 3030 3031 scalar_ocean=gauss->weight*Jdet2d*rho_water*mixed_layer_capacity*thermal_exchange_velocity*(t_pmp)/(heatcapacity*rho_ice); 3032 if(dt) scalar_ocean=dt*scalar_ocean; 3033 3034 for(i=0;i<numdof;i++) pe->values[i]+=scalar_ocean*l1l6[i]; 3035 } 2993 3036 2994 3037 /*Clean up and return*/ 3038 delete gauss; 2995 3039 return pe; 2996 3040 } … … 2999 3043 ElementVector* Penta::CreatePVectorThermalSheet(void){ 3000 3044 3045 /*Constants*/ 3046 const int numdof=NUMVERTICES*NDOF1; 3047 3048 /*Intermediaries */ 3049 int i,j,ig; 3050 int analysis_type,drag_type; 3051 double xyz_list[NUMVERTICES][3]; 3052 double xyz_list_tria[NUMVERTICES2D][3]; 3053 double Jdet2d,dt; 3054 double rho_ice,heatcapacity,geothermalflux_value; 3055 double basalfriction,alpha2,vx,vy,pressure; 3056 double pressure_list[3]; 3057 double scalar; 3058 double l1l6[NUMVERTICES]; 3059 Friction* friction=NULL; 3060 GaussPenta* gauss=NULL; 3061 3001 3062 /* Geothermal flux on ice sheet base and basal friction */ 3002 3063 if (!IsOnBed() || IsOnShelf()) return NULL; 3003 3064 3004 /*Call Tria function*/ 3005 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 3006 ElementVector* pe=tria->CreatePVectorThermalSheet(); 3007 delete tria->matice; delete tria; 3065 /*Initialize Element vector*/ 3066 ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters); 3067 3068 /*Retrieve all inputs and parameters*/ 3069 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3070 for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j]; 3071 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 3072 rho_ice=matpar->GetRhoIce(); 3073 heatcapacity=matpar->GetHeatCapacity(); 3074 this->parameters->FindParam(&dt,DtEnum); 3075 Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input); 3076 Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input); 3077 Input* geothermalflux_input=inputs->GetInput(GeothermalFluxEnum); _assert_(geothermalflux_input); 3078 3079 /*Build frictoin element, needed later: */ 3080 inputs->GetParameterValue(&drag_type,DragTypeEnum); 3081 if (drag_type!=2)_error_(" non-viscous friction not supported yet!"); 3082 friction=new Friction("3d",inputs,matpar,analysis_type); 3083 3084 /* Start looping on the number of gauss 2d (nodes on the bedrock) */ 3085 gauss=new GaussPenta(0,1,2,2); 3086 for(ig=gauss->begin();ig<gauss->end();ig++){ 3087 3088 gauss->GaussPoint(ig); 3089 3090 GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss); 3091 GetNodalFunctionsP1(&l1l6[0], gauss); 3092 3093 geothermalflux_input->GetParameterValue(&geothermalflux_value,gauss); 3094 friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum); 3095 vx_input->GetParameterValue(&vx,gauss); 3096 vy_input->GetParameterValue(&vy,gauss); 3097 basalfriction=alpha2*(pow(vx,2.0)+pow(vy,2.0)); 3098 3099 scalar=gauss->weight*Jdet2d*(basalfriction+geothermalflux_value)/(heatcapacity*rho_ice); 3100 if(dt) scalar=dt*scalar; 3101 3102 for(i=0;i<numdof;i++) pe->values[i]+=scalar*l1l6[i]; 3103 } 3008 3104 3009 3105 /*Clean up and return*/ 3106 delete gauss; 3107 delete friction; 3010 3108 return pe; 3011 3109 }
Note:
See TracChangeset
for help on using the changeset viewer.