Changeset 3539


Ignore:
Timestamp:
04/15/10 07:37:19 (15 years ago)
Author:
seroussi
Message:

fixed problem for control method steadystate (need a 3d velocity)

File:
1 edited

Legend:

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

    r3446 r3539  
    2222        Model*    model=NULL;
    2323        FemModel* femmodel=NULL;
     24        DataSet* diagnostic_results=NULL;
    2425        double* param_g=NULL;
    2526        double* grad_g=NULL;
     
    8081        /*First, update param_g using search_scalar: */
    8182        for(i=0;i<numberofnodes;i++)param_g_copy[i]=param_g_copy[i]+search_scalar*optscal[n]*grad_g[i];
     83        printf("numberofdofspernode: %i\n",numberofdofspernode);
    8284
    8385        /*Constrain:*/
     
    8890
    8991        /*Run diagnostic with updated parameters.*/
    90         diagnostic_core_nonlinear(&u_g,NULL,NULL,NULL,femmodel,inputs,DiagnosticAnalysisEnum(),sub_analysis_type);
    91         VecToMPISerial(&u_g_double,u_g); VecFree(&u_g);
    92         inputs->Add("velocity",u_g_double,numberofdofspernode,numberofnodes);
     92        if(!control_steady){
     93                diagnostic_core_nonlinear(&u_g,NULL,NULL,NULL,femmodel,inputs,DiagnosticAnalysisEnum(),sub_analysis_type);
     94                VecToMPISerial(&u_g_double,u_g); VecFree(&u_g);
     95                inputs->Add("velocity",u_g_double,numberofdofspernode,numberofnodes);
     96        }
     97        else{
     98                //We need a 3D velocity!! (vz is required for the next thermal run)
     99                diagnostic_results=new DataSet(ResultsEnum());
     100                diagnostic_core(diagnostic_results,model, inputs);
     101
     102                //extract u_g and add it to input (3d velocity needed by thermal_core)
     103                diagnostic_results->FindResult(&u_g,"u_g");
     104                inputs->Add("velocity",u_g,3,numberofnodes);
     105                delete diagnostic_results;
     106        }
    93107
    94108        /*Compute misfit for this velocity field.*/
Note: See TracChangeset for help on using the changeset viewer.