Changeset 2223


Ignore:
Timestamp:
09/11/09 16:50:20 (16 years ago)
Author:
Eric.Larour
Message:

Added new steady state control test.
Added reset of stabilization in thermal_core_nonlinear, so that frozen penalties are unfrozen at each
step of a thermal analysis.

Location:
issm/trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Pengrid.cpp

    r2212 r2223  
    6060        printf("   matpar_offset=%i\n",matpar_offset);
    6161       
    62         if(node)node->Echo();
    63         if(matpar)matpar->Echo();
    6462        return;
    6563}
     
    560558        int  dofs1[1]={0};
    561559        int  unstable=0;
     560        int  reset_penalties=0;
    562561       
    563562        ParameterInputs* inputs=NULL;
     
    579578        found=inputs->Recover("temperature",&temperature,1,dofs1,numgrids,(void**)&node);
    580579        if(!found)throw ErrorException(__FUNCT__," could not find temperature in inputs!");
    581 
     580       
     581        found=inputs->Recover("reset_penalties",&reset_penalties);
     582
     583        if(reset_penalties)zigzag_counter=0;
    582584
    583585        //Compute pressure melting point
     
    608610        /*If penalty keeps zigzagging more than 5 times: */
    609611        if(stabilize_constraints){
    610                 if(zigzag_counter>5){
     612                if(zigzag_counter>stabilize_constraints){
    611613                        unstable=0;
    612614                        active=1;
  • issm/trunk/src/c/parallel/control_core.cpp

    r2220 r2223  
    9494                inputs->Add("fit",fit[n]);
    9595
    96                 /*Update parameters: */
    97                 UpdateFromInputsx(fem_model->elements,fem_model->nodes,fem_model->loads, fem_model->materials,inputs);
    98 
    99                 _printf_("%s\n","      computing gradJ...");
    100                 gradjcompute_results=new DataSet(ResultsEnum());
    101                 gradjcompute_core(gradjcompute_results,model, inputs);
    102                 gradjcompute_results->FindResult(&grad_g,"grad_g");
    103                 delete gradjcompute_results;
    104                 _printf_("%s\n","      done.");
    105 
    106                 _printf_("%s\n","      normalizing directions...");
    107                 Orthx(&new_grad_g,grad_g,grad_g_old);
    108                 VecFree(&grad_g); VecFree(&grad_g_old);
    109                 grad_g_old=new_grad_g;
    110                 VecToMPISerial(&grad_g_double,new_grad_g);
    111                 _printf_("%s\n","      done.");
    112 
    113                 _printf_("%s\n","      optimizing along gradient direction...");
    114                 optargs.model=model;
    115                 optargs.param_g=param_g; optargs.grad_g=grad_g_double; optargs.inputs=inputs;optargs.n=n;
    116                 optpars.xmin=0; optpars.xmax=1; optpars.tolerance=tolx; optpars.maxiter=(int)maxiter[n];optpars.cmjump=cmjump[n];
    117                 BrentSearch(&search_scalar,J+n,&optpars,&objectivefunctionC,&optargs);
    118                 _printf_("%s\n","      done.");
    119 
    120                 _printf_("%s\n","      updating parameter using optimized search scalar...");
    121                 for(i=0;i<numberofnodes;i++)param_g[i]=param_g[i]+search_scalar*optscal[n]*grad_g_double[i];
    122                 _printf_("%s\n","      done.");
    123 
    124                 _printf_("%s\n","      constraining the new distribution...");   
    125                 ControlConstrainx(param_g,numberofnodes,mincontrolconstraint,maxcontrolconstraint,control_type);
    126                 _printf_("%s\n","      done.");
    127 
    12896                /*In case we are running a steady state control method, compute new temperature field using new parameter
    12997                 * distribution: */
     
    133101                delete steadystate_results;
    134102                inputs->Add("temperature",t_g,1,numberofnodes);
    135 
     103       
     104                /*Update parameters: */
     105                UpdateFromInputsx(fem_model->elements,fem_model->nodes,fem_model->loads, fem_model->materials,inputs);
     106
     107                _printf_("%s\n","      computing gradJ...");
     108                gradjcompute_results=new DataSet(ResultsEnum());
     109                gradjcompute_core(gradjcompute_results,model, inputs);
     110                gradjcompute_results->FindResult(&grad_g,"grad_g");
     111                delete gradjcompute_results;
     112                _printf_("%s\n","      done.");
     113
     114                _printf_("%s\n","      normalizing directions...");
     115                Orthx(&new_grad_g,grad_g,grad_g_old);
     116                VecFree(&grad_g); VecFree(&grad_g_old);
     117                grad_g_old=new_grad_g;
     118                VecToMPISerial(&grad_g_double,new_grad_g);
     119                _printf_("%s\n","      done.");
     120
     121                _printf_("%s\n","      optimizing along gradient direction...");
     122                optargs.model=model;
     123                optargs.param_g=param_g; optargs.grad_g=grad_g_double; optargs.inputs=inputs;optargs.n=n;
     124                optpars.xmin=0; optpars.xmax=1; optpars.tolerance=tolx; optpars.maxiter=(int)maxiter[n];optpars.cmjump=cmjump[n];
     125                BrentSearch(&search_scalar,J+n,&optpars,&objectivefunctionC,&optargs);
     126                _printf_("%s\n","      done.");
     127
     128                _printf_("%s\n","      updating parameter using optimized search scalar...");
     129                for(i=0;i<numberofnodes;i++)param_g[i]=param_g[i]+search_scalar*optscal[n]*grad_g_double[i];
     130                _printf_("%s\n","      done.");
     131
     132                _printf_("%s\n","      constraining the new distribution...");   
     133                ControlConstrainx(param_g,numberofnodes,mincontrolconstraint,maxcontrolconstraint,control_type);
     134                _printf_("%s\n","      done.");
     135
     136       
     137               
    136138                _printf_("%s%i%s%g\n","      value of misfit J after optimization #",n+1,": ",J[n]);
    137139
  • issm/trunk/src/c/parallel/thermal_core_nonlinear.cpp

    r2008 r2223  
    5858
    5959                if(debug)_printf_("%s\n","starting direct shooting method");
     60
     61                if(count==1) inputs->Add("reset_penalties",1);
     62                else inputs->Add("reset_penalties",0);
    6063
    6164                /*Update parameters: */
  • issm/trunk/src/m/solutions/cielo/control_core.m

    r2221 r2223  
    3333
    3434        disp(sprintf('\n%s%s%s%s\n',['   control method step ' num2str(n) '/' num2str(model.parameters.nsteps)]));
     35
     36        %In case we are running a steady state control method, compute new temperature field using new parameter distribution:
     37        if model.parameters.control_steady;
     38                steadystate_results=steadystate_core(models,inputs); t_g=results.t_g;
     39                inputs=add(inputs,'temperature',t_g,'doublevec',1,model.parameters.numberofnodes);
     40        end
    3541
    3642        %update inputs with new fit
     
    7581        param_g=ControlConstrain(param_g,model.parameters);
    7682
    77         %In case we are running a steady state control method, compute new temperature field using new parameter distribution:
    78         if model.parameters.control_steady;
    79                 steadystate_results=steadystate_core(models,inputs); t_g=results.t_g;
    80                 inputs=add(inputs,'temperature',t_g,'doublevec',1,model.parameters.numberofnodes);
    81         end
    82 
     83       
    8384        disp(['      value of misfit J after optimization #' num2str(n) ':' num2str(c(n).J)]);
    8485
  • issm/trunk/test/Verification/PigControlMethodDragP3d_22/Pig.par

    r2197 r2223  
    5252md.maxiter=10*ones(md.nsteps,1);
    5353md.cmjump=0.3*ones(md.nsteps,1);
     54md.debug=0;
     55md.stabilize_constraints=5;
  • issm/trunk/test/Verification/PigControlMethodDragP3d_22/configuration.m

    r2202 r2223  
    2626                                 {'diagnostic',  'none',      0 ,     1,      'relative',    1    };...
    2727                                 {'diagnostic',  'none',      0 ,     1,      'logarithmic', 1    };...
     28                                 {'steadystate',  'none',      0 ,     1,      'absolute', 1    };...
    2829        };
Note: See TracChangeset for help on using the changeset viewer.