Changeset 5929
- Timestamp:
- 09/21/10 16:17:43 (14 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r5926 r5929 753 753 pe=CreatePVectorDiagnosticHoriz(); 754 754 if(pe) pe->AddToGlobal(pg,pf); 755 delete pe;755 if(pe) delete pe; 756 756 break; 757 757 case AdjointHorizAnalysisEnum: 758 758 pe=CreatePVectorAdjointHoriz(); 759 759 if(pe) pe->AddToGlobal(pg,pf); 760 delete pe;760 if(pe) delete pe; 761 761 break; 762 762 case DiagnosticHutterAnalysisEnum: 763 CreatePVectorDiagnosticHutter( pg); 763 pe=CreatePVectorDiagnosticHutter(); 764 if(pe) pe->AddToGlobal(pg,pf); 765 if(pe) delete pe; 764 766 break; 765 767 case DiagnosticVertAnalysisEnum: … … 767 769 break; 768 770 case BedSlopeXAnalysisEnum: case SurfaceSlopeXAnalysisEnum: case BedSlopeYAnalysisEnum: case SurfaceSlopeYAnalysisEnum: 769 CreatePVectorSlope( pg); 771 pe=CreatePVectorSlope(); 772 if(pe) pe->AddToGlobal(pg,pf); 773 if(pe) delete pe; 770 774 break; 771 775 case PrognosticAnalysisEnum: … … 3271 3275 /*}}}*/ 3272 3276 /*FUNCTION Penta::CreatePVectorDiagnosticHutter{{{1*/ 3273 void Penta::CreatePVectorDiagnosticHutter(Vec pg){3277 ElementVector* Penta::CreatePVectorDiagnosticHutter(void){ 3274 3278 3275 3279 int i,j,k; 3276 3280 int ig; 3277 3281 const int numdofs=NDOF2*NUMVERTICES; 3278 int* doflist=NULL;3279 double pe_g[numdofs]={0.0};3280 3282 double xyz_list[NUMVERTICES][3]; 3281 3283 double xyz_list_segment[2][3]; … … 3285 3287 int node0,node1; 3286 3288 GaussPenta* gauss=NULL; 3287 int ig;3288 3289 double slope[2]; 3289 3290 3290 double z_g; 3291 3291 double rho_ice,gravity,n,B; … … 3293 3293 double ub,vb; 3294 3294 double surface,thickness; 3295 3296 /*flags: */3297 3295 int connectivity[2]; 3298 3296 3299 /*If on water, skip: */ 3300 if(IsOnWater())return; 3301 3302 /*recover doflist: */ 3303 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 3304 3305 /*recover parameters: */ 3297 /*Initialize Element vector and return if necessary*/ 3298 if(IsOnWater()) return NULL; 3299 ElementVector* pe=NewElementVector(nodes,NUMVERTICES,this->parameters); 3300 3301 /*Retrieve all inputs and parameters*/ 3302 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3306 3303 rho_ice=matpar->GetRhoIce(); 3307 3304 gravity=matpar->GetG(); 3308 3305 n=matice->GetN(); 3309 3306 B=matice->GetB(); 3310 3311 //recover extra inputs3312 3307 Input* thickness_input=inputs->GetInput(ThicknessEnum); ISSMASSERT(thickness_input); 3313 3308 Input* surface_input=inputs->GetInput(SurfaceEnum); ISSMASSERT(surface_input); 3314 3309 Input* slopex_input=inputs->GetInput(SurfaceSlopeXEnum); ISSMASSERT(slopex_input); 3315 3310 Input* slopey_input=inputs->GetInput(SurfaceSlopeYEnum); ISSMASSERT(slopey_input); 3316 3317 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);3318 3311 for(i=0;i<NUMVERTICES;i++)z_list[i]=xyz_list[i][2]; 3319 3312 … … 3349 3342 3350 3343 if (IsOnSurface()){ 3351 for(j=0;j<NDOF2;j++) pe _g[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight/(double)connectivity[1];3344 for(j=0;j<NDOF2;j++) pe->values[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight/(double)connectivity[1]; 3352 3345 } 3353 3346 else{//connectivity is too large, should take only half on it 3354 for(j=0;j<NDOF2;j++) pe _g[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight*2/(double)connectivity[1];3347 for(j=0;j<NDOF2;j++) pe->values[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight*2/(double)connectivity[1]; 3355 3348 } 3356 3349 } … … 3363 3356 vb=constant_part*slope[1]; 3364 3357 3365 pe_g[2*node0]+=ub/(double)connectivity[0]; 3366 pe_g[2*node0+1]+=vb/(double)connectivity[0]; 3367 } 3368 } 3369 3370 /*Add pe_g to global vector pg: */ 3371 VecSetValues(pg,numdofs,doflist,(const double*)pe_g,ADD_VALUES); 3372 3373 /*Clean up */ 3374 xfree((void**)&doflist); 3358 pe->values[2*node0]+=ub/(double)connectivity[0]; 3359 pe->values[2*node0+1]+=vb/(double)connectivity[0]; 3360 } 3361 } 3362 3363 /*Clean up and return*/ 3364 return pe; 3375 3365 } 3376 3366 /*}}}*/ … … 3773 3763 /*}}}*/ 3774 3764 /*FUNCTION Penta::CreatePVectorSlope {{{1*/ 3775 void Penta::CreatePVectorSlope( Vec pg){3776 3777 if (!IsOnBed() || IsOnWater()) return ;3765 ElementVector* Penta::CreatePVectorSlope(void){ 3766 3767 if (!IsOnBed() || IsOnWater()) return NULL; 3778 3768 3779 3769 /*Call Tria function*/ … … 3781 3771 ElementVector* pe=tria->CreatePVectorSlope(); 3782 3772 delete tria->matice; delete tria; 3783 pe->AddToGlobal(pg,NULL);3784 delete pe;3785 3773 3786 3774 /*clean up and return*/ 3787 return ;3775 return pe; 3788 3776 } 3789 3777 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Penta.h
r5926 r5929 159 159 ElementVector* CreatePVectorCouplingPattynStokesFriction(void); 160 160 ElementVector* CreatePVectorDiagnosticHoriz(void); 161 void CreatePVectorDiagnosticHutter( Vec pg);161 ElementVector* CreatePVectorDiagnosticHutter(void); 162 162 ElementVector* CreatePVectorDiagnosticMacAyeal(void); 163 163 ElementVector* CreatePVectorDiagnosticMacAyealPattyn(void); … … 171 171 void CreatePVectorMelting( Vec pg); 172 172 void CreatePVectorPrognostic( Vec pg); 173 void CreatePVectorSlope( Vec pg);173 ElementVector* CreatePVectorSlope(void); 174 174 void CreatePVectorThermal( Vec pg); 175 175 void GetDofList(int** pdoflist,int approximation_enum,int setenum);
Note:
See TracChangeset
for help on using the changeset viewer.