Changeset 4394


Ignore:
Timestamp:
07/01/10 11:48:16 (15 years ago)
Author:
seroussi
Message:

added UpdateInputFRomSolution Bed in Penta

Location:
issm/trunk/src/c/objects/Elements
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r4384 r4394  
    21422142/*FUNCTION Penta::InputUpdateFromBedSlopeXCompute {{{1*/
    21432143void  Penta::InputUpdateFromBedSlopeXCompute(double* solution){
    2144         ISSMERROR(" not supported yet!");
     2144
     2145        int i;
     2146
     2147        const int    numvertices=6;
     2148        const int    numdofpervertex=1;
     2149        const int    numdof=numdofpervertex*numvertices;
     2150
     2151        int          doflist[numdof];
     2152        double       values[numdof];
     2153
     2154        int          dummy;
     2155
     2156        /*Get dof list: */
     2157        GetDofList(&doflist[0],&dummy);
     2158
     2159        /*Use the dof list to index into the solution vector: */
     2160        for(i=0;i<numdof;i++){
     2161                values[i]=solution[doflist[i]];
     2162        }
     2163
     2164        /*Add bedslopex as inputs to the tria element: */
     2165        this->inputs->AddInput(new PentaVertexInput(BedSlopeXEnum,values));
    21452166}
    21462167/*}}}*/
    21472168/*FUNCTION Penta::InputUpdateFromBedSlopeYCompute {{{1*/
    21482169void  Penta::InputUpdateFromBedSlopeYCompute(double* solution){
    2149         ISSMERROR(" not supported yet!");
     2170
     2171        int i;
     2172
     2173        const int    numvertices=6;
     2174        const int    numdofpervertex=1;
     2175        const int    numdof=numdofpervertex*numvertices;
     2176
     2177        int          doflist[numdof];
     2178        double       values[numdof];
     2179
     2180        int          dummy;
     2181
     2182        /*Get dof list: */
     2183        GetDofList(&doflist[0],&dummy);
     2184
     2185        /*Use the dof list to index into the solution vector: */
     2186        for(i=0;i<numdof;i++){
     2187                values[i]=solution[doflist[i]];
     2188        }
     2189
     2190        /*Add bedslopey as inputs to the tria element: */
     2191        this->inputs->AddInput(new PentaVertexInput(BedSlopeYEnum,values));
    21502192}
    21512193/*}}}*/
    21522194/*FUNCTION Penta::InputUpdateFromSurfaceSlopeXCompute {{{1*/
    21532195void  Penta::InputUpdateFromSurfaceSlopeXCompute(double* solution){
    2154         ISSMERROR(" not supported yet!");
     2196
     2197        int i;
     2198
     2199        const int    numvertices=6;
     2200        const int    numdofpervertex=1;
     2201        const int    numdof=numdofpervertex*numvertices;
     2202
     2203        int          doflist[numdof];
     2204        double       values[numdof];
     2205
     2206        int          dummy;
     2207
     2208        /*Get dof list: */
     2209        GetDofList(&doflist[0],&dummy);
     2210
     2211        /*Use the dof list to index into the solution vector: */
     2212        for(i=0;i<numdof;i++){
     2213                values[i]=solution[doflist[i]];
     2214        }
     2215
     2216        /*Add surfaceslopex as inputs to the tria element: */
     2217        this->inputs->AddInput(new PentaVertexInput(SurfaceSlopeXEnum,values));
    21552218}
    21562219/*}}}*/
    21572220/*FUNCTION Penta::InputUpdateFromSurfaceSlopeYCompute {{{1*/
    21582221void  Penta::InputUpdateFromSurfaceSlopeYCompute(double* solution){
    2159         ISSMERROR(" not supported yet!");
     2222
     2223        int i;
     2224
     2225        const int    numvertices=6;
     2226        const int    numdofpervertex=1;
     2227        const int    numdof=numdofpervertex*numvertices;
     2228
     2229        int          doflist[numdof];
     2230        double       values[numdof];
     2231
     2232        int          dummy;
     2233
     2234        /*Get dof list: */
     2235        GetDofList(&doflist[0],&dummy);
     2236
     2237        /*Use the dof list to index into the solution vector: */
     2238        for(i=0;i<numdof;i++){
     2239                values[i]=solution[doflist[i]];
     2240        }
     2241
     2242        /*Add surfaceslopey as inputs to the tria element: */
     2243        this->inputs->AddInput(new PentaVertexInput(SurfaceSlopeYEnum,values));
    21602244}
    21612245/*}}}*/
    21622246/*FUNCTION Penta::InputUpdateFromSolutionPrognostic {{{1*/
    21632247void  Penta::InputUpdateFromSolutionPrognostic(double* solution){
    2164         ISSMERROR(" not supported yet!");
     2248
     2249        int i;
     2250
     2251        const int    numvertices=6;
     2252        const int    numdofpervertex=1;
     2253        const int    numdof=numdofpervertex*numvertices;
     2254
     2255        int          doflist[numdof];
     2256        double       values[numdof];
     2257
     2258        int          dummy;
     2259
     2260        /*Get dof list: */
     2261        GetDofList(&doflist[0],&dummy);
     2262
     2263        /*Use the dof list to index into the solution vector: */
     2264        for(i=0;i<numdof;i++){
     2265                values[i]=solution[doflist[i]];
     2266        }
     2267
     2268        /*Add thickness as inputs to the tria element: */
     2269        this->inputs->AddInput(new PentaVertexInput(ThicknessEnum,values));
    21652270}
    21662271/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r4392 r4394  
    340340        }
    341341        else if (analysis_type==DiagnosticHorizAnalysisEnum){
     342                InputUpdateFromSolutionDiagnosticHoriz( solution);
     343        }
     344        else if (analysis_type==DiagnosticHutterAnalysisEnum){
    342345                InputUpdateFromSolutionDiagnosticHoriz( solution);
    343346        }
     
    55025505}
    55035506/*}}}*/
     5507/*FUNCTION Tria::InputUpdateFromSolutionDiagnosticHutter {{{1*/
     5508void  Tria::InputUpdateFromSolutionDiagnosticHutter(double* solution){
     5509       
     5510        int i;
     5511
     5512        const int    numvertices=3;
     5513        const int    numdofpervertex=2;
     5514        const int    numdof=numdofpervertex*numvertices;
     5515       
     5516        int          doflist[numdof];
     5517        double       values[numdof];
     5518        double       vx[numvertices];
     5519        double       vy[numvertices];
     5520        double       vz[numvertices];
     5521        double       vel[numvertices];
     5522        double       pressure[numvertices];
     5523        double       thickness[numvertices];
     5524        double       rho_ice,g;
     5525        double       gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}};
     5526
     5527        int          dummy;
     5528        Input*       VzInput=NULL;
     5529        double*      VzPtr=NULL;
     5530       
     5531        /*Get dof list: */
     5532        GetDofList(&doflist[0],&dummy);
     5533
     5534        /*Use the dof list to index into the solution vector: */
     5535        for(i=0;i<numdof;i++){
     5536                values[i]=solution[doflist[i]];
     5537        }
     5538
     5539        /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
     5540        for(i=0;i<numvertices;i++){
     5541                vx[i]=values[i*numdofpervertex+0];
     5542                vy[i]=values[i*numdofpervertex+1];
     5543        }
     5544
     5545        /*Get Vz*/
     5546        VzInput=inputs->GetInput(VzEnum);
     5547        if (VzInput){
     5548                if (VzInput->Enum()!=TriaVertexInputEnum){
     5549                        ISSMERROR("Cannot compute Vel as Vz is of type %s",EnumAsString(VzInput->Enum()));
     5550                }
     5551                VzInput->GetValuesPtr(&VzPtr,&dummy);
     5552                for(i=0;i<numvertices;i++) vz[i]=VzPtr[i];
     5553        }
     5554        else{
     5555                for(i=0;i<numvertices;i++) vz[i]=0.0;
     5556        }
     5557
     5558        /*Now Compute vel*/
     5559        for(i=0;i<numvertices;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);
     5560
     5561        /*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D,
     5562         *so the pressure is just the pressure at the bedrock: */
     5563        rho_ice=matpar->GetRhoIce();
     5564        g=matpar->GetG();
     5565        inputs->GetParameterValues(&thickness[0],&gauss[0][0],3,ThicknessEnum);
     5566       
     5567        for(i=0;i<numvertices;i++){
     5568                pressure[i]=rho_ice*g*thickness[i];
     5569        }
     5570
     5571        /*Now, we have to move the previous Vx and Vy inputs  to old
     5572         * status, otherwise, we'll wipe them off: */
     5573        this->inputs->ChangeEnum(VxEnum,VxOldEnum);
     5574        this->inputs->ChangeEnum(VyEnum,VyOldEnum);
     5575        this->inputs->ChangeEnum(PressureEnum,PressureOldEnum);
     5576
     5577        /*Add vx and vy as inputs to the tria element: */
     5578        this->inputs->AddInput(new TriaVertexInput(VxEnum,vx));
     5579        this->inputs->AddInput(new TriaVertexInput(VyEnum,vy));
     5580        this->inputs->AddInput(new TriaVertexInput(VelEnum,vel));
     5581        this->inputs->AddInput(new TriaVertexInput(PressureEnum,pressure));
     5582
     5583}
     5584/*}}}*/
    55045585/*FUNCTION Tria::InputUpdateFromSolutionBedSlopeX {{{1*/
    55055586void  Tria::InputUpdateFromSolutionBedSlopeX(double* solution){
     
    56175698        int          doflist[numdof];
    56185699        double       values[numdof];
    5619         double       thickness[numvertices];
    56205700
    56215701        int          dummy;
  • issm/trunk/src/c/objects/Elements/Tria.h

    r4382 r4394  
    155155                void      InputUpdateFromSolutionAdjoint( double* solution);
    156156                void      InputUpdateFromSolutionDiagnosticHoriz( double* solution);
     157                void      InputUpdateFromSolutionDiagnosticHutter( double* solution);
    157158                void      InputUpdateFromSolutionBedSlopeX( double* solution);
    158159                void      InputUpdateFromSolutionBedSlopeY( double* solution);
Note: See TracChangeset for help on using the changeset viewer.