Changeset 26148


Ignore:
Timestamp:
03/24/21 11:44:25 (4 years ago)
Author:
tsantos
Message:

CHG: working on mono layer HO

File:
1 edited

Legend:

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

    r26141 r26148  
    27072707/*MLHO*/
    27082708ElementMatrix* StressbalanceAnalysis::CreateKMatrixMLHO(Element* element){/*{{{*/
    2709         _error_("not implemented yet");
    2710 
     2709_error_("not implemented yet");
    27112710        /* Check if ice in element */
    27122711        if(!element->IsIceInElement()) return NULL;
     
    27232722}/*}}}*/
    27242723ElementMatrix* StressbalanceAnalysis::CreateKMatrixMLHOFriction(Element* element){/*{{{*/
    2725         _error_("not implemented yet");
    27262724
    27272725        if(!element->IsOnBase() || element->IsFloating()) return NULL;
     
    27462744}/*}}}*/
    27472745ElementMatrix* StressbalanceAnalysis::CreateKMatrixMLHOViscous(Element* element){/*{{{*/
    2748         _error_("not implemented yet");
    27492746
    27502747        /*Intermediaries*/
     
    28612858}/*}}}*/
    28622859ElementVector* StressbalanceAnalysis::CreatePVectorMLHO(Element* element){/*{{{*/
    2863         _error_("not implemented yet");
    28642860
    28652861        /* Check if ice in element */
     
    28952891}/*}}}*/
    28962892ElementVector* StressbalanceAnalysis::CreatePVectorMLHODrivingStress(Element* element){/*{{{*/
    2897         _error_("not implemented yet");
    28982893
    28992894        /*Intermediaries */
     
    29432938}/*}}}*/
    29442939ElementVector* StressbalanceAnalysis::CreatePVectorMLHOFront(Element* element){/*{{{*/
    2945         _error_("not implemented yet");
    29462940
    29472941        /*If no front, return NULL*/
     
    29922986                pressure = ice_pressure + water_pressure;
    29932987                /*Vertically integrated pressure - HO type*/
    2994                 s=max(0.,thickness+base-sealevel);
    2995                 b=min(0.,base-sealevel);
     2988                b=min(0.,base-sealevel); // 0 if the bottom of the glacier is above water level
     2989                s=thickness+b; // ice surface regardless of whether the top of the glacier is above water level or not
    29962990                water_pressure_sh = gravity*rho_water*(-b*b/2 + pow(-b,n+2)*( -s/(n+2) -b/(n+3) )/pow(thickness,n+1));
    29972991                ice_pressure_sh   = gravity*rho_ice*thickness*thickness*(n+1)/(2*(n+3));
     
    30173011}/*}}}*/
    30183012void           StressbalanceAnalysis::InputUpdateFromSolutionMLHO(IssmDouble* solution,Element* element){/*{{{*/
    3019 
    3020         _error_("not implemented yet");
    30213013
    30223014        int         i,dim,domaintype;
     
    30563048                        break;
    30573049                case Domain3DEnum:
    3058                         if(!element->IsOnBase()){xDelete<IssmDouble>(xyz_list); return;}
    3059                         basalelement=element->SpawnBasalElement();
    3060                         break;
     3050                        _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
     3051                        //if(!element->IsOnBase()){xDelete<IssmDouble>(xyz_list); return;}
     3052                        //basalelement=element->SpawnBasalElement();
     3053                        //break;
    30613054                default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
    30623055        }
     
    30643057        /*Fetch number of nodes and dof for this finite element*/
    30653058        int numnodes = basalelement->GetNumberOfNodes();
    3066         int numdof   = numnodes*2;
     3059        int numdof   = numnodes*2*2; //4 DOFs per node
    30673060
    30683061        /*Fetch dof list and allocate solution vectors*/
    3069         basalelement->GetDofListLocal(&doflist,NoneApproximationEnum,GsetEnum);
     3062        basalelement->GetDofListLocal(&doflist,MLHOApproximationEnum,GsetEnum); //itapopo check this
     3063        //basalelement->GetDofListLocal(&doflist,NoneApproximationEnum,GsetEnum);
    30703064        IssmDouble* values    = xNew<IssmDouble>(numdof);
    30713065        IssmDouble* vx        = xNew<IssmDouble>(numnodes);
    30723066        IssmDouble* vy        = xNew<IssmDouble>(numnodes);
     3067   IssmDouble* vshx      = xNew<IssmDouble>(numnodes);
     3068   IssmDouble* vshy      = xNew<IssmDouble>(numnodes);
    30733069        IssmDouble* vz        = xNew<IssmDouble>(numnodes);
    30743070        IssmDouble* vel       = xNew<IssmDouble>(numnodes);
    3075 
     3071       
    30763072        /*Use the dof list to index into the solution vector: */
    30773073        for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
     
    30793075        /*Transform solution in Cartesian Space*/
    30803076        basalelement->TransformSolutionCoord(&values[0],XYEnum);
    3081         basalelement->FindParam(&domaintype,DomainTypeEnum);
    3082 
    3083         /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
    3084         for(i=0;i<numnodes;i++){
    3085                 vx[i]=values[i*2+0];
    3086                 vy[i]=values[i*2+1];
    3087 
    3088                 /*Check solution*/
    3089                 if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
    3090                 if(xIsInf<IssmDouble>(vx[i])) _error_("Inf found in solution vector");
    3091                 if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
    3092                 if(xIsInf<IssmDouble>(vy[i])) _error_("Inf found in solution vector");
     3077        //basalelement->FindParam(&domaintype,DomainTypeEnum);
     3078
     3079   /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
     3080   for(i=0;i<numnodes;i++){ //numnodes of the 2D mesh in which the MLHO is written
     3081      vx[i]  =values[i+0*numnodes]; //basal vx
     3082      vshx[i]=values[i+1*numnodes];
     3083                if(xIsNan<IssmDouble>(vx[i]))           _error_("NaN found in solution vector");
     3084      if(xIsInf<IssmDouble>(vx[i]))             _error_("Inf found in solution vector");
     3085                if(xIsNan<IssmDouble>(vshx[i])) _error_("NaN found in solution vector");
     3086      if(xIsInf<IssmDouble>(vshx[i]))   _error_("Inf found in solution vector");
     3087      //if(dim==3){
     3088         vy[i] =values[i+2*numnodes];
     3089         vshy[i]=values[i+3*numnodes];
     3090         if(xIsNan<IssmDouble>(vy[i]))          _error_("NaN found in solution vector");
     3091         if(xIsInf<IssmDouble>(vy[i]))          _error_("Inf found in solution vector");
     3092         if(xIsNan<IssmDouble>(vshy[i]))        _error_("NaN found in solution vector");
     3093         if(xIsInf<IssmDouble>(vshy[i]))        _error_("Inf found in solution vector");
     3094      //}
     3095   }
     3096
     3097        /*Compute suface velocities vx and vy*/
     3098        if(domaintype==Domain2DhorizontalEnum) {
     3099                for(i=0;i<numnodes;i++) vx[i]=vx[i]+vshx[i];
     3100                for(i=0;i<numnodes;i++) vy[i]=vy[i]+vshy[i];
    30933101        }
    30943102
    30953103        /*Get Vz and compute vel*/
    30963104        basalelement->GetInputListOnNodes(&vz[0],VzEnum,0.);
    3097         for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
     3105        for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]); 
    30983106
    30993107        /*Add vx and vy as inputs to the tria element: */
     
    31073115        xDelete<IssmDouble>(vy);
    31083116        xDelete<IssmDouble>(vx);
     3117        xDelete<IssmDouble>(vshy);
     3118        xDelete<IssmDouble>(vshx);
    31093119        xDelete<IssmDouble>(values);
    31103120        xDelete<IssmDouble>(xyz_list);
Note: See TracChangeset for help on using the changeset viewer.