Changeset 26148
- Timestamp:
- 03/24/21 11:44:25 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
r26141 r26148 2707 2707 /*MLHO*/ 2708 2708 ElementMatrix* StressbalanceAnalysis::CreateKMatrixMLHO(Element* element){/*{{{*/ 2709 _error_("not implemented yet"); 2710 2709 _error_("not implemented yet"); 2711 2710 /* Check if ice in element */ 2712 2711 if(!element->IsIceInElement()) return NULL; … … 2723 2722 }/*}}}*/ 2724 2723 ElementMatrix* StressbalanceAnalysis::CreateKMatrixMLHOFriction(Element* element){/*{{{*/ 2725 _error_("not implemented yet");2726 2724 2727 2725 if(!element->IsOnBase() || element->IsFloating()) return NULL; … … 2746 2744 }/*}}}*/ 2747 2745 ElementMatrix* StressbalanceAnalysis::CreateKMatrixMLHOViscous(Element* element){/*{{{*/ 2748 _error_("not implemented yet");2749 2746 2750 2747 /*Intermediaries*/ … … 2861 2858 }/*}}}*/ 2862 2859 ElementVector* StressbalanceAnalysis::CreatePVectorMLHO(Element* element){/*{{{*/ 2863 _error_("not implemented yet");2864 2860 2865 2861 /* Check if ice in element */ … … 2895 2891 }/*}}}*/ 2896 2892 ElementVector* StressbalanceAnalysis::CreatePVectorMLHODrivingStress(Element* element){/*{{{*/ 2897 _error_("not implemented yet");2898 2893 2899 2894 /*Intermediaries */ … … 2943 2938 }/*}}}*/ 2944 2939 ElementVector* StressbalanceAnalysis::CreatePVectorMLHOFront(Element* element){/*{{{*/ 2945 _error_("not implemented yet");2946 2940 2947 2941 /*If no front, return NULL*/ … … 2992 2986 pressure = ice_pressure + water_pressure; 2993 2987 /*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 2996 2990 water_pressure_sh = gravity*rho_water*(-b*b/2 + pow(-b,n+2)*( -s/(n+2) -b/(n+3) )/pow(thickness,n+1)); 2997 2991 ice_pressure_sh = gravity*rho_ice*thickness*thickness*(n+1)/(2*(n+3)); … … 3017 3011 }/*}}}*/ 3018 3012 void StressbalanceAnalysis::InputUpdateFromSolutionMLHO(IssmDouble* solution,Element* element){/*{{{*/ 3019 3020 _error_("not implemented yet");3021 3013 3022 3014 int i,dim,domaintype; … … 3056 3048 break; 3057 3049 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; 3061 3054 default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet"); 3062 3055 } … … 3064 3057 /*Fetch number of nodes and dof for this finite element*/ 3065 3058 int numnodes = basalelement->GetNumberOfNodes(); 3066 int numdof = numnodes*2 ;3059 int numdof = numnodes*2*2; //4 DOFs per node 3067 3060 3068 3061 /*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); 3070 3064 IssmDouble* values = xNew<IssmDouble>(numdof); 3071 3065 IssmDouble* vx = xNew<IssmDouble>(numnodes); 3072 3066 IssmDouble* vy = xNew<IssmDouble>(numnodes); 3067 IssmDouble* vshx = xNew<IssmDouble>(numnodes); 3068 IssmDouble* vshy = xNew<IssmDouble>(numnodes); 3073 3069 IssmDouble* vz = xNew<IssmDouble>(numnodes); 3074 3070 IssmDouble* vel = xNew<IssmDouble>(numnodes); 3075 3071 3076 3072 /*Use the dof list to index into the solution vector: */ 3077 3073 for(i=0;i<numdof;i++) values[i]=solution[doflist[i]]; … … 3079 3075 /*Transform solution in Cartesian Space*/ 3080 3076 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]; 3093 3101 } 3094 3102 3095 3103 /*Get Vz and compute vel*/ 3096 3104 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]); 3098 3106 3099 3107 /*Add vx and vy as inputs to the tria element: */ … … 3107 3115 xDelete<IssmDouble>(vy); 3108 3116 xDelete<IssmDouble>(vx); 3117 xDelete<IssmDouble>(vshy); 3118 xDelete<IssmDouble>(vshx); 3109 3119 xDelete<IssmDouble>(values); 3110 3120 xDelete<IssmDouble>(xyz_list);
Note:
See TracChangeset
for help on using the changeset viewer.