Changeset 18184
- Timestamp:
- 06/25/14 12:14:09 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/analyses
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp ¶
r18182 r18184 2855 2855 if(fe_FS==XTaylorHoodEnum) 2856 2856 Ke1=CreateKMatrixFSViscousXTH(element); 2857 else if(fe_FS==LATaylorHoodEnum) {2857 else if(fe_FS==LATaylorHoodEnum) 2858 2858 Ke1=CreateKMatrixFSViscousLATH(element); 2859 }2860 2859 else 2861 2860 Ke1=CreateKMatrixFSViscous(element); … … 2902 2901 IssmDouble* B = xNew<IssmDouble>(epssize*numdof); 2903 2902 IssmDouble* Bprime = xNew<IssmDouble>(epssize*numdof); 2904 IssmDouble* BtBUzawa = xNew <IssmDouble>(numdof*pnumdof);2903 IssmDouble* BtBUzawa = xNewZeroInit<IssmDouble>(numdof*pnumdof); 2905 2904 IssmDouble* BU = xNew<IssmDouble>(pnumdof); 2906 2905 IssmDouble* BprimeU = xNew<IssmDouble>(numdof); … … 2920 2919 2921 2920 element->JacobianDeterminant(&Jdet,xyz_list,gauss); 2922 this->GetBFS (B,element,dim,xyz_list,gauss);2923 this->GetBFSprime (Bprime,element,dim,xyz_list,gauss);2921 this->GetBFSvel(B,element,dim,xyz_list,gauss); 2922 this->GetBFSprimevel(Bprime,element,dim,xyz_list,gauss); 2924 2923 2925 2924 element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input); … … 4121 4120 xDelete<IssmDouble>(pbasis); 4122 4121 }/*}}}*/ 4122 void StressbalanceAnalysis::GetBFSvel(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 4123 /*Compute B matrix. B=[Bv1 Bv2 ... Bp1 Bp2 ...] where Bvi is of size 3*NDOF3. 4124 * For node i, Bvi can be expressed in the actual coordinate system 4125 * by: Bvi=[ dphi/dx 0 ] 4126 * [ 0 dphi/dy ] 4127 * [ 1/2*dphi/dy 1/2*dphi/dx] 4128 * 4129 * 4130 * In 3d: 4131 * Bvi=[ dh/dx 0 0 ] 4132 * [ 0 dh/dy 0 ] 4133 * [ 0 0 dh/dz ] 4134 * [ 1/2*dh/dy 1/2*dh/dx 0 ] 4135 * [ 1/2*dh/dz 0 1/2*dh/dx ] 4136 * [ 0 1/2*dh/dz 1/2*dh/dy ] 4137 * 4138 * where phi is the finiteelement function for node i. 4139 * Same thing for Bb except the last column that does not exist. 4140 */ 4141 4142 /*Fetch number of nodes for this finite element*/ 4143 int vnumnodes = element->NumberofNodesVelocity(); 4144 4145 /*Get nodal functions derivatives*/ 4146 IssmDouble* vdbasis=xNew<IssmDouble>(dim*vnumnodes); 4147 element->NodalFunctionsDerivativesVelocity(vdbasis,xyz_list,gauss); 4148 4149 /*Build B: */ 4150 if(dim==2){ 4151 for(int i=0;i<vnumnodes;i++){ 4152 B[(dim*vnumnodes)*0+dim*i+0] = vdbasis[0*vnumnodes+i]; 4153 B[(dim*vnumnodes)*0+dim*i+1] = 0.; 4154 B[(dim*vnumnodes)*1+dim*i+0] = 0.; 4155 B[(dim*vnumnodes)*1+dim*i+1] = vdbasis[1*vnumnodes+i]; 4156 B[(dim*vnumnodes)*2+dim*i+0] = .5*vdbasis[1*vnumnodes+i]; 4157 B[(dim*vnumnodes)*2+dim*i+1] = .5*vdbasis[0*vnumnodes+i]; 4158 } 4159 } 4160 else{ 4161 for(int i=0;i<vnumnodes;i++){ 4162 B[(dim*vnumnodes)*0+dim*i+0] = vdbasis[0*vnumnodes+i]; 4163 B[(dim*vnumnodes)*0+dim*i+1] = 0.; 4164 B[(dim*vnumnodes)*0+dim*i+2] = 0.; 4165 B[(dim*vnumnodes)*1+dim*i+0] = 0.; 4166 B[(dim*vnumnodes)*1+dim*i+1] = vdbasis[1*vnumnodes+i]; 4167 B[(dim*vnumnodes)*1+dim*i+2] = 0.; 4168 B[(dim*vnumnodes)*2+dim*i+0] = 0.; 4169 B[(dim*vnumnodes)*2+dim*i+1] = 0.; 4170 B[(dim*vnumnodes)*2+dim*i+2] = vdbasis[2*vnumnodes+i]; 4171 B[(dim*vnumnodes)*3+dim*i+0] = .5*vdbasis[1*vnumnodes+i]; 4172 B[(dim*vnumnodes)*3+dim*i+1] = .5*vdbasis[0*vnumnodes+i]; 4173 B[(dim*vnumnodes)*3+dim*i+2] = 0.; 4174 B[(dim*vnumnodes)*4+dim*i+0] = .5*vdbasis[2*vnumnodes+i]; 4175 B[(dim*vnumnodes)*4+dim*i+1] = 0.; 4176 B[(dim*vnumnodes)*4+dim*i+2] = .5*vdbasis[0*vnumnodes+i]; 4177 B[(dim*vnumnodes)*5+dim*i+0] = 0.; 4178 B[(dim*vnumnodes)*5+dim*i+1] = .5*vdbasis[2*vnumnodes+i]; 4179 B[(dim*vnumnodes)*5+dim*i+2] = .5*vdbasis[1*vnumnodes+i]; 4180 } 4181 } 4182 4183 /*Clean up*/ 4184 xDelete<IssmDouble>(vdbasis); 4185 }/*}}}*/ 4186 void StressbalanceAnalysis::GetBFSprimevel(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 4187 /* Compute B' matrix. B'=[B1' B2' B3' B4' B5' B6' Bb'] where Bi' is of size 3*NDOF2. 4188 * For node i, Bi' can be expressed in the actual coordinate system 4189 * by: 4190 * Bvi' = [ dphi/dx 0 ] 4191 * [ 0 dphi/dy ] 4192 * [ dphi/dy dphi/dx ] 4193 * 4194 * In 3d 4195 * Bvi=[ dh/dx 0 0 ] 4196 * [ 0 dh/dy 0 ] 4197 * [ 0 0 dh/dz ] 4198 * [ dh/dy dh/dx 0 ] 4199 * [ dh/dz 0 dh/dx ] 4200 * [ 0 dh/dz dh/dy ] 4201 * where phi is the finiteelement function for node i. 4202 * In 3d: 4203 */ 4204 4205 /*Fetch number of nodes for this finite element*/ 4206 int vnumnodes = element->NumberofNodesVelocity(); 4207 4208 /*Get nodal functions derivatives*/ 4209 IssmDouble* vdbasis=xNew<IssmDouble>(dim*vnumnodes); 4210 element->NodalFunctionsDerivativesVelocity(vdbasis,xyz_list,gauss); 4211 4212 /*Build B_prime: */ 4213 if(dim==2){ 4214 for(int i=0;i<vnumnodes;i++){ 4215 Bprime[(dim*vnumnodes)*0+dim*i+0] = vdbasis[0*vnumnodes+i]; 4216 Bprime[(dim*vnumnodes)*0+dim*i+1] = 0.; 4217 Bprime[(dim*vnumnodes)*1+dim*i+0] = 0.; 4218 Bprime[(dim*vnumnodes)*1+dim*i+1] = vdbasis[1*vnumnodes+i]; 4219 Bprime[(dim*vnumnodes)*2+dim*i+0] = vdbasis[1*vnumnodes+i]; 4220 Bprime[(dim*vnumnodes)*2+dim*i+1] = vdbasis[0*vnumnodes+i]; 4221 } 4222 } 4223 else{ 4224 for(int i=0;i<vnumnodes;i++){ 4225 Bprime[(dim*vnumnodes)*0+dim*i+0] = vdbasis[0*vnumnodes+i]; 4226 Bprime[(dim*vnumnodes)*0+dim*i+1] = 0.; 4227 Bprime[(dim*vnumnodes)*0+dim*i+2] = 0.; 4228 Bprime[(dim*vnumnodes)*1+dim*i+0] = 0.; 4229 Bprime[(dim*vnumnodes)*1+dim*i+1] = vdbasis[1*vnumnodes+i]; 4230 Bprime[(dim*vnumnodes)*1+dim*i+2] = 0.; 4231 Bprime[(dim*vnumnodes)*2+dim*i+0] = 0.; 4232 Bprime[(dim*vnumnodes)*2+dim*i+1] = 0.; 4233 Bprime[(dim*vnumnodes)*2+dim*i+2] = vdbasis[2*vnumnodes+i]; 4234 Bprime[(dim*vnumnodes)*3+dim*i+0] = vdbasis[1*vnumnodes+i]; 4235 Bprime[(dim*vnumnodes)*3+dim*i+1] = vdbasis[0*vnumnodes+i]; 4236 Bprime[(dim*vnumnodes)*3+dim*i+2] = 0.; 4237 Bprime[(dim*vnumnodes)*4+dim*i+0] = vdbasis[2*vnumnodes+i]; 4238 Bprime[(dim*vnumnodes)*4+dim*i+1] = 0.; 4239 Bprime[(dim*vnumnodes)*4+dim*i+2] = vdbasis[0*vnumnodes+i]; 4240 Bprime[(dim*vnumnodes)*5+dim*i+0] = 0.; 4241 Bprime[(dim*vnumnodes)*5+dim*i+1] = vdbasis[2*vnumnodes+i]; 4242 Bprime[(dim*vnumnodes)*5+dim*i+2] = vdbasis[1*vnumnodes+i]; 4243 } 4244 } 4245 4246 /*Clean up*/ 4247 xDelete<IssmDouble>(vdbasis); 4248 }/*}}}*/ 4123 4249 void StressbalanceAnalysis::GetBFSUzawa(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 4124 4250 /*Compute B matrix. B=[Bp1 Bp2 ...] where Bpi=phi_pi. … … 4284 4410 /*Add value to global vector*/ 4285 4411 solution->SetValues(vnumdof,vdoflist,vvalues,INS_VAL); 4286 solution->SetValues(pnumdof,pdoflist,pvalues,INS_VAL);4412 if(pnumdof>0) solution->SetValues(pnumdof,pdoflist,pvalues,INS_VAL); 4287 4413 4288 4414 /*Free ressources:*/ -
TabularUnified issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h ¶
r18179 r18184 81 81 void GetBFS(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 82 82 void GetBFSprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 83 void GetBFSvel(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 84 void GetBFSprimevel(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 83 85 void GetBFSFriction(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 84 86 void GetBFSUzawa(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
Note:
See TracChangeset
for help on using the changeset viewer.