Changeset 5636
- Timestamp:
- 08/31/10 13:44:43 (15 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk/src/c/objects/Elements/Tria.cpp ¶
r5635 r5636 1931 1931 1932 1932 /* gaussian points: */ 1933 int num_gauss,ig; 1934 double* first_gauss_area_coord = NULL; 1935 double* second_gauss_area_coord = NULL; 1936 double* third_gauss_area_coord = NULL; 1937 double* gauss_weights = NULL; 1938 double gauss_weight; 1939 double gauss_l1l2l3[3]; 1933 int ig; 1934 GaussTria *gauss=NULL; 1940 1935 1941 1936 /* parameters: */ … … 2008 2003 } 2009 2004 2010 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */2011 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);2012 2013 2005 /* Start looping on the number of gaussian points: */ 2014 for (ig=0; ig<num_gauss; ig++){ 2015 /*Pick up the gaussian point: */ 2016 gauss_weight=*(gauss_weights+ig); 2017 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 2018 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 2019 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 2020 2021 /* Get Jacobian determinant: */ 2022 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss_l1l2l3); 2023 2024 /*Compute misfit at gaussian point: */ 2025 TriaRef::GetParameterValue(&misfit, &misfit_list[0],gauss_l1l2l3); 2026 2027 /*compute SurfaceRelVelMisfit*/ 2028 Jelem+=misfit*Jdet*gauss_weight; 2029 } 2030 2031 xfree((void**)&first_gauss_area_coord); 2032 xfree((void**)&second_gauss_area_coord); 2033 xfree((void**)&third_gauss_area_coord); 2034 xfree((void**)&gauss_weights); 2035 2036 /*Return: */ 2006 gauss=new GaussTria(2); 2007 for (ig=gauss->begin();ig<gauss->end();ig++){ 2008 2009 gauss->GaussPoint(ig); 2010 2011 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 2012 TriaRef::GetParameterValue(&misfit, &misfit_list[0],gauss); 2013 Jelem+=misfit*Jdet*gauss->weight; 2014 } 2015 2016 /*clean up and Return: */ 2017 delete gauss; 2037 2018 return Jelem; 2038 2019 } … … 2062 2043 2063 2044 /* gaussian points: */ 2064 int num_gauss,ig; 2065 double* first_gauss_area_coord = NULL; 2066 double* second_gauss_area_coord = NULL; 2067 double* third_gauss_area_coord = NULL; 2068 double* gauss_weights = NULL; 2069 double gauss_weight; 2070 double gauss_l1l2l3[3]; 2045 int ig; 2046 GaussTria *gauss=NULL; 2071 2047 2072 2048 /* parameters: */ … … 2083 2059 /*inputs: */ 2084 2060 bool onwater; 2085 2086 2061 double meanvel, epsvel; 2087 2062 … … 2137 2112 } 2138 2113 2139 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */2140 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);2141 2142 2114 /* Start looping on the number of gaussian points: */ 2143 for (ig=0; ig<num_gauss; ig++){ 2144 /*Pick up the gaussian point: */ 2145 gauss_weight=*(gauss_weights+ig); 2146 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 2147 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 2148 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 2149 2150 /* Get Jacobian determinant: */ 2151 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss_l1l2l3); 2152 2153 /*Compute misfit at gaussian point: */ 2154 TriaRef::GetParameterValue(&misfit, &misfit_list[0],gauss_l1l2l3); 2155 2156 /*compute SurfaceLogVelMisfit*/ 2157 Jelem+=misfit*Jdet*gauss_weight; 2158 } 2159 2160 xfree((void**)&first_gauss_area_coord); 2161 xfree((void**)&second_gauss_area_coord); 2162 xfree((void**)&third_gauss_area_coord); 2163 xfree((void**)&gauss_weights); 2164 2165 /*Return: */ 2115 gauss=new GaussTria(2); 2116 for (ig=gauss->begin();ig<gauss->end();ig++){ 2117 2118 gauss->GaussPoint(ig); 2119 2120 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 2121 TriaRef::GetParameterValue(&misfit, &misfit_list[0],gauss); 2122 Jelem+=misfit*Jdet*gauss->weight; 2123 } 2124 2125 /*clean-up and Return: */ 2126 delete gauss; 2166 2127 return Jelem; 2167 2128 } … … 2191 2152 2192 2153 /* gaussian points: */ 2193 int num_gauss,ig; 2194 double* first_gauss_area_coord = NULL; 2195 double* second_gauss_area_coord = NULL; 2196 double* third_gauss_area_coord = NULL; 2197 double* gauss_weights = NULL; 2198 double gauss_weight; 2199 double gauss_l1l2l3[3]; 2154 int ig; 2155 GaussTria *gauss=NULL; 2200 2156 2201 2157 /* parameters: */ … … 2268 2224 } 2269 2225 2270 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */2271 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);2272 2273 2226 /* Start looping on the number of gaussian points: */ 2274 for (ig=0; ig<num_gauss; ig++){ 2275 /*Pick up the gaussian point: */ 2276 gauss_weight=*(gauss_weights+ig); 2277 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 2278 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 2279 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 2280 2281 /* Get Jacobian determinant: */ 2282 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss_l1l2l3); 2283 2284 /*Compute misfit at gaussian point: */ 2285 TriaRef::GetParameterValue(&misfit, &misfit_list[0],gauss_l1l2l3); 2286 2287 /*compute SurfaceLogVxVyMisfit*/ 2288 Jelem+=misfit*Jdet*gauss_weight; 2289 } 2290 2291 xfree((void**)&first_gauss_area_coord); 2292 xfree((void**)&second_gauss_area_coord); 2293 xfree((void**)&third_gauss_area_coord); 2294 xfree((void**)&gauss_weights); 2295 2296 /*Return: */ 2227 gauss=new GaussTria(2); 2228 for (ig=gauss->begin();ig<gauss->end();ig++){ 2229 2230 gauss->GaussPoint(ig); 2231 2232 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 2233 TriaRef::GetParameterValue(&misfit, &misfit_list[0],gauss); 2234 Jelem+=misfit*Jdet*gauss->weight; 2235 } 2236 2237 /*clean-up and Return: */ 2238 delete gauss; 2297 2239 return Jelem; 2298 2240 } … … 2322 2264 2323 2265 /* gaussian points: */ 2324 int num_gauss,ig; 2325 double* first_gauss_area_coord = NULL; 2326 double* second_gauss_area_coord = NULL; 2327 double* third_gauss_area_coord = NULL; 2328 double* gauss_weights = NULL; 2329 double gauss_weight; 2330 double gauss_l1l2l3[3]; 2266 int ig; 2267 GaussTria *gauss=NULL; 2331 2268 2332 2269 /* parameters: */ … … 2398 2335 } 2399 2336 2400 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */2401 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);2402 2403 2337 /* Start looping on the number of gaussian points: */ 2404 for (ig=0; ig<num_gauss; ig++){ 2405 /*Pick up the gaussian point: */ 2406 gauss_weight=*(gauss_weights+ig); 2407 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 2408 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 2409 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 2410 2411 /* Get Jacobian determinant: */ 2412 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss_l1l2l3); 2413 2414 /*Compute misfit at gaussian point: */ 2415 TriaRef::GetParameterValue(&misfit, &misfit_list[0],gauss_l1l2l3); 2416 2417 /*compute SurfaceAverageVelMisfit*/ 2418 Jelem+=misfit*Jdet*gauss_weight; 2419 } 2420 2421 xfree((void**)&first_gauss_area_coord); 2422 xfree((void**)&second_gauss_area_coord); 2423 xfree((void**)&third_gauss_area_coord); 2424 xfree((void**)&gauss_weights); 2425 2426 /*Return: */ 2338 gauss=new GaussTria(2); 2339 for (ig=gauss->begin();ig<gauss->end();ig++){ 2340 2341 gauss->GaussPoint(ig); 2342 2343 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 2344 TriaRef::GetParameterValue(&misfit, &misfit_list[0],gauss); 2345 Jelem+=misfit*Jdet*gauss->weight; 2346 } 2347 2348 /*clean-up and Return: */ 2349 delete gauss; 2427 2350 return Jelem; 2428 2351 } … … 2434 2357 int row; 2435 2358 int vertices_ids[3]; 2436 2437 2359 2438 2360 /*recover pointer: */ … … 2779 2701 2780 2702 /* gaussian points: */ 2781 int num_gauss,ig; 2782 double* first_gauss_area_coord = NULL; 2783 double* second_gauss_area_coord = NULL; 2784 double* third_gauss_area_coord = NULL; 2785 double* gauss_weights = NULL; 2786 double gauss_weight; 2787 double gauss_l1l2l3[3]; 2703 int ig; 2704 GaussTria *gauss=NULL; 2788 2705 2789 2706 /* matrices: */ … … 2839 2756 if(artdiff){ 2840 2757 //Get the Jacobian determinant 2841 gauss_l1l2l3[0]=ONETHIRD; gauss_l1l2l3[1]=ONETHIRD; gauss_l1l2l3[2]=ONETHIRD; 2842 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss_l1l2l3); 2758 gauss=new GaussTria(); 2759 gauss->GaussCenter(); 2760 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 2761 delete gauss; 2843 2762 2844 2763 //Build K matrix (artificial diffusivity matrix) … … 2850 2769 } 2851 2770 2852 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */2853 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);2854 2855 2771 /* Start looping on the number of gaussian points: */ 2856 for (ig=0; ig<num_gauss; ig++){ 2857 /*Pick up the gaussian point: */ 2858 gauss_weight=*(gauss_weights+ig); 2859 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 2860 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 2861 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 2772 gauss=new GaussTria(2); 2773 for (ig=gauss->begin();ig<gauss->end();ig++){ 2774 2775 gauss->GaussPoint(ig); 2862 2776 2863 2777 /* Get Jacobian determinant: */ 2864 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss _l1l2l3);2778 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 2865 2779 2866 2780 /*Get B and B prime matrix: */ 2867 GetBPrognostic(&B[0][0], &xyz_list[0][0], gauss _l1l2l3);2868 GetBprimePrognostic(&Bprime[0][0], &xyz_list[0][0], gauss _l1l2l3);2781 GetBPrognostic(&B[0][0], &xyz_list[0][0], gauss); 2782 GetBprimePrognostic(&Bprime[0][0], &xyz_list[0][0], gauss); 2869 2783 2870 2784 //Get vx, vy and their derivatives at gauss point 2871 vxaverage_input->GetParameterValue(&vx, &gauss_l1l2l3[0]);2872 vyaverage_input->GetParameterValue(&vy, &gauss_l1l2l3[0]);2873 2874 vxaverage_input->GetParameterDerivativeValue(&dvx[0],&xyz_list[0][0], &gauss_l1l2l3[0]);2875 vyaverage_input->GetParameterDerivativeValue(&dvy[0],&xyz_list[0][0], &gauss_l1l2l3[0]);2785 vxaverage_input->GetParameterValue(&vx,gauss); 2786 vyaverage_input->GetParameterValue(&vy,gauss); 2787 2788 vxaverage_input->GetParameterDerivativeValue(&dvx[0],&xyz_list[0][0],gauss); 2789 vyaverage_input->GetParameterDerivativeValue(&dvy[0],&xyz_list[0][0],gauss); 2876 2790 2877 2791 dvxdx=dvx[0]; 2878 2792 dvydy=dvy[1]; 2879 2793 2880 DL_scalar=gauss _weight*Jdettria;2794 DL_scalar=gauss->weight*Jdettria; 2881 2795 2882 2796 //Create DL and DLprime matrix … … 2924 2838 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES); 2925 2839 2926 xfree((void**)&first_gauss_area_coord); 2927 xfree((void**)&second_gauss_area_coord); 2928 xfree((void**)&third_gauss_area_coord); 2929 xfree((void**)&gauss_weights); 2840 /*Clean up*/ 2841 delete gauss; 2930 2842 xfree((void**)&doflist); 2931 2843 } … … 2945 2857 2946 2858 /* gaussian points: */ 2947 int num_gauss,ig; 2948 double* first_gauss_area_coord = NULL; 2949 double* second_gauss_area_coord = NULL; 2950 double* third_gauss_area_coord = NULL; 2951 double* gauss_weights = NULL; 2952 double gauss_weight; 2953 double gauss_l1l2l3[3]; 2859 int ig; 2860 GaussTria *gauss=NULL; 2954 2861 2955 2862 /* matrices: */ … … 2977 2884 this->parameters->FindParam(&dim,DimEnum); 2978 2885 2979 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */2980 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);2981 2982 2886 /*Retrieve all inputs we will be needed*/ 2983 2887 if(dim==2){ … … 2987 2891 2988 2892 /* Start looping on the number of gaussian points: */ 2989 for (ig=0; ig<num_gauss; ig++){ 2990 /*Pick up the gaussian point: */ 2991 gauss_weight=*(gauss_weights+ig); 2992 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 2993 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 2994 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 2893 gauss=new GaussTria(2); 2894 for (ig=gauss->begin();ig<gauss->end();ig++){ 2895 2896 gauss->GaussPoint(ig); 2995 2897 2996 2898 /* Get Jacobian determinant: */ 2997 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss _l1l2l3);2899 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 2998 2900 2999 2901 /*Get B and B prime matrix: */ 3000 2902 /*WARNING: B and Bprime are inverted compared to usual prognostic!!!!*/ 3001 GetBPrognostic(&Bprime[0][0], &xyz_list[0][0], gauss _l1l2l3);3002 GetBprimePrognostic(&B[0][0], &xyz_list[0][0], gauss _l1l2l3);2903 GetBPrognostic(&Bprime[0][0], &xyz_list[0][0], gauss); 2904 GetBprimePrognostic(&B[0][0], &xyz_list[0][0], gauss); 3003 2905 3004 2906 //Get vx, vy and their derivatives at gauss point 3005 vx_input->GetParameterValue(&vx, &gauss_l1l2l3[0]);3006 vy_input->GetParameterValue(&vy, &gauss_l1l2l3[0]);3007 3008 DL_scalar=-gauss _weight*Jdettria;2907 vx_input->GetParameterValue(&vx,gauss); 2908 vy_input->GetParameterValue(&vy,gauss); 2909 2910 DL_scalar=-gauss->weight*Jdettria; 3009 2911 3010 2912 DLprime[0][0]=DL_scalar*vx; … … 3025 2927 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES); 3026 2928 3027 xfree((void**)&first_gauss_area_coord); 3028 xfree((void**)&second_gauss_area_coord); 3029 xfree((void**)&third_gauss_area_coord); 3030 xfree((void**)&gauss_weights); 2929 /*Clean up and return*/ 2930 delete gauss; 3031 2931 xfree((void**)&doflist); 3032 2932 } … … 3046 2946 3047 2947 /* gaussian points: */ 3048 int num_gauss,ig; 3049 double* first_gauss_area_coord = NULL; 3050 double* second_gauss_area_coord = NULL; 3051 double* third_gauss_area_coord = NULL; 3052 double* gauss_weights = NULL; 3053 double gauss_weight; 3054 double gauss_l1l2l3[3]; 2948 int ig; 2949 GaussTria *gauss=NULL; 3055 2950 3056 2951 /* matrices: */ … … 3129 3024 if(artdiff){ 3130 3025 //Get the Jacobian determinant 3131 gauss_l1l2l3[0]=ONETHIRD; gauss_l1l2l3[1]=ONETHIRD; gauss_l1l2l3[2]=ONETHIRD; 3132 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss_l1l2l3); 3026 gauss=new GaussTria(); 3027 gauss->GaussCenter(); 3028 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 3029 delete gauss; 3133 3030 3134 3031 //Build K matrix (artificial diffusivity matrix) … … 3140 3037 } 3141 3038 3142 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */3143 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);3144 3145 3039 /* Start looping on the number of gaussian points: */ 3146 for (ig=0; ig<num_gauss; ig++){ 3147 /*Pick up the gaussian point: */ 3148 gauss_weight=*(gauss_weights+ig); 3149 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 3150 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 3151 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 3040 gauss=new GaussTria(2); 3041 for (ig=gauss->begin();ig<gauss->end();ig++){ 3042 3043 gauss->GaussPoint(ig); 3152 3044 3153 3045 /* Get Jacobian determinant: */ 3154 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss _l1l2l3);3046 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 3155 3047 3156 3048 /*Get B and B prime matrix: */ 3157 GetBPrognostic(&B[0][0], &xyz_list[0][0], gauss _l1l2l3);3158 GetBprimePrognostic(&Bprime[0][0], &xyz_list[0][0], gauss _l1l2l3);3049 GetBPrognostic(&B[0][0], &xyz_list[0][0], gauss); 3050 GetBprimePrognostic(&Bprime[0][0], &xyz_list[0][0], gauss); 3159 3051 3160 3052 //Get vx, vy and their derivatives at gauss point 3161 vxaverage_input->GetParameterValue(&vx, &gauss_l1l2l3[0]);3162 vyaverage_input->GetParameterValue(&vy, &gauss_l1l2l3[0]);3163 3164 vxaverage_input->GetParameterDerivativeValue(&dvx[0],&xyz_list[0][0], &gauss_l1l2l3[0]);3165 vyaverage_input->GetParameterDerivativeValue(&dvy[0],&xyz_list[0][0], &gauss_l1l2l3[0]);3053 vxaverage_input->GetParameterValue(&vx,gauss); 3054 vyaverage_input->GetParameterValue(&vy,gauss); 3055 3056 vxaverage_input->GetParameterDerivativeValue(&dvx[0],&xyz_list[0][0],gauss); 3057 vyaverage_input->GetParameterDerivativeValue(&dvy[0],&xyz_list[0][0],gauss); 3166 3058 3167 3059 dvxdx=dvx[0]; 3168 3060 dvydy=dvy[1]; 3169 3061 3170 DL_scalar=gauss _weight*Jdettria;3062 DL_scalar=gauss->weight*Jdettria; 3171 3063 3172 3064 DLprime[0][0]=DL_scalar*nx; … … 3204 3096 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES); 3205 3097 3206 xfree((void**)&first_gauss_area_coord); 3207 xfree((void**)&second_gauss_area_coord); 3208 xfree((void**)&third_gauss_area_coord); 3209 xfree((void**)&gauss_weights); 3098 /*Clean up and return*/ 3099 delete gauss; 3210 3100 xfree((void**)&doflist); 3211 3101 } … … 3224 3114 3225 3115 /* gaussian points: */ 3226 int num_gauss,ig; 3227 double* first_gauss_area_coord = NULL; 3228 double* second_gauss_area_coord = NULL; 3229 double* third_gauss_area_coord = NULL; 3230 double* gauss_weights = NULL; 3231 double gauss_weight; 3232 double gauss_l1l2l3[3]; 3116 int ig; 3117 GaussTria *gauss=NULL; 3233 3118 3234 3119 /* material data: */ … … 3281 3166 GetDofList(&doflist,MacAyealApproximationEnum); 3282 3167 3283 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */3284 GaussLegendreTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);3285 3286 3168 /*Retrieve all inputs we will be needing: */ 3287 3169 thickness_input=inputs->GetInput(ThicknessEnum); … … 3292 3174 3293 3175 /* Start looping on the number of gaussian points: */ 3294 for (ig=0; ig<num_gauss; ig++){ 3295 /*Pick up the gaussian point: */ 3296 gauss_weight=*(gauss_weights+ig); 3297 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 3298 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 3299 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 3300 3176 gauss=new GaussTria(2); 3177 for (ig=gauss->begin();ig<gauss->end();ig++){ 3178 3179 gauss->GaussPoint(ig); 3301 3180 3302 3181 /*Compute thickness at gaussian point: */ 3303 thickness_input->GetParameterValue(&thickness, gauss _l1l2l3);3182 thickness_input->GetParameterValue(&thickness, gauss); 3304 3183 3305 3184 /*Get strain rate from velocity: */ 3306 this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss _l1l2l3,vx_input,vy_input);3307 this->GetStrainRate2d(&oldepsilon[0],&xyz_list[0][0],gauss _l1l2l3,vxold_input,vyold_input);3185 this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input); 3186 this->GetStrainRate2d(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input); 3308 3187 3309 3188 /*Get viscosity: */ … … 3312 3191 3313 3192 /* Get Jacobian determinant: */ 3314 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss _l1l2l3);3193 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 3315 3194 3316 3195 /* Build the D matrix: we plug the gaussian weight, the thickness, the viscosity, and the jacobian determinant 3317 3196 onto this scalar matrix, so that we win some computational time: */ 3318 3197 newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity); 3319 D_scalar=2*newviscosity*thickness*gauss _weight*Jdet;3198 D_scalar=2*newviscosity*thickness*gauss->weight*Jdet; 3320 3199 3321 3200 for (i=0;i<3;i++){ … … 3324 3203 3325 3204 /*Get B and Bprime matrices: */ 3326 GetBMacAyeal(&B[0][0], &xyz_list[0][0], gauss _l1l2l3);3327 GetBprimeMacAyeal(&Bprime[0][0], &xyz_list[0][0], gauss _l1l2l3);3205 GetBMacAyeal(&B[0][0], &xyz_list[0][0], gauss); 3206 GetBprimeMacAyeal(&Bprime[0][0], &xyz_list[0][0], gauss); 3328 3207 3329 3208 /* Do the triple product tB*D*Bprime: */ … … 3346 3225 } 3347 3226 3348 xfree((void**)&first_gauss_area_coord); 3349 xfree((void**)&second_gauss_area_coord); 3350 xfree((void**)&third_gauss_area_coord); 3351 xfree((void**)&gauss_weights); 3227 3228 /*Clean up and return*/ 3229 delete gauss; 3352 3230 xfree((void**)&doflist); 3353 3231 } … … 6949 6827 /*}}}1*/ 6950 6828 /*FUNCTION Tria::SurfaceNormal{{{1*/ 6951 6952 6829 void Tria::SurfaceNormal(double* surface_normal, double xyz_list[3][3]){ 6953 6830 … … 6972 6849 *(surface_normal+1)=normal[1]/normal_norm; 6973 6850 *(surface_normal+2)=normal[2]/normal_norm; 6974 6975 } 6976 /*}}}*/ 6851 } 6852 /*}}}*/ -
TabularUnified issm/trunk/src/c/objects/Elements/TriaRef.cpp ¶
r5631 r5636 149 149 } 150 150 /*}}}*/ 151 /*FUNCTION TriaRef::GetBPrognostic{{{1*/ 152 void TriaRef::GetBPrognostic(double* B_prog, double* xyz_list, GaussTria* gauss){ 153 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 154 * For grid i, Bi can be expressed in the actual coordinate system 155 * by: 156 * Bi=[ h ] 157 * [ h ] 158 * where h is the interpolation function for grid i. 159 * 160 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numgrids) 161 */ 162 163 int i; 164 const int NDOF1=1; 165 const int numgrids=3; 166 167 double l1l2l3[numgrids]; 168 169 170 /*Get dh1dh2dh3 in actual coordinate system: */ 171 GetNodalFunctions(&l1l2l3[0],gauss); 172 173 /*Build B_prog: */ 174 for (i=0;i<numgrids;i++){ 175 *(B_prog+NDOF1*numgrids*0+NDOF1*i)=l1l2l3[i]; 176 *(B_prog+NDOF1*numgrids*1+NDOF1*i)=l1l2l3[i]; 177 } 178 } 179 /*}}}*/ 151 180 /*FUNCTION TriaRef::GetBprimeMacAyeal {{{1*/ 152 181 void TriaRef::GetBprimeMacAyeal(double* Bprime, double* xyz_list, double* gauss){ … … 184 213 } 185 214 /*}}}*/ 215 /*FUNCTION TriaRef::GetBprimeMacAyeal {{{1*/ 216 void TriaRef::GetBprimeMacAyeal(double* Bprime, double* xyz_list, GaussTria* gauss){ 217 218 /*Compute B' matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 219 * For grid i, Bi' can be expressed in the actual coordinate system 220 * by: 221 * Bi_prime=[ 2*dh/dx dh/dy ] 222 * [ dh/dx 2*dh/dy ] 223 * [ dh/dy dh/dx ] 224 * where h is the interpolation function for grid i. 225 * 226 * We assume B' has been allocated already, of size: 3x(NDOF2*numgrids) 227 */ 228 229 int i; 230 const int NDOF2=2; 231 const int numgrids=3; 232 233 /*Same thing in the actual coordinate system: */ 234 double dh1dh3[NDOF2][numgrids]; 235 236 /*Get dh1dh2dh3 in actual coordinates system : */ 237 GetNodalFunctionsDerivatives(&dh1dh3[0][0],xyz_list,gauss); 238 239 /*Build B': */ 240 for (i=0;i<numgrids;i++){ 241 *(Bprime+NDOF2*numgrids*0+NDOF2*i)=2*dh1dh3[0][i]; 242 *(Bprime+NDOF2*numgrids*0+NDOF2*i+1)=dh1dh3[1][i]; 243 *(Bprime+NDOF2*numgrids*1+NDOF2*i)=dh1dh3[0][i]; 244 *(Bprime+NDOF2*numgrids*1+NDOF2*i+1)=2*dh1dh3[1][i]; 245 *(Bprime+NDOF2*numgrids*2+NDOF2*i)=dh1dh3[1][i]; 246 *(Bprime+NDOF2*numgrids*2+NDOF2*i+1)=dh1dh3[0][i]; 247 } 248 } 249 /*}}}*/ 186 250 /*FUNCTION TriaRef::GetBprimePrognostic{{{1*/ 187 251 void TriaRef::GetBprimePrognostic(double* Bprime_prog, double* xyz_list, double* gauss){ 252 /*Compute B' matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 253 * For grid i, Bi' can be expressed in the actual coordinate system 254 * by: 255 * Bi_prime=[ dh/dx ] 256 * [ dh/dy ] 257 * where h is the interpolation function for grid i. 258 * 259 * We assume B' has been allocated already, of size: 3x(NDOF2*numgrids) 260 */ 261 262 int i; 263 const int NDOF1=1; 264 const int NDOF2=2; 265 const int numgrids=3; 266 267 /*Same thing in the actual coordinate system: */ 268 double dh1dh3[NDOF2][numgrids]; 269 270 /*Get dh1dh2dh3 in actual coordinates system : */ 271 GetNodalFunctionsDerivatives(&dh1dh3[0][0],xyz_list,gauss); 272 273 /*Build B': */ 274 for (i=0;i<numgrids;i++){ 275 *(Bprime_prog+NDOF1*numgrids*0+NDOF1*i)=dh1dh3[0][i]; 276 *(Bprime_prog+NDOF1*numgrids*1+NDOF1*i)=dh1dh3[1][i]; 277 } 278 } 279 /*}}}*/ 280 /*FUNCTION TriaRef::GetBprimePrognostic{{{1*/ 281 void TriaRef::GetBprimePrognostic(double* Bprime_prog, double* xyz_list, GaussTria* gauss){ 188 282 /*Compute B' matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 189 283 * For grid i, Bi' can be expressed in the actual coordinate system -
TabularUnified issm/trunk/src/c/objects/Elements/TriaRef.h ¶
r5631 r5636 28 28 void GetBMacAyeal(double* B, double* xyz_list, GaussTria* gauss); 29 29 void GetBprimeMacAyeal(double* Bprime, double* xyz_list, double* gauss); 30 void GetBprimeMacAyeal(double* Bprime, double* xyz_list, GaussTria* gauss); 30 31 void GetBprimePrognostic(double* Bprime_prog, double* xyz_list, double* gauss); 32 void GetBprimePrognostic(double* Bprime_prog, double* xyz_list, GaussTria* gauss); 31 33 void GetBPrognostic(double* B_prog, double* xyz_list, double* gauss); 34 void GetBPrognostic(double* B_prog, double* xyz_list, GaussTria* gauss); 32 35 void GetL(double* L, double* xyz_list,double* gauss,int numdof); 33 36 void GetL(double* L, double* xyz_list,GaussTria* gauss,int numdof);
Note:
See TracChangeset
for help on using the changeset viewer.