Changeset 1825 for issm/trunk


Ignore:
Timestamp:
08/24/09 17:46:16 (16 years ago)
Author:
Eric.Larour
Message:

Brachning back from issm.controlstatic, by hand

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/parallel/objectivefunctionC.cpp

    r1805 r1825  
    2323       
    2424        /*parameters: */
     25        Model*    model=NULL;
    2526        FemModel* femmodel=NULL;
    2627        double* param_g=NULL;
     
    4142        int     sub_analysis_type;
    4243        Vec     u_g=NULL;
     44        Vec     u_g_full=NULL;
    4345        double* u_g_double=NULL;
    4446        int     numberofnodes;
     47               
     48        /*thermalstatic: */
     49        int     thermalstatic=0;
     50        int     isstokes=0;
     51        DataSet* results_thermalstatic=NULL;
     52        int dofs01[2]={0,1};
    4553
     54        /*Recover active model: */
     55        model=optargs->model;
     56        femmodel=model->Active();
    4657
    4758        /*Recover parameters: */
    48         femmodel=optargs->femmodel;
    4959        param_g=optargs->param_g;
    5060        grad_g=optargs->grad_g;
     
    6272        femmodel->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
    6373        femmodel->parameters->FindParam((void*)&numberofdofspernode,"numberofdofspernode");
     74        femmodel->parameters->FindParam((void*)&thermalstatic,"thermalstatic");
     75        femmodel->parameters->FindParam((void*)&isstokes,"isstokes");
    6476
    6577        /*First copy param_g so we don't modify it: */
     
    7688        inputs->Add(control_type,param_g_copy,1,numberofnodes);
    7789
    78         //Run diagnostic with updated parameters.
    79         diagnostic_core_nonlinear(&u_g,NULL,NULL,NULL,femmodel,inputs,DiagnosticAnalysisEnum(),sub_analysis_type);
    80         VecToMPISerial(&u_g_double,u_g); VecFree(&u_g);
     90        if(!thermalstatic){
     91                //Run diagnostic with updated parameters.
     92                diagnostic_core_nonlinear(&u_g,NULL,NULL,femmodel,inputs,DiagnosticAnalysisEnum(),sub_analysis_type);
     93                VecToMPISerial(&u_g_double,u_g); VecFree(&u_g);
     94        }
     95        else{
     96                //Run full thermalstatic solution with updated parameters.
     97                results_thermalstatic=new DataSet(ResultsEnum());
     98                thermalstatic_core(results_thermalstatic,model,inputs);
     99               
     100                //get u_g
     101                results_thermalstatic->FindResult(&u_g,"u_g");
     102                delete results_thermalstatic;
     103
     104                //extract the correct number of dofs (3 or 4)
     105                VecDuplicatePatch(&u_g_full,u_g);VecFree(&u_g);
     106                if(!isstokes)VecPartition(&u_g, u_g_full, dofsetgen(2,dofs01,3,numberofnodes*3), numberofnodes*2);
     107                VecFree(&u_g_full);
     108        }
     109
    81110        inputs->Add("velocity",u_g_double,numberofdofspernode,numberofnodes);
    82111
Note: See TracChangeset for help on using the changeset viewer.