Changeset 18992
- Timestamp:
- 01/06/15 16:42:52 (10 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/Loads
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Loads/Friction.cpp
r18991 r18992 42 42 void Friction::GetAlphaComplement(IssmDouble* palpha_complement, Gauss* gauss){/*{{{*/ 43 43 44 switch(this->law){ 45 case 1: 46 GetAlphaViscousComplement(palpha_complement,gauss); 47 break; 48 case 3: 49 GetAlphaHydroComplement(palpha_complement,gauss); 50 break; 51 default: 52 _error_("not supported"); 53 } 54 55 }/*}}}*/ 56 57 void Friction::GetAlphaViscousComplement(IssmDouble* palpha_complement, Gauss* gauss){/*{{{*/ 58 44 59 /* FrictionGetAlpha2 computes alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p. 45 60 * FrictionGetAlphaComplement is used in control methods on drag, and it computes: 46 61 * alpha_complement= Neff ^r * vel ^s*/ 47 48 if(this->law!=1)_error_("not supported");49 62 50 63 /*diverse: */ … … 104 117 } 105 118 /*}}}*/ 119 void Friction::GetAlphaHydroComplement(IssmDouble* palpha_complement, Gauss* gauss){/*{{{*/ 120 121 /*diverse: */ 122 IssmDouble q_exp; 123 IssmDouble C_param; 124 IssmDouble As; 125 IssmDouble Neff; 126 IssmDouble n; 127 IssmDouble alpha; 128 IssmDouble Chi; 129 IssmDouble vx,vy,vz,vmag; 130 IssmDouble alpha_complement; 131 132 /*Recover parameters: */ 133 element->GetInputValue(&q_exp,FrictionQEnum); 134 element->GetInputValue(&C_param,FrictionCEnum); 135 element->GetInputValue(&As,FrictionAsEnum); 136 137 element->GetInputValue(&Neff,gauss,FrictionEffectivePressureEnum); 138 element->GetInputValue(&n,gauss,MaterialsRheologyNEnum); 139 140 if(Neff<0)Neff=0; 141 142 //We need the velocity magnitude to evaluate the basal stress: 143 switch(dim){ 144 case 1: 145 element->GetInputValue(&vx,gauss,VxEnum); 146 vmag=sqrt(vx*vx); 147 break; 148 case 2: 149 element->GetInputValue(&vx,gauss,VxEnum); 150 element->GetInputValue(&vy,gauss,VyEnum); 151 vmag=sqrt(vx*vx+vy*vy); 152 break; 153 case 3: 154 element->GetInputValue(&vx,gauss,VxEnum); 155 element->GetInputValue(&vy,gauss,VyEnum); 156 element->GetInputValue(&vz,gauss,VzEnum); 157 vmag=sqrt(vx*vx+vy*vy+vz*vz); 158 break; 159 default: 160 _error_("not supported"); 161 } 162 if (q_exp==1){ 163 alpha=1; 164 } 165 else{ 166 alpha=(pow(q_exp-1,q_exp-1))/pow(q_exp,q_exp); 167 } 168 Chi=vmag/(pow(C_param,n)*pow(Neff,n)*As); 169 170 /*Check to prevent dividing by zero if vmag==0*/ 171 if(vmag==0.) alpha_complement=0.; 172 else if(Neff==0.) alpha_complement=0.; 173 else alpha_complement=-(C_param*Neff/(vmag*n)) * pow((Chi/(alpha*pow(Chi,q_exp)+1)),((1-n)/n)) *(Chi/(As*(alpha*pow(Chi,q_exp)+1)))-(alpha*q_exp*pow(Chi,q_exp+1)/(As*(alpha*pow(Chi,q_exp)+1))); 174 _assert_(!xIsNan<IssmDouble>(alpha_complement)); 175 /*Assign output pointers:*/ 176 *palpha_complement=alpha_complement; 177 } 178 /*}}}*/ 106 179 void Friction::GetAlpha2(IssmDouble* palpha2, Gauss* gauss){/*{{{*/ 107 180 … … 191 264 } 192 265 Chi=vmag/(pow(C_param,n)*pow(Neff,n)*As); 193 194 266 195 267 /*Check to prevent dividing by zero if vmag==0*/ -
issm/trunk-jpl/src/c/classes/Loads/Friction.h
r18926 r18992 30 30 void Echo(void); 31 31 void GetAlphaComplement(IssmDouble* alpha_complement,Gauss* gauss); 32 void GetAlphaViscousComplement(IssmDouble* alpha_complement,Gauss* gauss); 33 void GetAlphaHydroComplement(IssmDouble* alpha_complement,Gauss* gauss); 32 34 void GetAlpha2(IssmDouble* palpha2,Gauss* gauss); 33 35 void GetAlpha2Hydro(IssmDouble* palpha2,Gauss* gauss);
Note:
See TracChangeset
for help on using the changeset viewer.