Changeset 2355
- Timestamp:
- 09/29/09 16:42:37 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Tria.cpp
r2354 r2355 2394 2394 /*Build gradje_g_gaussian vector (actually -dJ/ddrag): */ 2395 2395 for (i=0;i<numgrids;i++){ 2396 grade_g_gaussian[i]= 2397 -2*drag*alpha_complement*((lambda*vx+mu*vy))*Jdet*gauss_weight*l1l2l3[i] //standard term dJ/dki 2398 -numpar->cm_noisedmp*Jdet*gauss_weight*(dh1dh2dh3_basic[0][i]*dk[0]+dh1dh2dh3_basic[1][i]*dk[1]); // regularization term d/dki(1/2*(dk/dx)^2) 2396 2397 //standard term dJ/dki 2398 grade_g_gaussian[i]=-2*drag*alpha_complement*((lambda*vx+mu*vy))*Jdet*gauss_weight*l1l2l3[i]; 2399 2400 //noise dampening d/dki(1/2*(dk/dx)^2) 2401 grade_g_gaussian[i]+=-numpar->cm_noisedmp*Jdet*gauss_weight*(dh1dh2dh3_basic[0][i]*dk[0]+dh1dh2dh3_basic[1][i]*dk[1]); 2402 2403 //min dampening 2404 if(drag<numpar->cm_mindmp_value){ 2405 grade_g_gaussian[i]+=numpar->cm_mindmp_slope*Jdet*gauss_weight*l1l2l3[i]; 2406 } 2407 2408 //max dampening 2409 if(drag<numpar->cm_maxdmp_value){ 2410 grade_g_gaussian[i]+= - numpar->cm_maxdmp_slope*Jdet*gauss_weight*l1l2l3[i]; 2411 } 2399 2412 } 2400 2413 … … 2619 2632 2620 2633 //Add regularization term 2621 grade_g_gaussian[i]-=numpar->cm_noisedmp*Jdet*gauss_weight*(dh1dh2dh3_basic[0][i]*dk[0]+dh1dh2dh3_basic[1][i]*dk[1]); 2634 grade_g_gaussian[i]+= - numpar->cm_noisedmp*Jdet*gauss_weight*(dh1dh2dh3_basic[0][i]*dk[0]+dh1dh2dh3_basic[1][i]*dk[1]); 2635 2636 //min dampening 2637 if(drag<numpar->cm_mindmp_value){ 2638 grade_g_gaussian[i]+= numpar->cm_mindmp_slope*Jdet*gauss_weight*l1l2l3[i]; 2639 } 2640 2641 //max dampening 2642 if(drag<numpar->cm_maxdmp_value){ 2643 grade_g_gaussian[i]+= - numpar->cm_maxdmp_slope*Jdet*gauss_weight*l1l2l3[i]; 2644 } 2622 2645 } 2623 2646 … … 2689 2712 double adjy_list[numgrids]; 2690 2713 double adjxadjy_list[numgrids][2]; 2714 double B[numgrids]; 2691 2715 2692 2716 int dofs1[1]={0}; … … 2725 2749 double thickness; 2726 2750 int dofs[1]={0}; 2727 double dk[NDOF2]; 2751 double dB[NDOF2]; 2752 double B_gauss; 2728 2753 2729 2754 ParameterInputs* inputs=NULL; … … 2747 2772 if(!inputs->Recover("adjoint",&adjxadjy_list[0][0],2,dofs2,numgrids,(void**)nodes)){ 2748 2773 throw ErrorException(__FUNCT__,"missing adjoint input parameter"); 2774 } 2775 if(!inputs->Recover("B",&B[0],1,dofs1,numgrids,(void**)nodes)){ 2776 throw ErrorException(__FUNCT__,"parameter B not found in input"); 2749 2777 } 2750 2778 … … 2800 2828 GetNodalFunctionsDerivativesBasic(&dh1dh2dh3_basic[0][0],&xyz_list[0][0],gauss_l1l2l3); 2801 2829 2802 /*Get k derivative: dk/dx */ 2803 GetParameterDerivativeValue(&dk[0], &k[0],&xyz_list[0][0], gauss_l1l2l3); 2830 /*Get B derivative: dB/dx */ 2831 GetParameterDerivativeValue(&dB[0], &B[0],&xyz_list[0][0], gauss_l1l2l3); 2832 GetParameterValue(&B_gauss, &B[0],gauss_l1l2l3); 2804 2833 2805 2834 /*Build gradje_g_gaussian vector (actually -dJ/dB): */ … … 2809 2838 2810 2839 //Add regularization term 2811 grade_g_gaussian[i]-=numpar->cm_noisedmp*Jdet*gauss_weight*(dh1dh2dh3_basic[0][i]*dk[0]+dh1dh2dh3_basic[1][i]*dk[1]); 2840 grade_g_gaussian[i]-=numpar->cm_noisedmp*Jdet*gauss_weight*(dh1dh2dh3_basic[0][i]*dB[0]+dh1dh2dh3_basic[1][i]*dB[1]); 2841 2842 //min dampening 2843 if(B_gauss<numpar->cm_mindmp_value){ 2844 grade_g_gaussian[i]+= numpar->cm_mindmp_slope*Jdet*gauss_weight*l1l2l3[i]; 2845 } 2846 2847 //max dampening 2848 if(B_gauss<numpar->cm_maxdmp_value){ 2849 grade_g_gaussian[i]+= - numpar->cm_maxdmp_slope*Jdet*gauss_weight*l1l2l3[i]; 2850 } 2851 2812 2852 } 2813 2853 … … 2866 2906 double gauss_weight; 2867 2907 double gauss_l1l2l3[3]; 2908 double k_gauss; 2909 double B_gauss; 2868 2910 2869 2911 /* parameters: */ … … 2963 3005 #endif 2964 3006 2965 /*Add dampening term to misfit*/3007 /*Add dampening terms to misfit*/ 2966 3008 if (strcmp(numpar->control_type,"drag")==0){ 2967 3009 if (!shelf){ 3010 3011 //noise dampening 2968 3012 GetParameterDerivativeValue(&dk[0], &k[0],&xyz_list[0][0], gauss_l1l2l3); 2969 3013 Jelem+=numpar->cm_noisedmp*1/2*(pow(dk[0],2)+pow(dk[1],2))*Jdet*gauss_weight; 3014 3015 //min dampening 3016 GetParameterValue(&k_gauss, &k[0],gauss_l1l2l3); 3017 if(k_gauss<numpar->cm_mindmp_value){ 3018 Jelem+=numpar->cm_mindmp_slope*k_gauss*Jdet*gauss_weight; 3019 } 3020 3021 //max dampening 3022 if(k_gauss>numpar->cm_maxdmp_value){ 3023 Jelem+=numpar->cm_maxdmp_slope*k_gauss*Jdet*gauss_weight; 3024 } 2970 3025 } 2971 3026 } … … 2974 3029 throw ErrorException(__FUNCT__,"parameter B not found in input"); 2975 3030 } 3031 //noise dampening 2976 3032 GetParameterDerivativeValue(&dB[0], &B[0],&xyz_list[0][0], gauss_l1l2l3); 2977 3033 Jelem+=numpar->cm_noisedmp*1/2*(pow(dB[0],2)+pow(dB[1],2))*Jdet*gauss_weight; 3034 3035 //min dampening 3036 GetParameterValue(&B_gauss, &B[0],gauss_l1l2l3); 3037 if(B_gauss<numpar->cm_mindmp_value){ 3038 Jelem+=numpar->cm_mindmp_slope*B_gauss*Jdet*gauss_weight; 3039 } 3040 3041 //max dampening 3042 if(B_gauss>numpar->cm_maxdmp_value){ 3043 Jelem+=numpar->cm_maxdmp_slope*B_gauss*Jdet*gauss_weight; 3044 } 2978 3045 } 2979 3046 else{
Note:
See TracChangeset
for help on using the changeset viewer.