Changeset 13621
- Timestamp:
- 10/11/12 11:20:39 (12 years ago)
- Location:
- issm/trunk-jpl/src/c/solutions
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/solutions/AdjointCorePointerFromSolutionEnum.cpp ¶
r13056 r13621 24 24 25 25 switch(solutiontype){ 26 26 27 27 case DiagnosticSolutionEnum: 28 28 adjointcore=&adjointdiagnostic_core; … … 38 38 break; 39 39 } 40 40 41 41 /*Assign output pointer:*/ 42 42 _assert_(padjointcore); -
TabularUnified issm/trunk-jpl/src/c/solutions/AnalysisConfiguration.cpp ¶
r13056 r13621 26 26 /*Analyses lists*/ 27 27 switch(solutiontype){ 28 28 29 29 case DiagnosticSolutionEnum: 30 30 numanalyses=5; … … 56 56 analyses[1]=MeltingAnalysisEnum; 57 57 break; 58 58 59 59 case EnthalpySolutionEnum: 60 60 numanalyses=1; … … 62 62 analyses[0]=EnthalpyAnalysisEnum; 63 63 break; 64 64 65 65 case HydrologySolutionEnum: 66 66 numanalyses=3; … … 108 108 analyses[8]=PrognosticAnalysisEnum; 109 109 break; 110 110 111 111 default: 112 112 _error_("solution type: " << EnumToStringx(solutiontype) << " not supported yet!"); -
TabularUnified issm/trunk-jpl/src/c/solutions/CorePointerFromSolutionEnum.cpp ¶
r13540 r13621 27 27 bool tao_analysis=false; 28 28 bool dakota_analysis=false; 29 29 30 30 /* retrieve some parameters that tell us whether wrappers are allowed, or whether we return 31 31 * a pure core. Wrappers can be dakota_core (which samples many solution_cores) or control_core (which -
TabularUnified issm/trunk-jpl/src/c/solutions/DakotaSpawnCore.cpp ¶
r13612 r13621 1 1 /*!\file: DakotaSpawnCore.cpp 2 2 3 3 * \brief: run core ISSM solution using Dakota inputs coming from CPU 0. 4 4 * \sa qmu.cpp DakotaPlugin.cpp … … 27 27 #endif 28 28 29 30 29 #include "../classes/objects/objects.h" 31 30 #include "../io/io.h" … … 43 42 /*Notice the d_, which prefixes anything that is being provided to us by the Dakota pluggin. Careful. some things are ours, some are dakotas!: */ 44 43 int DakotaSpawnCore(double* d_responses, int d_numresponses, double* d_variables, char** d_variables_descriptors,int d_numvariables, void* void_femmodel,int counter){ 45 44 46 45 int i; 47 46 48 47 char **responses_descriptors = NULL; //these are our! there are only numresponsedescriptors of them, not d_numresponses!!! 49 48 int numresponsedescriptors; … … 55 54 FemModel* femmodel = NULL; 56 55 bool nodakotacore = true; 57 58 56 59 57 /*If counter==-1 on cpu0, it means that the dakota runs are done. In which case, bail out and return 0: */ … … 70 68 femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum); 71 69 femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum); 72 70 73 71 if(VerboseQmu()) _pprintLine_("qmu iteration: " << counter); 74 72 … … 89 87 if(VerboseQmu()) _pprintLine_("compute dakota responses:"); 90 88 DakotaResponsesx(d_responses,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,responses_descriptors,numresponsedescriptors,d_numresponses); 91 89 92 90 /*Free ressources:*/ 93 91 DakotaFree(&d_variables,&d_variables_descriptors,&responses_descriptors, d_numvariables, numresponsedescriptors); … … 126 124 /*numvariables: */ 127 125 MPI_Bcast(&numvariables,1,MPI_INT,0,IssmComm::GetComm()); 128 126 129 127 /*variables:*/ 130 128 if(my_rank!=0)variables=xNew<double>(numvariables); … … 156 154 } /*}}}*/ 157 155 void DakotaFree(double** pvariables,char*** pvariables_descriptors,char*** presponses_descriptors,int numvariables,int numresponses){ /*{{{*/ 158 156 159 157 /*\brief DakotaFree: free allocations on other cpus, not done by Dakota.*/ 160 158 161 159 int i; 162 160 int my_rank; 163 161 164 162 double *variables = NULL; 165 163 char **variables_descriptors = NULL; … … 184 182 xDelete<char*>(variables_descriptors); 185 183 } 186 184 187 185 //responses descriptors on every cpu 188 186 for(i=0;i<numresponses;i++){ -
TabularUnified issm/trunk-jpl/src/c/solutions/EnvironmentInit.cpp ¶
r13589 r13621 25 25 #endif 26 26 #endif 27 28 27 29 28 } -
TabularUnified issm/trunk-jpl/src/c/solutions/PureCorePointerFromSolutionEnum.cpp ¶
r13540 r13621 24 24 25 25 switch(solutiontype){ 26 26 27 27 case DiagnosticSolutionEnum: 28 28 #ifdef _HAVE_DIAGNOSTIC_ … … 99 99 break; 100 100 } 101 101 102 102 /*Assign output pointer:*/ 103 103 _assert_(psolutioncore); -
TabularUnified issm/trunk-jpl/src/c/solutions/ResetBoundaryConditions.cpp ¶
r13216 r13621 9 9 10 10 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type){ 11 11 12 12 /*variables: */ 13 13 Vector<IssmDouble>* yg = NULL; … … 16 16 17 17 if(VerboseSolution()) _pprintLine_(" updating boundary conditions..."); 18 18 19 19 /*set current analysis: */ 20 20 femmodel->SetCurrentConfiguration(analysis_type); -
TabularUnified issm/trunk-jpl/src/c/solutions/ad_core.cpp ¶
r13546 r13621 9 9 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 10 10 #endif 11 12 11 13 12 #include <set> … … 24 23 25 24 void ad_core(FemModel* femmodel){ 26 25 27 26 /*diverse: */ 28 27 int i; … … 45 44 #ifdef _HAVE_ADOLC_ 46 45 47 48 46 /*First, stop tracing: */ 49 47 trace_off(); … … 53 51 femmodel->parameters->FindParam(&num_independents,AutodiffNumIndependentsEnum); 54 52 if(!(num_dependents*num_independents)) return; 55 53 56 54 if(VerboseAutodiff())_pprintLine_(" start ad core"); 57 55 58 56 /*retrieve state variable: */ 59 57 femmodel->parameters->FindParam(&axp,&dummy,AutodiffXpEnum); … … 76 74 77 75 if (strcmp(driver,"fos_forward")==0){ 78 76 79 77 int anIndepIndex; 80 78 double *tangentDir = NULL; 81 79 double *jacTimesTangentDir = NULL; 82 80 double *theOutput = NULL; 83 81 84 82 /*retrieve direction index: */ 85 83 femmodel->parameters->FindParam(&anIndepIndex,AutodiffFosForwardIndexEnum); 86 84 87 85 if (anIndepIndex<0 || anIndepIndex>=num_independents) _error_("index value for AutodiffFosForwardIndexEnum should be in [0,num_independents-1]"); 88 86 89 87 tangentDir=xNewZeroInit<double>(num_independents); 90 88 tangentDir[anIndepIndex]=1.0; 91 89 92 90 jacTimesTangentDir=xNew<double>(num_dependents); 93 91 theOutput=xNew<double>(num_dependents); 94 92 95 93 /*set the forward method function pointer: */ 96 94 anEDF_for_solverx_p->fos_forward=EDF_fos_forward_for_solverx; … … 105 103 /*add to results*/ 106 104 femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,jacTimesTangentDir,num_dependents,1,1,0.0)); 107 105 108 106 /*free resources :*/ 109 107 xDelete(theOutput); … … 112 110 } 113 111 else if ((strcmp(driver,"fov_forward")==0) || (strcmp(driver,"fov_forward_all")==0)){ 114 112 115 113 int tangentDirNum; 116 114 int dummy; … … 120 118 double *theOutput = NULL; 121 119 std::set<unsigned int> anIndexSet; 122 123 120 124 121 /*retrieve directions:*/ 125 122 if (strcmp(driver,"fov_forward_all")==0){ … … 137 134 /* full Jacobian or Jacobian projection:*/ 138 135 jacTimesSeed=xNew<double>(num_dependents,tangentDirNum); 139 136 140 137 /*set the forward method function pointers: */ 141 138 anEDF_for_solverx_p->fov_forward=EDF_fov_forward_for_solverx; … … 223 220 std::set<unsigned int> anIndexSet; 224 221 225 226 222 /*retrieve directions:*/ 227 223 if (strcmp(driver,"fov_reverse_all")==0){ … … 278 274 else _error_("driver: " << driver << " not yet supported!"); 279 275 280 281 276 /* delete the allocated space for the parameters:*/ 282 277 xDelete(anEDF_for_solverx_p->dp_x); … … 290 285 xDelete(anEDF_for_solverx_p->dp_Z); 291 286 xDelete(anEDF_for_solverx_p->dpp_Z); 292 287 293 288 /*Print statistics:*/ 294 289 tapestats(1,tape_stats); //reading of tape statistics … … 303 298 } 304 299 if(VerboseAutodiff())_pprintLine_(" end AD core"); 305 300 306 301 /*Free resources: */ 307 302 xDelete(xp); -
TabularUnified issm/trunk-jpl/src/c/solutions/adjointbalancethickness_core.cpp ¶
r12832 r13621 14 14 15 15 void adjointbalancethickness_core(FemModel* femmodel){ 16 16 17 17 /*parameters: */ 18 18 bool save_results; … … 33 33 femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum,AdjointBalancethicknessAnalysisEnum); 34 34 solver_adjoint_linear(femmodel); 35 35 36 36 /*Save results*/ 37 37 if(save_results){ -
TabularUnified issm/trunk-jpl/src/c/solutions/adjointdiagnostic_core.cpp ¶
r12832 r13621 14 14 15 15 void adjointdiagnostic_core(FemModel* femmodel){ 16 16 17 17 /*parameters: */ 18 18 bool isstokes; … … 36 36 femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum,AdjointHorizAnalysisEnum); 37 37 solver_adjoint_linear(femmodel); 38 38 39 39 /*Save results*/ 40 40 if(save_results){ -
TabularUnified issm/trunk-jpl/src/c/solutions/balancethickness_core.cpp ¶
r12832 r13621 20 20 /*activate formulation: */ 21 21 femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum); 22 22 23 23 /*recover parameters: */ 24 24 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); -
TabularUnified issm/trunk-jpl/src/c/solutions/bedslope_core.cpp ¶
r12832 r13621 26 26 femmodel->SetCurrentConfiguration(BedSlopeAnalysisEnum,BedSlopeYAnalysisEnum); 27 27 solver_linear(femmodel); 28 28 29 29 if(save_results){ 30 30 if(VerboseSolution()) _pprintLine_(" saving results"); -
TabularUnified issm/trunk-jpl/src/c/solutions/control_core.cpp ¶
r13540 r13621 16 16 17 17 int i,n; 18 18 19 19 /*parameters: */ 20 20 int num_controls,num_responses; … … 32 32 IssmDouble* maxiter=NULL; 33 33 IssmDouble* cm_jump=NULL; 34 34 35 35 /*intermediary: */ 36 36 IssmDouble search_scalar=1; … … 72 72 J=xNew<IssmDouble>(nsteps); 73 73 step_responses=xNew<int>(num_responses); 74 74 75 75 /*Initialize some of the BrentSearch arguments: */ 76 76 optargs.femmodel=femmodel; 77 77 optpars.xmin=0; optpars.xmax=1; 78 78 79 79 /*Start looping: */ 80 80 for(n=0;n<nsteps;n++){ … … 84 84 for(i=0;i<num_responses;i++) step_responses[i]=reCast<int,IssmDouble>(responses[n*num_responses+i]); 85 85 femmodel->parameters->SetParam(step_responses,1,num_responses,StepResponsesEnum); 86 86 87 87 /*In steady state inversion, compute new temperature field now*/ 88 88 if(solution_type==SteadystateSolutionEnum) solutioncore(femmodel); … … 104 104 if(VerboseControl()) _pprintLine_(" updating parameter using optimized search scalar"); //true means update save controls 105 105 InputControlUpdatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,search_scalar,true); 106 106 107 107 if(controlconvergence(J[n],tol_cm)) break; 108 108 } -
TabularUnified issm/trunk-jpl/src/c/solutions/dakota_core.cpp ¶
r13612 r13621 54 54 void dakota_core(FemModel* femmodel){ 55 55 56 #ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in. 56 57 57 #ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in.58 59 58 int my_rank; 60 59 char* dakota_input_file = NULL; … … 69 68 femmodel->parameters->FindParam(&dakota_output_file,QmuOutNameEnum); 70 69 femmodel->parameters->FindParam(&dakota_error_file,QmuErrNameEnum); 71 70 72 71 /*recover my_rank:*/ 73 72 my_rank=IssmComm::GetRank(); 74 73 75 74 if(my_rank==0){ 76 75 77 76 // Instantiate/initialize the parallel library and problem description 78 77 // database objects. … … 105 104 interface.assign_rep(new SIM::DakotaPlugin(problem_db,(void*)femmodel), false); 106 105 } 107 106 108 107 // Execute the strategy 109 108 problem_db.lock(); // prevent run-time DB queries 110 109 selected_strategy.run_strategy(); 111 110 112 111 //Warn other cpus that we are done running the dakota iterator, by setting the counter to -1: 113 112 DakotaSpawnCore(NULL,0, NULL,NULL,0,femmodel,-1); -
TabularUnified issm/trunk-jpl/src/c/solutions/diagnostic_core.cpp ¶
r13438 r13621 60 60 61 61 if(ishutter){ 62 62 63 63 if(VerboseSolution()) _pprintLine_(" computing hutter velocities"); 64 64 … … 68 68 femmodel->SetCurrentConfiguration(DiagnosticHutterAnalysisEnum); 69 69 solver_linear(femmodel); 70 70 71 71 if (ismacayealpattyn) ResetBoundaryConditions(femmodel,DiagnosticHorizAnalysisEnum); 72 72 } 73 73 74 74 if ((ismacayealpattyn || isl1l2) ^ isstokes){ // ^ = xor 75 75 76 76 if(VerboseSolution()) _pprintLine_(" computing velocities"); 77 77 femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum); … … 105 105 RequestedOutputsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,requested_outputs,numoutputs); 106 106 } 107 107 108 108 if(solution_type==DiagnosticSolutionEnum)RequestedDependentsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 109 109 -
TabularUnified issm/trunk-jpl/src/c/solutions/hydrology_core.cpp ¶
r13073 r13621 44 44 /*Loop through time: */ 45 45 for(i=0;i<nsteps;i++){ 46 46 47 47 if(nsteps)if(VerboseSolution()) _pprintLine_("time step:" << i+1 << "/" << nsteps); 48 48 time+=dt; … … 57 57 //InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,HydrologyWaterVxEnum,i+1,time); 58 58 //InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,HydrologyWaterVyEnum,i+1,time); 59 59 60 60 /*unload results*/ 61 61 if(VerboseSolution()) _pprintLine_(" saving temporary results"); … … 64 64 } 65 65 } 66 -
TabularUnified issm/trunk-jpl/src/c/solutions/hydrology_core_step.cpp ¶
r12832 r13621 14 14 15 15 void hydrology_core_step(FemModel* femmodel,int step, IssmDouble time){ 16 16 17 17 bool modify_loads=true; 18 18 -
TabularUnified issm/trunk-jpl/src/c/solutions/issm.cpp ¶
r13611 r13621 4 4 5 5 #include "../issm.h" 6 6 7 7 int main(int argc,char **argv){ 8 9 8 10 9 /*Initialize exception trapping: */ … … 22 21 /*Output results: */ 23 22 femmodel->OutputResults(); 24 23 25 24 /*Wrap up: */ 26 25 delete femmodel; -
TabularUnified issm/trunk-jpl/src/c/solutions/objectivefunction.cpp ¶
r13056 r13621 23 23 24 24 int i; 25 25 26 26 /*output: */ 27 27 IssmDouble J; 28 28 29 29 /*parameters: */ 30 30 int solution_type,analysis_type; -
TabularUnified issm/trunk-jpl/src/c/solutions/prognostic_core.cpp ¶
r13438 r13621 23 23 /*activate formulation: */ 24 24 femmodel->SetCurrentConfiguration(PrognosticAnalysisEnum); 25 25 26 26 /*recover parameters: */ 27 27 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); … … 47 47 if(VerboseSolution()) _pprintLine_(" call computational core"); 48 48 solver_linear(femmodel); 49 49 50 50 if(save_results){ 51 51 if(VerboseSolution()) _pprintLine_(" saving results"); … … 53 53 RequestedOutputsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,requested_outputs,numoutputs); 54 54 } 55 55 56 56 if(solution_type==PrognosticSolutionEnum)RequestedDependentsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 57 57 58 58 /*Free ressources:*/ 59 59 xDelete<int>(requested_outputs); -
TabularUnified issm/trunk-jpl/src/c/solutions/steadystate_core.cpp ¶
r13056 r13621 29 29 int numoutputs = 0; 30 30 int *requested_outputs = NULL; 31 31 32 32 /* recover parameters:*/ 33 33 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); … … 42 42 43 43 for(;;){ 44 44 45 45 if(VerboseSolution()) _pprintLine_(" computing temperature and velocity for step: " << step); 46 46 #ifdef _HAVE_THERMAL_ … … 66 66 break; 67 67 } 68 68 69 69 if(VerboseSolution()) _pprintLine_(" saving velocity, temperature and pressure to check for convergence at next step"); 70 70 InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum,VxPicardEnum); … … 73 73 InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,PressureEnum,PressurePicardEnum); 74 74 InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum,TemperatureOldEnum); 75 75 76 76 //increase counter 77 77 step++; 78 78 } 79 79 80 80 if(save_results){ 81 81 if(VerboseSolution()) _pprintLine_(" saving results"); -
TabularUnified issm/trunk-jpl/src/c/solutions/steadystateconvergence.cpp ¶
r12832 r13621 18 18 19 19 bool steadystateconvergence(FemModel* femmodel){ 20 20 21 21 /*output: */ 22 22 bool converged=false; … … 32 32 /*retrieve parameters: */ 33 33 femmodel->parameters->FindParam(&convergencecriterionvalue[0],SteadystateReltolEnum); 34 34 35 35 /*figure out convergence at the input level, because we don't have the solution vectors!: */ 36 36 velocity_converged=InputConvergencex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,&velocityenums[0],8,&convergencecriterion[0],&convergencecriterionvalue[0],1); -
TabularUnified issm/trunk-jpl/src/c/solutions/surfaceslope_core.cpp ¶
r12832 r13621 26 26 femmodel->SetCurrentConfiguration(SurfaceSlopeAnalysisEnum,SurfaceSlopeYAnalysisEnum); 27 27 solver_linear(femmodel); 28 28 29 29 if(save_results){ 30 30 if(VerboseSolution()) _pprintLine_("saving results:"); -
TabularUnified issm/trunk-jpl/src/c/solutions/transient_core.cpp ¶
r13283 r13621 31 31 int numoutputs = 0; 32 32 int *requested_outputs = NULL; 33 33 34 34 /*intermediary: */ 35 35 int step; … … 107 107 #endif 108 108 } 109 109 110 110 if(isdiagnostic){ 111 111 if(VerboseSolution()) _pprintLine_(" computing new velocity"); … … 153 153 154 154 RequestedDependentsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 155 155 156 156 /*Free ressources:*/ 157 157 xDelete<int>(requested_outputs);
Note:
See TracChangeset
for help on using the changeset viewer.