Changeset 21311
- Timestamp:
- 10/25/16 11:44:04 (8 years ago)
- Location:
- issm/branches/trunk-larour-NatGeoScience2016/src/c
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/branches/trunk-larour-NatGeoScience2016/src/c/classes/Elements/Element.cpp
r21232 r21311 963 963 } 964 964 /*}}}*/ 965 void Element::GetInputListOnVerticesAtTime(IssmDouble* pvalue, int enumtype, IssmDouble time){/*{{{*/ 966 967 /*Recover input*/ 968 Input* input=this->GetInput(enumtype); 969 if (!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element"); 970 971 /*Fetch number vertices for this element*/ 972 int numvertices = this->GetNumberOfVertices(); 973 974 /*Checks in debugging mode*/ 975 _assert_(pvalue); 976 977 /* Start looping on the number of vertices: */ 978 Gauss*gauss=this->NewGauss(); 979 for(int iv=0;iv<numvertices;iv++){ 980 gauss->GaussVertex(iv); 981 input->GetInputValue(&pvalue[iv],gauss,time); 982 } 983 984 /*clean-up*/ 985 delete gauss; 986 } 987 /*}}}*/ 965 988 void Element::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){/*{{{*/ 966 989 … … 1172 1195 this->GetInputListOnNodes(values,input_enum); 1173 1196 vector->SetValues(numnodes,doflist,values,INS_VAL); 1197 break; 1198 default: 1199 _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); 1200 } 1201 1202 /*Clean up*/ 1203 xDelete<int>(doflist); 1204 xDelete<IssmDouble>(values); 1205 1206 } 1207 /*}}}*/ 1208 void Element::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum,int type, IssmDouble time){/*{{{*/ 1209 1210 /*Fetch number vertices for this element and allocate arrays*/ 1211 int numvertices = this->GetNumberOfVertices(); 1212 int numnodes = this->GetNumberOfNodes(); 1213 int* doflist = NULL; 1214 IssmDouble* values = NULL; 1215 1216 switch(type){ 1217 case VertexPIdEnum: 1218 doflist = xNew<int>(numvertices); 1219 values = xNew<IssmDouble>(numvertices); 1220 /*Fill in values*/ 1221 this->GetVertexPidList(doflist); 1222 this->GetInputListOnVerticesAtTime(values,input_enum,time); 1223 vector->SetValues(numvertices,doflist,values,INS_VAL); 1174 1224 break; 1175 1225 default: -
issm/branches/trunk-larour-NatGeoScience2016/src/c/classes/Elements/Element.h
r20999 r21311 89 89 void GetInputListOnNodesVelocity(IssmDouble* pvalue,int enumtype); 90 90 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype); 91 void GetInputListOnVerticesAtTime(IssmDouble* pvalue,int enumtype,IssmDouble time); 91 92 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue); 92 93 void GetInputLocalMinMaxOnNodes(IssmDouble* min,IssmDouble* max,IssmDouble* ug); … … 100 101 void GetPhi(IssmDouble* phi, IssmDouble* epsilon, IssmDouble viscosity); 101 102 void GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum, int type); 103 void GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum, int type,IssmDouble time); 102 104 void GetVertexPidList(int* pidlist); 103 105 void GetVerticesConnectivityList(int* connectivitylist); -
issm/branches/trunk-larour-NatGeoScience2016/src/c/cores/cores.h
r20454 r21311 64 64 void TransferForcing(FemModel* femmodel,int forcingenum); 65 65 void TransferSealevel(FemModel* femmodel,int forcingenum); 66 void EarthMassTransport(FemModel* femmodel); 66 67 67 68 //solution configuration -
issm/branches/trunk-larour-NatGeoScience2016/src/c/cores/sealevelrise_core.cpp
r21226 r21311 40 40 femmodel->parameters->FindParam(&isslr,TransientIsslrEnum); 41 41 femmodel->parameters->FindParam(&iscoupler,TransientIscouplerEnum); 42 42 43 43 /*first, recover lat,long and radius vectors from vertices: */ 44 44 VertexCoordinatesx(&latitude,&longitude,&radius,femmodel->vertices,spherical); … … 71 71 /*set configuration: */ 72 72 if(isslr)femmodel->SetCurrentConfiguration(SealevelriseAnalysisEnum); 73 74 /*figure out whether deltathickness was computed on the earth (mass trasnport module should 75 * have taken care of it for ice caps: */ 76 if(iscoupler){ 77 int ismasstransport,modelid,earthid; 78 femmodel->parameters->FindParam(&modelid,ModelIdEnum); 79 femmodel->parameters->FindParam(&earthid,EarthIdEnum); 80 femmodel->parameters->FindParam(&ismasstransport,TransientIsmasstransportEnum); 81 if((modelid==EarthIdEnum) & !ismasstransport) EarthMassTransport(femmodel); 82 } 73 83 74 84 /*transfer deltathickness forcing from ice caps to earth model: */ … … 359 369 360 370 } /*}}}*/ 371 void EarthMassTransport(FemModel* femmodel){ /*{{{*/ 372 373 IssmDouble time,dt; 374 Vector<IssmDouble> *oldthickness = NULL; 375 Vector<IssmDouble> *newthickness = NULL; 376 Vector<IssmDouble> *deltathickness = NULL; 377 int nv; 378 379 /*No mass transport module was called, so we are just going to retrieve the geometry thickness 380 * at this time step, at prior time step, and plug the difference as deltathickness: */ 381 femmodel->parameters->FindParam(&time,TimeEnum); 382 femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum); 383 nv=femmodel->vertices->NumberOfVertices(); 384 385 GetVectorFromInputsx(&newthickness,femmodel,ThicknessEnum,VertexSIdEnum); 386 GetVectorFromInputsx(&oldthickness,femmodel,ThicknessEnum,VertexSIdEnum,time-dt); 387 388 /*compute deltathickness: */ 389 deltathickness = new Vector<IssmDouble>(nv); 390 newthickness->Copy(deltathickness); deltathickness->AXPY(oldthickness,-1); 391 392 /*plug into elements:*/ 393 InputUpdateFromVectorx(femmodel,deltathickness,SealevelriseDeltathicknessEnum,VertexSIdEnum); 394 395 /*free ressources:*/ 396 delete oldthickness; 397 delete newthickness; 398 delete deltathickness; 399 400 } /*}}}*/ -
issm/branches/trunk-larour-NatGeoScience2016/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp
r19094 r21311 33 33 *pvector=vector; 34 34 } 35 void GetVectorFromInputsx(Vector<IssmDouble>** pvector,FemModel* femmodel,int name,int type,IssmDouble time){ 36 37 int i; 38 Vector<IssmDouble>* vector=NULL; 39 40 switch(type){ 41 case VertexPIdEnum: case VertexSIdEnum: 42 vector=new Vector<IssmDouble>(femmodel->vertices->NumberOfVertices()); 43 break; 44 case NodesEnum:case NodeSIdEnum: 45 vector=new Vector<IssmDouble>(femmodel->nodes->NumberOfNodes()); 46 break; 47 default: 48 _error_("vector type: " << EnumToStringx(type) << " not supported yet!"); 49 } 50 /*Look up in elements*/ 51 for(i=0;i<femmodel->elements->Size();i++){ 52 Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i)); 53 element->GetVectorFromInputs(vector,name,type,time); 54 } 55 56 vector->Assemble(); 57 58 /*Assign output pointers:*/ 59 *pvector=vector; 60 } 35 61 36 62 void GetVectorFromInputsx(IssmDouble** pvector,FemModel* femmodel,int name, int type){ -
issm/branches/trunk-larour-NatGeoScience2016/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.h
r15849 r21311 9 9 /* local prototypes: */ 10 10 void GetVectorFromInputsx( Vector<IssmDouble>** pvector,FemModel* femmodel,int name,int type); 11 void GetVectorFromInputsx( Vector<IssmDouble>** pvector,FemModel* femmodel,int name,int type,IssmDouble time); 11 12 void GetVectorFromInputsx( IssmDouble** pvector,FemModel* femmodel,int name,int type); 12 13
Note:
See TracChangeset
for help on using the changeset viewer.