Changeset 16447
- Timestamp:
- 10/17/13 15:22:40 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/FemModel.cpp
r16442 r16447 369 369 int FemModel::UpdateVertexPositionsx(void){ /*{{{*/ 370 370 371 Vector<IssmDouble> *vz = NULL; 372 IssmDouble *thickness = NULL; 373 IssmDouble *bed = NULL; 371 IssmDouble *surface = NULL; 372 IssmDouble *bed = NULL; 374 373 375 374 /*get vertex vectors for bed and thickness: */ 376 GetVectorFromInputsx(& thickness,this, ThicknessEnum,VertexEnum);377 GetVectorFromInputsx(&bed ,this, BedEnum, 375 GetVectorFromInputsx(&surface ,this, SurfaceEnum,VertexEnum); 376 GetVectorFromInputsx(&bed ,this, BedEnum, VertexEnum); 378 377 379 378 /*Allocate vector*/ 380 vz=new Vector<IssmDouble>(vertices->NumberOfVertices()); 379 Vector<IssmDouble> *vx=new Vector<IssmDouble>(vertices->NumberOfVertices()); 380 Vector<IssmDouble> *vy=new Vector<IssmDouble>(vertices->NumberOfVertices()); 381 Vector<IssmDouble> *vz=new Vector<IssmDouble>(vertices->NumberOfVertices()); 381 382 382 383 /*Update verices new geometry: */ 383 384 for(int i=0;i<vertices->Size();i++){ 384 385 Vertex* vertex=(Vertex*)vertices->GetObjectByOffset(i); 385 vertex->UpdatePosition(v z,parameters,thickness,bed);386 vertex->UpdatePosition(vx,vy,vz,parameters,surface,bed); 386 387 } 387 388 388 389 /*Assemble mesh velocity*/ 390 vx->Assemble(); 391 vy->Assemble(); 389 392 vz->Assemble(); 390 393 391 394 /*Update element inputs*/ 395 InputUpdateFromVectorx(this,vx,VxMeshEnum,VertexPIdEnum); 396 InputUpdateFromVectorx(this,vy,VyMeshEnum,VertexPIdEnum); 392 397 InputUpdateFromVectorx(this,vz,VzMeshEnum,VertexPIdEnum); 393 398 394 399 /*Free ressources:*/ 400 delete vx; 401 delete vy; 395 402 delete vz; 396 403 xDelete<IssmDouble>(bed); 397 xDelete<IssmDouble>( thickness);404 xDelete<IssmDouble>(surface); 398 405 return 1; 399 406 } -
issm/trunk-jpl/src/c/classes/Vertex.cpp
r16446 r16447 32 32 this->y = iomodel->Data(MeshYEnum)[i]; 33 33 this->z = iomodel->Data(MeshZEnum)[i]; 34 this->meshtype = iomodel->meshtype; 34 35 35 36 _assert_(iomodel->Data(BedEnum) && iomodel->Data(ThicknessEnum) && iomodel->numbernodetoelementconnectivity); 36 this->sigma = (iomodel->Data(MeshZEnum)[i]-iomodel->Data(BedEnum)[i])/(iomodel->Data(ThicknessEnum)[i]); 37 switch(iomodel->meshtype){ 38 case Mesh3DEnum: 39 case Mesh2DhorizontalEnum: 40 this->sigma = (iomodel->Data(MeshZEnum)[i]-iomodel->Data(BedEnum)[i])/(iomodel->Data(ThicknessEnum)[i]); 41 break; 42 case Mesh2DverticalEnum: 43 this->sigma = (iomodel->Data(MeshYEnum)[i]-iomodel->Data(BedEnum)[i])/(iomodel->Data(ThicknessEnum)[i]); 44 break; 45 } 46 37 47 this->connectivity = iomodel->numbernodetoelementconnectivity[i]; 38 48 … … 112 122 /*}}}*/ 113 123 /*FUNCTION Vertex::UpdatePosition {{{*/ 114 void Vertex::UpdatePosition(Vector<IssmDouble>* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed){ 115 116 IssmDouble oldz,newz; 117 IssmDouble dt,velz; 124 void Vertex::UpdatePosition(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Parameters* parameters,IssmDouble* surface,IssmDouble* bed){ 125 126 IssmDouble oldy,newy,vely; 127 IssmDouble oldz,newz,velz; 128 IssmDouble dt; 118 129 119 130 /*Get time stepping*/ … … 121 132 122 133 /*sigma remains constant. z=bed+sigma*thickness*/ 123 oldz = this->z; 124 newz = bed[this->pid]+sigma*thickness[this->pid]; 125 velz = (newz-oldz)/dt; 126 this->z = newz; 127 128 /*put vz in vector*/ 129 vz->SetValue(this->pid,velz,INS_VAL); 134 if(this->meshtype==Mesh2DverticalEnum){ 135 oldy = this->y; 136 newy = bed[this->pid]+sigma*(surface[this->pid] - bed[this->pid]); 137 vely = (newy-oldy)/dt; 138 this->y = newy; 139 vy->SetValue(this->pid,vely,INS_VAL); 140 } 141 else{ 142 oldz = this->z; 143 newz = bed[this->pid]+sigma*(surface[this->pid] - bed[this->pid]); 144 velz = (newz-oldz)/dt; 145 this->z = newz; 146 vz->SetValue(this->pid,velz,INS_VAL); 147 } 130 148 } 131 149 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Vertex.h
r16446 r16447 21 21 public: 22 22 bool clone; 23 int meshtype; 23 24 int id; // random index 24 25 int sid; // "serial" id (rank of this vertex if the dataset was on 1 cpu) … … 49 50 IssmDouble GetY(void); 50 51 IssmDouble GetZ(void); 51 void UpdatePosition(Vector<IssmDouble>* v z,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed);52 void UpdatePosition(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed); 52 53 void DistributePids(int* ppidcount); 53 54 void OffsetPids(int pidcount);
Note:
See TracChangeset
for help on using the changeset viewer.