Changeset 17359


Ignore:
Timestamp:
02/26/14 20:46:50 (11 years ago)
Author:
Mathieu Morlighem
Message:

NEW: added HO convergence tests

Location:
issm/trunk-jpl/src/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp

    r17341 r17359  
    77#include "../cores/cores.h"
    88
    9 //#define FSANALYTICAL 3
     9//#define FSANALYTICAL 101
    1010
    1111/*Model processing*/
     
    22732273        return Ke;
    22742274}/*}}}*/
     2275#ifdef FSANALYTICAL
     2276ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
     2277
     2278        /*Intermediaries */
     2279        int         dim,meshtype;
     2280        IssmDouble  x_coord,y_coord,z_coord;
     2281        IssmDouble  Jdet,forcex,forcey,forcez;
     2282        IssmDouble* xyz_list = NULL;
     2283
     2284        /*Get problem dimension*/
     2285        element->FindParam(&meshtype,MeshTypeEnum);
     2286        switch(meshtype){
     2287                case Mesh2DverticalEnum: dim = 2; break;
     2288                case Mesh3DEnum:         dim = 3; break;
     2289                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
     2290        }
     2291
     2292        /*Fetch number of nodes and dof for this finite element*/
     2293        int numnodes = element->GetNumberOfNodes();
     2294
     2295        /*Initialize Element vector and vectors*/
     2296        ElementVector* pe=element->NewElementVector(HOApproximationEnum);
     2297        IssmDouble*    basis = xNew<IssmDouble>(numnodes);
     2298
     2299        /*Retrieve all inputs and parameters*/
     2300        element->GetVerticesCoordinates(&xyz_list);
     2301
     2302        /* Start  looping on the number of gaussian points: */
     2303        Gauss* gauss=element->NewGauss(3);
     2304        for(int ig=gauss->begin();ig<gauss->end();ig++){
     2305                gauss->GaussPoint(ig);
     2306
     2307                element->JacobianDeterminant(&Jdet,xyz_list,gauss);
     2308                element->NodalFunctions(basis, gauss);
     2309
     2310                x_coord=element->GetXcoord(gauss);
     2311                y_coord=element->GetYcoord(gauss);
     2312                if(dim==3) z_coord=element->GetZcoord(gauss);
     2313                else z_coord=0.;
     2314
     2315                forcex=fx(x_coord,y_coord,z_coord,FSANALYTICAL);
     2316                forcey=fy(x_coord,y_coord,z_coord,FSANALYTICAL);
     2317
     2318                for(int i=0;i<numnodes;i++){
     2319                        pe->values[i*(dim-1)+0]+=forcex*Jdet*gauss->weight*basis[i];
     2320                        pe->values[i*(dim-1)+1]+=forcey*Jdet*gauss->weight*basis[i];
     2321                }
     2322        }
     2323
     2324        /*Transform coordinate system*/
     2325        if(dim==3) element->TransformLoadVectorCoord(pe,XYEnum);
     2326
     2327        /*Clean up and return*/
     2328        xDelete<IssmDouble>(basis);
     2329        xDelete<IssmDouble>(xyz_list);
     2330        delete gauss;
     2331        return pe;
     2332}/*}}}*/
     2333#else
    22752334ElementVector* StressbalanceAnalysis::CreatePVectorHO(Element* element){/*{{{*/
    22762335
     
    22852344        return pe;
    22862345}/*}}}*/
     2346#endif
    22872347ElementVector* StressbalanceAnalysis::CreatePVectorHODrivingStress(Element* element){/*{{{*/
    22882348
  • issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.cpp

    r17306 r17359  
    3636                case 8:
    3737                        return fx=1.0;
     38
     39                case 101:
     40                        return fx=fx101(x,y,z);
    3841                default:
    3942                        _error_("FS analytical solution"<<testid<<" not implemented yet");
     
    6164                case 8:
    6265                        return fy=1.0;
     66
     67                case 101:
     68                        return fy=fy101(x,y,z);
    6369                default:
    6470                        _error_("FS analytical solution"<<testid<<" not implemented yet");
     
    253259}
    254260/*}}}*/
     261
     262IssmDouble fx101(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
     263
     264   return 4*pow(x, 2)*y*z*pow(x - 1, 2)*(z - 1) + 8*pow(x, 2)*y*z*(y - 1)*(2*y - 1)*(z - 1) + 2*pow(x, 2)*y*pow(x - 1, 2)*(y - 1)*(2*y - 1) + 4*pow(x, 2)*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 2*pow(x, 2)*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 12*x*pow(y, 2)*z*(x - 1)*(y - 1)*(z - 1) - 6*x*pow(y, 2)*z*(2*x - 1)*(y - 1)*(z - 1) - 12*x*y*z*(x - 1)*pow(y - 1, 2)*(z - 1) + 32*x*y*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 6*x*y*z*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 6*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 8*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 6*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
     265}
     266/*}}}*/
     267IssmDouble fy101(IssmDouble x,IssmDouble y,IssmDouble z){   /*{{{*/
     268
     269        return 12*pow(x, 2)*y*z*(x - 1)*(y - 1)*(z - 1) + 6*pow(x, 2)*y*z*(x - 1)*(2*y - 1)*(z - 1) + 6*pow(x, 2)*z*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(z - 1) - 4*x*pow(y, 2)*z*pow(y - 1, 2)*(z - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 12*x*y*z*pow(x - 1, 2)*(y - 1)*(z - 1) + 6*x*y*z*pow(x - 1, 2)*(2*y - 1)*(z - 1) - 32*x*y*z*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 6*x*z*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 8*x*z*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1) - 4*pow(y, 2)*z*(x - 1)*pow(y - 1, 2)*(z - 1) - 2*pow(y, 2)*z*(2*x - 1)*pow(y - 1, 2)*(z - 1);
     270}
     271/*}}}*/
  • issm/trunk-jpl/src/c/shared/FSanalyticals/fsanalyticals.h

    r17306 r17359  
    3030IssmDouble fy7(IssmDouble x_coord, IssmDouble y_coord);
    3131
     32IssmDouble fx101(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
     33IssmDouble fy101(IssmDouble x_coord, IssmDouble y_coord, IssmDouble z_coord);
    3234#endif //ifndef _SHARED_ANALYTICALS_H_
Note: See TracChangeset for help on using the changeset viewer.