Changeset 18496
- Timestamp:
- 09/10/14 14:13:42 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/SeaiceAnalysis.cpp
r18492 r18496 39 39 iomodel->FetchDataToInput(elements,VxEnum); 40 40 iomodel->FetchDataToInput(elements,VyEnum); 41 iomodel->FetchDataToInput(elements,SeaiceCoriolisFactorEnum); 41 42 }/*}}}*/ 42 43 void SeaiceAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ … … 73 74 74 75 /*Intermediaries */ 75 IssmDouble Jdet,D_scalar,dt ;76 IssmDouble Jdet,D_scalar,dt,thickness,concentration; 76 77 IssmDouble C[3][3]; 77 78 IssmDouble* xyz_list = NULL; … … 89 90 element->GetVerticesCoordinates(&xyz_list); 90 91 element->FindParam(&dt,TimesteppingTimeStepEnum); 92 IssmDouble rho_i = element->GetMaterialParameter(MaterialsRhoIceEnum); 93 Input* thickness_input = element->GetInput(SeaiceThicknessEnum); _assert_(thickness_input); 91 94 92 95 /* Start looping on the number of gaussian points: */ … … 95 98 96 99 gauss->GaussPoint(ig); 100 101 /*Get Jacobian Determinant and thickness*/ 97 102 element->JacobianDeterminant(&Jdet,xyz_list,gauss); 103 thickness_input->GetInputValue(&thickness,gauss); 104 concentration_input->GetInputValue(&concentration,gauss); 98 105 99 106 /*Create first part of the stiffness matrix*/ 100 107 this->GetM(M,element,xyz_list,gauss); 101 D_scalar= gauss->weight*Jdet;108 D_scalar=rho_i*thickness*gauss->weight*Jdet; 102 109 TripleMultiply(M,1,numdof,1, 103 110 &D_scalar,1,1,0, … … 117 124 B,3,numdof,0, 118 125 &Ke->values[0],1); 126 127 /*Create Coriolis part*/ 119 128 } 120 129 … … 133 142 134 143 /*Intermediaries */ 135 IssmDouble concentration,thickness,dt,Jdet,vx,vy; 136 IssmDouble rho_air,air_coef,air_lin_drag_coef,air_quad_drag_coef; 137 IssmDouble windvx,windvy,wind_vnorm; 144 IssmDouble air_coef,ocean_coef,constant_part; 145 IssmDouble rho_ice,rho_air,rho_ocean,gravity; 146 IssmDouble vx,vy,vxstar,vystar,windvx,windvy,oceanvx,oceanvy,vnorm; 147 IssmDouble air_lin_drag_coef,air_quad_drag_coef; 148 IssmDouble ocean_lin_drag_coef,ocean_quad_drag_coef; 149 IssmDouble concentration,thickness,coriolis_factor,dt,Jdet; 150 IssmDouble ocean_turning_angle,dssh[2]; 138 151 IssmDouble* xyz_list = NULL; 139 152 … … 153 166 element->FindParam(&air_lin_drag_coef,SurfaceforcingsAirLinDragCoefEnum); 154 167 element->FindParam(&air_quad_drag_coef,SurfaceforcingsAirQuadDragCoefEnum); 168 element->FindParam(&rho_ocean,BasalforcingsRhoOceanEnum); 169 element->FindParam(&ocean_coef,BasalforcingsOceanCoefEnum); 170 element->FindParam(&ocean_lin_drag_coef,BasalforcingsOceanLinDragCoefEnum); 171 element->FindParam(&ocean_quad_drag_coef,BasalforcingsOceanQuadDragCoefEnum); 172 element->FindParam(&ocean_quad_drag_coef,BasalforcingsOceanQuadDragCoefEnum); 173 element->FindParam(&ocean_turning_angle,BasalforcingsOceanTurningAngleEnum); 174 rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum); 175 gravity = element->GetMaterialParameter(ConstantsGEnum); 176 Input* thickness_input = element->GetInput(SeaiceThicknessEnum); _assert_(thickness_input); 177 Input* coriolis_fact_input = element->GetInput(SeaiceCoriolisFactorEnum); _assert_(coriolis_fact_input); 155 178 Input* vx_input = element->GetInput(VxEnum); _assert_(vx_input); 156 179 Input* vy_input = element->GetInput(VyEnum); _assert_(vy_input); 180 Input* vxstar_input = element->GetInput(VxStarEnum); _assert_(vxstar_input); 181 Input* vystar_input = element->GetInput(VyStarEnum); _assert_(vystar_input); 157 182 Input* windvx_input = element->GetInput(SurfaceforcingsWindVxEnum); _assert_(windvx_input); 158 183 Input* windvy_input = element->GetInput(SurfaceforcingsWindVyEnum); _assert_(windvy_input); 159 Input* thickness_input = element->GetInput(SeaiceThicknessEnum); _assert_(thickness_input); 184 Input* oceanvx_input = element->GetInput(BasalforcingsOceanVxEnum); _assert_(oceanvx_input); 185 Input* oceanvy_input = element->GetInput(BasalforcingsOceanVyEnum); _assert_(oceanvy_input); 186 Input* oceanssh_input = element->GetInput(BasalforcingsOceanSshEnum); _assert_(oceanssh_input); 160 187 161 188 /* Start looping on the number of gaussian points: */ … … 168 195 element->NodalFunctions(basis, gauss); 169 196 197 /*Get all inputs on gauss point*/ 170 198 thickness_input->GetInputValue(&thickness,gauss); 171 199 concentration_input->GetInputValue(&concentration,gauss); 200 coriolis_fact_input->GetInputValue(&coriolis_factor,gauss); 172 201 vx_input->GetInputValue(&vx,gauss); 173 202 vy_input->GetInputValue(&vy,gauss); 203 vxstar_input->GetInputValue(&vxstar,gauss); 204 vystar_input->GetInputValue(&vystar,gauss); 174 205 windvx_input->GetInputValue(&windvx,gauss); 175 206 windvy_input->GetInputValue(&windvy,gauss); 207 oceanvx_input->GetInputValue(&oceanvx,gauss); 208 oceanvy_input->GetInputValue(&oceanvy,gauss); 209 oceanssh_input->GetInputDerivativeValue(&dssh[2],xyz_list,gauss); 210 211 /*Previous speed (finite differencing)*/ 212 for(int i=0;i<numnodes;i++){ 213 pe->values[i*2+0]+=Jdet*gauss->weight*rho_ice*thickness*vx*basis[i]; 214 pe->values[i*2+1]+=Jdet*gauss->weight*rho_ice*thickness*vy*basis[i]; 215 } 176 216 177 217 /*Atmespheric forcing*/ 178 wind_vnorm= sqrt(windvx*windvx + windvy*windvy);179 218 vnorm = sqrt(windvx*windvx + windvy*windvy); 219 constant_part = concentration*air_coef*rho_air*(air_lin_drag_coef+air_quad_drag_coef*vnorm); 180 220 for(int i=0;i<numnodes;i++){ 181 pe->values[i*2+0] += dt*concentration*air_coef*rho_air*(air_lin_drag_coef+air_quad_drag_coef*wind_vnorm)*windvx*Jdet*gauss->weight*basis[i]; 182 pe->values[i*2+1] += dt*concentration*air_coef*rho_air*(air_lin_drag_coef+air_quad_drag_coef*wind_vnorm)*windvy*Jdet*gauss->weight*basis[i]; 221 pe->values[i*2+0] += dt*constant_part*windvx*Jdet*gauss->weight*basis[i]; 222 pe->values[i*2+1] += dt*constant_part*windvy*Jdet*gauss->weight*basis[i]; 223 } 224 225 /*Ocean forcing*/ 226 vnorm = sqrt(pow(oceanvx-vx,2) + pow(oceanvy-vy,2)); 227 constant_part = concentration*air_coef*rho_air*(air_lin_drag_coef+air_quad_drag_coef*vnorm); 228 for(int i=0;i<numnodes;i++){ 229 pe->values[i*2+0] += dt*constant_part*(oceanvy-vy)*sin(ocean_turning_angle)*Jdet*gauss->weight*basis[i]; 230 pe->values[i*2+1] += dt*constant_part*(vx-oceanvx)*sin(ocean_turning_angle)*Jdet*gauss->weight*basis[i]; 231 232 pe->values[i*2+0] += dt*constant_part*oceanvx*cos(ocean_turning_angle)*Jdet*gauss->weight*basis[i]; 233 pe->values[i*2+1] += dt*constant_part*oceanvy*cos(ocean_turning_angle)*Jdet*gauss->weight*basis[i]; 234 } 235 236 /*Coriolis forces (use ustar)*/ 237 for(int i=0;i<numnodes;i++){ 238 pe->values[i*2+0] += dt*(-rho_ice*thickness*coriolis_factor*vystar)*Jdet*gauss->weight*basis[i]; 239 pe->values[i*2+1] += dt*(+rho_ice*thickness*coriolis_factor*vxstar)*Jdet*gauss->weight*basis[i]; 240 241 pe->values[i*2+0] += dt*(-rho_ice*thickness*gravity*dssh[0])*Jdet*gauss->weight*basis[i]; 242 pe->values[i*2+1] += dt*(-rho_ice*thickness*gravity*dssh[1])*Jdet*gauss->weight*basis[i]; 183 243 } 184 244 }
Note:
See TracChangeset
for help on using the changeset viewer.