Changeset 5922
- Timestamp:
- 09/21/10 14:11:25 (15 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r5921 r5922 3771 3771 void Penta::CreatePVectorSlope( Vec pg){ 3772 3772 3773 /*Collapsed formulation: */ 3774 Tria* tria=NULL; 3775 3776 /*If on water, skip: */ 3777 if(IsOnWater())return; 3778 3779 /*Is this element on the bed? :*/ 3780 if(!IsOnBed())return; 3781 3782 /*Spawn Tria element from the base of the Penta: */ 3783 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. 3784 tria->CreatePVector(pg,NULL); 3773 if (!IsOnBed() || IsOnWater()) return; 3774 3775 /*Call Tria function*/ 3776 Tria* tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. 3777 ElementVector* pe=tria->CreatePVectorSlope(); 3785 3778 delete tria->matice; delete tria; 3779 pe->AddToGlobal(pg,NULL); 3780 delete pe; 3781 3782 /*clean up and return*/ 3786 3783 return; 3787 3784 } -
issm/trunk/src/c/objects/Elements/Tria.cpp
r5921 r5922 761 761 break; 762 762 case DiagnosticHutterAnalysisEnum: 763 CreatePVectorDiagnosticHutter( pg); 763 pe=CreatePVectorDiagnosticHutter(); 764 pe->AddToGlobal(pg,pf); 765 delete pe; 764 766 break; 765 767 case BedSlopeXAnalysisEnum: case SurfaceSlopeXAnalysisEnum: case BedSlopeYAnalysisEnum: case SurfaceSlopeYAnalysisEnum: 766 CreatePVectorSlope( pg); 768 pe=CreatePVectorSlope(); 769 pe->AddToGlobal(pg,pf); 770 delete pe; 767 771 break; 768 772 case PrognosticAnalysisEnum: … … 3687 3691 /*Initialize Element vector and return if necessary*/ 3688 3692 if(IsOnWater()) return NULL; 3689 ElementVector* pe=NewElementVector(nodes,NUMVERTICES,this->parameters );3693 ElementVector* pe=NewElementVector(nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum); 3690 3694 3691 3695 /*Retrieve all inputs and parameters*/ … … 4197 4201 /*}}}*/ 4198 4202 /*FUNCTION Tria::CreatePVectorDiagnosticHutter{{{1*/ 4199 void Tria::CreatePVectorDiagnosticHutter(Vec pg){4203 ElementVector* Tria::CreatePVectorDiagnosticHutter(void){ 4200 4204 4201 4205 /*Collapsed formulation: */ … … 4205 4209 double constant_part,ub,vb; 4206 4210 double rho_ice,gravity,n,B; 4207 double pe_g[numdofs];4208 4211 double slope[2]; 4209 4212 double thickness; … … 4212 4215 GaussTria* gauss=NULL; 4213 4216 4214 /*If on water, skip: */ 4215 if(IsOnWater())return; 4216 4217 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 4218 4219 /* Get parameters */ 4217 /*Initialize Element vector and return if necessary*/ 4218 if(IsOnWater()) return NULL; 4219 ElementVector* pe=NewElementVector(nodes,NUMVERTICES,this->parameters); 4220 4221 /*Retrieve all inputs and parameters*/ 4220 4222 rho_ice=matpar->GetRhoIce(); 4221 4223 gravity=matpar->GetG(); 4222 4224 n=matice->GetN(); 4223 4225 B=matice->GetBbar(); 4224 4225 /* Get slopes and thickness */4226 4226 Input* slopex_input=inputs->GetInput(SurfaceSlopeXEnum); ISSMASSERT(slopex_input); 4227 4227 Input* slopey_input=inputs->GetInput(SurfaceSlopeYEnum); ISSMASSERT(slopey_input); … … 4241 4241 slope2=pow(slope[0],2)+pow(slope[1],2); 4242 4242 4243 //compute constant_part4244 4243 constant_part=-2*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2)); 4245 4244 4246 //compute ub4247 4245 ub=-1.58*pow((double)10.0,(double)-10.0)*rho_ice*gravity*thickness*slope[0]; 4248 4246 vb=-1.58*pow((double)10.0,(double)-10.0)*rho_ice*gravity*thickness*slope[1]; 4249 4247 4250 pe_g[2*i]=(ub-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[0])/(double)connectivity; 4251 pe_g[2*i+1]=(vb-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[1])/(double)connectivity; 4252 4253 } 4254 4255 VecSetValues(pg,numdofs,doflist,(const double*)pe_g,ADD_VALUES); 4248 pe->values[2*i] =(ub-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[0])/(double)connectivity; 4249 pe->values[2*i+1]=(vb-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[1])/(double)connectivity; 4250 } 4256 4251 4257 4252 /*Clean up and return*/ 4258 4253 delete gauss; 4259 xfree((void**)&doflist);4254 return pe; 4260 4255 } 4261 4256 /*}}}*/ … … 4415 4410 /*}}}*/ 4416 4411 /*FUNCTION Tria::CreatePVectorSlope {{{1*/ 4417 void Tria::CreatePVectorSlope( Vec pg){ 4418 4419 int i,j; 4412 ElementVector* Tria::CreatePVectorSlope(void){ 4420 4413 4421 4414 /* node data: */ 4422 4415 const int numdof=NDOF1*NUMVERTICES; 4416 int i,j; 4417 int ig; 4423 4418 double xyz_list[NUMVERTICES][3]; 4424 4419 int* doflist=NULL; 4425 4426 /* gaussian points: */4427 int ig;4428 4420 GaussTria* gauss=NULL; 4429 4430 /* Jacobian: */4431 4421 double Jdet; 4432 4433 /*nodal functions: */4434 4422 double l1l2l3[3]; 4435 4436 /*element vector at the gaussian points: */4437 double pe_g[numdof]={0.0};4438 4423 double pe_g_gaussian[numdof]; 4439 4424 double slope[2]; 4440 4425 int analysis_type; 4441 4426 4442 /*inputs :*/ 4427 /*Initialize Element vector and return if necessary*/ 4428 if(IsOnWater()) return NULL; 4429 ElementVector* pe=NewElementVector(nodes,NUMVERTICES,this->parameters); 4430 4431 /*Retrieve all inputs and parameters*/ 4432 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 4433 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4443 4434 Input* slope_input=NULL; 4444 4445 /*retrive parameters: */4446 parameters->FindParam(&analysis_type,AnalysisTypeEnum);4447 4448 /* Get node coordinates and dof list: */4449 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);4450 GetDofList(&doflist,NoneApproximationEnum,GsetEnum);4451 4452 /*Retrieve all inputs we will be needing: */4453 4435 if ( (analysis_type==SurfaceSlopeXAnalysisEnum) || (analysis_type==SurfaceSlopeYAnalysisEnum)){ 4454 4436 slope_input=inputs->GetInput(SurfaceEnum); ISSMASSERT(slope_input); … … 4481 4463 4482 4464 /*Add pe_g_gaussian vector to pe_g: */ 4483 for( i=0; i<numdof; i++)pe_g[i]+=pe_g_gaussian[i]; 4484 4485 } 4486 4487 /*Add pe_g to global vector pg: */ 4488 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4465 for(i=0;i<numdof;i++) pe->values[i]+=pe_g_gaussian[i]; 4466 4467 } 4489 4468 4490 4469 /*Clean up and return*/ 4491 4470 delete gauss; 4492 xfree((void**)&doflist);4471 return pe; 4493 4472 } 4494 4473 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Tria.h
r5921 r5922 147 147 void CreatePVectorAdjointStokes(Vec pg); 148 148 void CreatePVectorAdjointBalancedthickness(Vec pg); 149 void CreatePVectorDiagnosticHutter(Vec pg);149 ElementVector* CreatePVectorDiagnosticHutter(void); 150 150 void CreatePVectorPrognostic(Vec pg); 151 151 void CreatePVectorPrognostic_CG(Vec pg); 152 152 void CreatePVectorPrognostic_DG(Vec pg); 153 void CreatePVectorSlope( Vec pg);153 ElementVector* CreatePVectorSlope(void); 154 154 void CreatePVectorThermalSheet( Vec pg); 155 155 void CreatePVectorThermalShelf( Vec pg);
Note:
See TracChangeset
for help on using the changeset viewer.