Changeset 4753
- Timestamp:
- 07/22/10 14:20:34 (15 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Tria.cpp
r4739 r4753 2940 2940 2941 2941 /*inputs: */ 2942 Input* thickness_input=NULL; 2943 Input* vx_input=NULL; 2944 Input* vy_input=NULL; 2945 Input* vxold_input=NULL; 2946 Input* vyold_input=NULL; 2942 2947 bool onwater,shelf; 2943 2948 … … 2958 2963 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ 2959 2964 GaussTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2); 2965 2966 /*Retrieve all inputs we will be needing: */ 2967 thickness_input=inputs->GetInput(ThicknessEnum); 2968 vx_input=inputs->GetInput(VxEnum); 2969 vy_input=inputs->GetInput(VyEnum); 2970 vxold_input=inputs->GetInput(VxOldEnum); 2971 vyold_input=inputs->GetInput(VyOldEnum); 2960 2972 2961 2973 /* Start looping on the number of gaussian points: */ … … 2969 2981 2970 2982 /*Compute thickness at gaussian point: */ 2971 inputs->GetParameterValue(&thickness, gauss_l1l2l3,ThicknessEnum);2983 thickness_input->GetParameterValue(&thickness, gauss_l1l2l3); 2972 2984 2973 2985 /*Get strain rate from velocity: */ 2974 inputs->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss_l1l2l3,VxEnum,VyEnum);2975 inputs->GetStrainRate2d(&oldepsilon[0],&xyz_list[0][0],gauss_l1l2l3,VxOldEnum,VyOldEnum);2986 this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss_l1l2l3,vx_input,vy_input); 2987 this->GetStrainRate2d(&oldepsilon[0],&xyz_list[0][0],gauss_l1l2l3,vxold_input,vyold_input); 2976 2988 2977 2989 /*Get viscosity: */ … … 3073 3085 bool shelf; 3074 3086 int drag_type; 3087 Input* surface_input=NULL; 3075 3088 3076 3089 /*retrive parameters: */ … … 3080 3093 inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum); 3081 3094 inputs->GetParameterValue(&drag_type,DragTypeEnum); 3095 surface_input=inputs->GetInput(SurfaceEnum); 3082 3096 3083 3097 /* Get node coordinates and dof list: */ … … 3114 3128 GetParameterValue(&alpha2,&alpha2_list[0],gauss_l1l2l3); // TO BE DELETED 3115 3129 3116 3117 3130 // If we have a slope > 6% for this element, it means we are on a mountain. In this particular case, 3118 3131 //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */ 3119 inputs->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0],SurfaceEnum);3132 surface_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0]); 3120 3133 slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2)); 3121 3134 … … 4212 4225 bool onwater; 4213 4226 int drag_type; 4227 Input* thickness_input=NULL; 4228 Input* surface_input=NULL; 4229 Input* drag_input=NULL; 4214 4230 4215 4231 /*retrieve inputs :*/ 4216 4232 inputs->GetParameterValue(&onwater,ElementOnWaterEnum); 4217 4233 inputs->GetParameterValue(&drag_type,DragTypeEnum); 4234 thickness_input=inputs->GetInput(ThicknessEnum); 4235 surface_input=inputs->GetInput(SurfaceEnum); 4236 drag_input=inputs->GetInput(DragCoefficientEnum); 4218 4237 4219 4238 /*First, if we are on water, return empty vector: */ … … 4237 4256 4238 4257 /*Compute thickness at gaussian point: */ 4239 inputs->GetParameterValue(&thickness, &gauss_l1l2l3[0],ThicknessEnum);4240 inputs->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0],SurfaceEnum);4258 thickness_input->GetParameterValue(&thickness, &gauss_l1l2l3[0]); 4259 surface_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0]); 4241 4260 4242 4261 /*In case we have plastic basal drag, compute plastic stress at gaussian point from k1, k2 and k3 fields in the 4243 4262 * element itself: */ 4244 4263 if(drag_type==1){ 4245 inputs->GetParameterValue(&plastic_stress, &gauss_l1l2l3[0],DragCoefficientEnum);4264 drag_input->GetParameterValue(&plastic_stress, &gauss_l1l2l3[0]); 4246 4265 } 4247 4266 … … 5473 5492 /*Add value to global vector*/ 5474 5493 VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES); 5494 5495 } 5496 /*}}}*/ 5497 /*FUNCTION Tria::GetStrainRate2d{{{1*/ 5498 void Tria::GetStrainRate2d(double* epsilon,double* xyz_list, double* gauss, Input* vx_input, Input* vy_input){ 5499 /*Compute the 2d Strain Rate (3 components): 5500 * 5501 * epsilon=[exx eyy exy] 5502 */ 5503 5504 int i; 5505 5506 double epsilonvx[3]; 5507 double epsilonvy[3]; 5508 5509 /*Check that both inputs have been found*/ 5510 if (!vx_input || !vy_input){ 5511 ISSMERROR("Input missing. Here are the input pointers we have for vx: %p, vy: %p\n",vx_input,vy_input); 5512 } 5513 5514 /*Get strain rate assuming that epsilon has been allocated*/ 5515 vx_input->GetVxStrainRate2d(epsilonvx,xyz_list,gauss); 5516 vy_input->GetVyStrainRate2d(epsilonvy,xyz_list,gauss); 5517 5518 /*Sum all contributions*/ 5519 for(i=0;i<3;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i]; 5475 5520 5476 5521 } -
issm/trunk/src/c/objects/Elements/Tria.h
r4739 r4753 153 153 void GetParameterDerivativeValue(double* p, double* plist,double* xyz_list, double* gauss_l1l2l3); 154 154 void GetParameterValue(double* pp, double* plist, double* gauss_l1l2l3); 155 void GetParameterValue(double* pvalue,Node* node,int enumtype);156 void GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,int enumtype);155 void GetParameterValue(double* pvalue,Node* node,int enumtype); 156 void GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,int enumtype); 157 157 void GetSolutionFromInputsDiagnosticHoriz(Vec solution); 158 158 void GetSolutionFromInputsAdjointHoriz(Vec solution); 159 159 void GetSolutionFromInputsDiagnosticHutter(Vec solution); 160 void GetStrainRate2d(double* epsilon,double* xyz_list, double* gauss, Input* vx_input, Input* vy_input); 160 161 void GradjDragStokes(Vec gradient); 161 162 void InputUpdateFromSolutionAdjointHoriz( double* solution);
Note:
See TracChangeset
for help on using the changeset viewer.