[17802] | 1 | Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp (revision 16779)
|
---|
| 4 | +++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp (revision 16780)
|
---|
| 5 | @@ -1059,11 +1059,23 @@
|
---|
| 6 | }/*}}}*/
|
---|
| 7 | void StressbalanceAnalysis::InputUpdateFromSolutionHO(IssmDouble* solution,Element* element){/*{{{*/
|
---|
| 8 |
|
---|
| 9 | - int i,meshtype;
|
---|
| 10 | - IssmDouble rho_ice,g;
|
---|
| 11 | + int i;
|
---|
| 12 | int* doflist=NULL;
|
---|
| 13 | IssmDouble* xyz_list=NULL;
|
---|
| 14 |
|
---|
| 15 | + /*Deal with pressure first*/
|
---|
| 16 | + int numvertices = element->GetNumberOfVertices();
|
---|
| 17 | + IssmDouble* pressure = xNew<IssmDouble>(numvertices);
|
---|
| 18 | + IssmDouble* surface = xNew<IssmDouble>(numvertices);
|
---|
| 19 | + IssmDouble rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
|
---|
| 20 | + IssmDouble g = element->GetMaterialParameter(ConstantsGEnum);
|
---|
| 21 | + element->GetVerticesCoordinates(&xyz_list);
|
---|
| 22 | + element->GetInputListOnVertices(surface,SurfaceEnum);
|
---|
| 23 | + for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
|
---|
| 24 | + element->AddInput(PressureEnum,pressure,P1Enum);
|
---|
| 25 | + xDelete<IssmDouble>(pressure);
|
---|
| 26 | + xDelete<IssmDouble>(surface);
|
---|
| 27 | +
|
---|
| 28 | /*Fetch number of nodes and dof for this finite element*/
|
---|
| 29 | int numnodes = element->GetNumberOfNodes();
|
---|
| 30 | int numdof = numnodes*2;
|
---|
| 31 | @@ -1075,15 +1087,12 @@
|
---|
| 32 | IssmDouble* vy = xNew<IssmDouble>(numnodes);
|
---|
| 33 | IssmDouble* vz = xNew<IssmDouble>(numnodes);
|
---|
| 34 | IssmDouble* vel = xNew<IssmDouble>(numnodes);
|
---|
| 35 | - IssmDouble* pressure = xNew<IssmDouble>(numnodes);
|
---|
| 36 | - IssmDouble* surface = xNew<IssmDouble>(numnodes);
|
---|
| 37 |
|
---|
| 38 | /*Use the dof list to index into the solution vector: */
|
---|
| 39 | for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
|
---|
| 40 |
|
---|
| 41 | /*Transform solution in Cartesian Space*/
|
---|
| 42 | element->TransformSolutionCoord(&values[0],XYEnum);
|
---|
| 43 | - element->FindParam(&meshtype,MeshTypeEnum);
|
---|
| 44 |
|
---|
| 45 | /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
|
---|
| 46 | for(i=0;i<numnodes;i++){
|
---|
| 47 | @@ -1099,14 +1108,6 @@
|
---|
| 48 | element->GetInputListOnNodes(&vz[0],VzEnum,0.);
|
---|
| 49 | for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
|
---|
| 50 |
|
---|
| 51 | - /*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D,
|
---|
| 52 | - *so the pressure is just the pressure at the bedrock: */
|
---|
| 53 | - rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum);
|
---|
| 54 | - g = element->GetMaterialParameter(ConstantsGEnum);
|
---|
| 55 | - element->GetVerticesCoordinates(&xyz_list);
|
---|
| 56 | - element->GetInputListOnNodes(&surface[0],SurfaceEnum);
|
---|
| 57 | - for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
|
---|
| 58 | -
|
---|
| 59 | /*Now, we have to move the previous Vx and Vy inputs to old
|
---|
| 60 | * status, otherwise, we'll wipe them off: */
|
---|
| 61 | element->InputChangeName(VxEnum,VxPicardEnum);
|
---|
| 62 | @@ -1117,11 +1118,8 @@
|
---|
| 63 | element->AddInput(VxEnum,vx,P1Enum);
|
---|
| 64 | element->AddInput(VyEnum,vy,P1Enum);
|
---|
| 65 | element->AddBasalInput(VelEnum,vel,P1Enum);
|
---|
| 66 | - element->AddBasalInput(PressureEnum,pressure,P1Enum);
|
---|
| 67 |
|
---|
| 68 | /*Free ressources:*/
|
---|
| 69 | - xDelete<IssmDouble>(surface);
|
---|
| 70 | - xDelete<IssmDouble>(pressure);
|
---|
| 71 | xDelete<IssmDouble>(vel);
|
---|
| 72 | xDelete<IssmDouble>(vz);
|
---|
| 73 | xDelete<IssmDouble>(vy);
|
---|