Changeset 2760
- Timestamp:
- 01/04/10 16:55:12 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/parallel/control_core.cpp
r2385 r2760 113 113 gradjcompute_results->FindResult(&grad_g,"grad_g"); 114 114 delete gradjcompute_results; 115 _printf_("%s\n"," done."); 116 117 _printf_("%s\n"," normalizing directions..."); 118 Orthx(&new_grad_g,grad_g,grad_g_old); 115 116 /*Normalize if last gradient not satisfying (search_scalar==0)*/ 117 if (n>0 && search_scalar==0){ 118 _printf_("%s"," normalizing directions..."); 119 Orthx(&new_grad_g,grad_g,grad_g_old); 120 _printf_("%s\n"," done."); 121 } 122 else{ 123 VecDuplicate(grad_g,&new_grad_g); 124 VecCopy(grad_g,new_grad_g); 125 } 119 126 VecFree(&grad_g); VecFree(&grad_g_old); 120 127 grad_g_old=new_grad_g; 121 128 VecToMPISerial(&grad_g_double,new_grad_g); 122 _printf_("%s\n"," done."); 123 124 _printf_("%s\n"," optimizing along gradient direction..."); 129 130 _printf_("%s\n"," optimizing along gradient direction"); 125 131 optargs.model=model; 126 132 optargs.param_g=param_g; optargs.grad_g=grad_g_double; optargs.inputs=inputs;optargs.n=n; 127 133 optpars.xmin=0; optpars.xmax=1; optpars.tolerance=tolx; optpars.maxiter=(int)maxiter[n];optpars.cm_jump=cm_jump[n]; 128 134 BrentSearch(&search_scalar,J+n,&optpars,&objectivefunctionC,&optargs); 129 _printf_("%s\n"," done."); 130 131 _printf_("%s\n"," updating parameter using optimized search scalar..."); 135 136 _printf_("%s"," updating parameter using optimized search scalar..."); 132 137 for(i=0;i<numberofnodes;i++)param_g[i]=param_g[i]+search_scalar*optscal[n]*grad_g_double[i]; 133 _printf_("%s\n"," 134 135 _printf_("%s \n"," constraining the new distribution...");138 _printf_("%s\n"," done."); 139 140 _printf_("%s"," constraining the new distribution..."); 136 141 ControlConstrainx(param_g,numberofnodes,cm_min,cm_max,control_type); 137 _printf_("%s\n"," 142 _printf_("%s\n"," done."); 138 143 139 144 _printf_("%s%i%s%g\n"," value of misfit J after optimization #",n+1,": ",J[n]); … … 167 172 //some temporary saving 168 173 if (((n+1)%5)==0){ 169 _printf_("%s \n"," saving temporary results...");174 _printf_("%s"," saving temporary results..."); 170 175 ControlRestart(model,param_g); 171 _printf_("%s\n"," 176 _printf_("%s\n"," done."); 172 177 } 173 178 } 174 179 175 180 /*Write results to disk: */ 176 _printf_("%s \n"," preparing final velocity solution...");181 _printf_("%s"," preparing final velocity solution"); 177 182 /*Launch diagnostic with the last parameter distribution*/ 178 183 if (control_steady){
Note:
See TracChangeset
for help on using the changeset viewer.