Changeset 15055
- Timestamp:
- 05/21/13 10:09:52 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 3 deleted
- 9 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r15053 r15055 321 321 ./modules/InputConvergencex/InputConvergencex.cpp\ 322 322 ./modules/InputConvergencex/InputConvergencex.h\ 323 ./analyses/convergence.cpp\324 323 ./analyses/ProcessArguments.cpp\ 325 324 ./analyses/ResetBoundaryConditions.cpp\ … … 333 332 ./solutionsequences/solutionsequence_nonlinear.cpp\ 334 333 ./solutionsequences/solutionsequence_newton.cpp\ 334 ./solutionsequences/convergence.cpp\ 335 335 ./classes/Options/Options.h\ 336 336 ./classes/Options/Options.cpp\ … … 361 361 #}}} 362 362 #Steadystate sources {{{ 363 steadystate_sources = ./analyses/steadystate_core.cpp\ 364 ./analyses/steadystateconvergence.cpp 363 steadystate_sources = ./analyses/steadystate_core.cpp 365 364 #}}} 366 365 #Prognostic sources {{{ … … 436 435 ./analyses/control_core.cpp\ 437 436 ./analyses/controltao_core.cpp\ 438 ./analyses/controlrestart.cpp\439 ./analyses/controlconvergence.cpp\440 437 ./analyses/objectivefunction.cpp\ 441 438 ./analyses/gradient_core.cpp\ -
issm/trunk-jpl/src/c/analyses/CMakeLists.txt
r14985 r15055 23 23 # }}} 24 24 # STEADYSTATE_SOURCES {{{ 25 set(STEADYSTATE_SOURCES $ENV{ISSM_DIR}/src/c/solutions/steadystate_core.cpp 26 $ENV{ISSM_DIR}/src/c/solutions/steadystateconvergence.cpp PARENT_SCOPE) 25 set(STEADYSTATE_SOURCES $ENV{ISSM_DIR}/src/c/solutions/steadystate_core.cpp PARENT_SCOPE) 27 26 # }}} 28 27 # PROGNOSTIC_SOURCES {{{ -
issm/trunk-jpl/src/c/analyses/analyses.h
r14985 r15055 39 39 IssmDouble objectivefunction(IssmDouble search_scalar,OptArgs* optargs); 40 40 41 //convergence:42 void convergence(bool* pconverged, Matrix<IssmDouble>* K_ff,Vector<IssmDouble>* p_f,Vector<IssmDouble>* u_f,Vector<IssmDouble>* u_f_old,Parameters* parameters);43 bool controlconvergence(IssmDouble J,IssmDouble tol_cm);44 bool steadystateconvergence(FemModel* femmodel);45 46 41 //optimization 47 42 int GradJSearch(IssmDouble* search_vector,FemModel* femmodel,int step); … … 50 45 void ProcessArguments(int* solution,char** pbinname,char** poutbinname,char** ptoolkitsname,char** plockname,char** prootpath,int argc,char **argv); 51 46 void WriteLockFile(char* filename); 52 void controlrestart(FemModel* femmodel,IssmDouble* J);53 47 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type); 54 48 COMM EnvironmentInit(int argc,char** argv); -
issm/trunk-jpl/src/c/analyses/control_core.cpp
r15001 r15055 10 10 #include "../solutionsequences/solutionsequences.h" 11 11 12 /*Local prototypes*/ 13 bool controlconvergence(IssmDouble J, IssmDouble tol_cm); 14 12 15 void control_core(FemModel* femmodel){ 13 16 14 int i ,n;17 int i; 15 18 16 19 /*parameters: */ 17 int num_controls,num_responses;18 int nsteps;19 IssmDouble 20 bool cm_gradient;21 int dim;22 int solution_type;23 bool isstokes;24 bool dakota_analysis=false;20 int num_controls,num_responses; 21 int nsteps; 22 IssmDouble tol_cm; 23 bool cm_gradient; 24 int dim; 25 int solution_type; 26 bool isstokes; 27 bool dakota_analysis = false; 25 28 26 int * control_type= NULL;27 IssmDouble * responses=NULL;28 int * step_responses=NULL;29 IssmDouble * maxiter=NULL;30 IssmDouble * cm_jump=NULL;29 int *control_type = NULL; 30 IssmDouble *responses = NULL; 31 int *step_responses = NULL; 32 IssmDouble *maxiter = NULL; 33 IssmDouble *cm_jump = NULL; 31 34 32 35 /*intermediary: */ 33 IssmDouble search_scalar=1;34 OptArgs optargs;35 OptPars optpars;36 IssmDouble search_scalar = 1; 37 OptArgs optargs; 38 OptPars optpars; 36 39 37 40 /*Solution and Adjoint core pointer*/ 38 void (*solutioncore)(FemModel*) =NULL;39 void (*adjointcore)(FemModel*) =NULL;41 void (*solutioncore)(FemModel*) = NULL; 42 void (*adjointcore)(FemModel*) = NULL; 40 43 41 44 /*output: */ … … 75 78 76 79 /*Start looping: */ 77 for( n=0;n<nsteps;n++){80 for(int n=0;n<nsteps;n++){ 78 81 79 82 /*Display info*/ … … 115 118 #ifdef _HAVE_ADOLC_ 116 119 IssmPDouble* J_passive=xNew<IssmPDouble>(nsteps); 117 for(i nt i=0;i<nsteps;i++)J_passive[i]=reCast<IssmPDouble>(J[i]);120 for(i=0;i<nsteps;i++) J_passive[i]=reCast<IssmPDouble>(J[i]); 118 121 femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,JEnum,J_passive,nsteps,1,1,0)); 119 122 xDelete<IssmPDouble>(J_passive); … … 132 135 xDelete<IssmDouble>(J); 133 136 } 137 bool controlconvergence(IssmDouble J, IssmDouble tol_cm){ 138 139 bool converged=false; 140 141 /*Has convergence been reached?*/ 142 if (!xIsNan<IssmDouble>(tol_cm) && J<tol_cm){ 143 converged=true; 144 if(VerboseConvergence()) _pprintString_(" Convergence criterion reached: J = " << J << " < " << tol_cm); 145 } 146 147 return converged; 148 } -
issm/trunk-jpl/src/c/analyses/steadystate_core.cpp
r15001 r15055 14 14 #include "../modules/modules.h" 15 15 #include "../solutionsequences/solutionsequences.h" 16 17 /*Local prototypes*/ 18 bool steadystateconvergence(FemModel* femmodel); 16 19 17 20 void steadystate_core(FemModel* femmodel){ … … 91 94 xDelete<int>(requested_outputs); 92 95 } 96 bool steadystateconvergence(FemModel* femmodel){ 97 98 /*output: */ 99 bool converged=false; 100 bool velocity_converged=false; 101 bool temperature_converged=false; 102 103 /*intermediary: */ 104 int velocityenums[8]={VxEnum,VxPicardEnum,VyEnum,VyPicardEnum,VzEnum,VzPicardEnum,PressureEnum,PressurePicardEnum}; //pairs of enums (new and old) on which to carry out the converence tests 105 int temperatureenums[2]={TemperatureEnum,TemperatureOldEnum}; 106 int convergencecriterion[1]={RelativeEnum}; //criterions for convergence, RelativeEnum or AbsoluteEnum 107 IssmDouble convergencecriterionvalue[1]; //value of criterion to be respected 108 109 /*retrieve parameters: */ 110 femmodel->parameters->FindParam(&convergencecriterionvalue[0],SteadystateReltolEnum); 111 112 /*figure out convergence at the input level, because we don't have the solution vectors!: */ 113 velocity_converged=InputConvergencex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,&velocityenums[0],8,&convergencecriterion[0],&convergencecriterionvalue[0],1); 114 temperature_converged=InputConvergencex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,&temperatureenums[0],2,&convergencecriterion[0],&convergencecriterionvalue[0],1); 115 116 if(velocity_converged && temperature_converged) converged=true; 117 118 /*return: */ 119 return converged; 120 } -
issm/trunk-jpl/src/c/solutionsequences/solutionsequence_newton.cpp
r15002 r15055 3 3 */ 4 4 5 #include "./solutionsequences.h" 5 6 #include "../toolkits/toolkits.h" 6 7 #include "../classes/classes.h" 7 8 #include "../shared/shared.h" 8 9 #include "../modules/modules.h" 9 #include "../analyses/analyses.h"10 10 11 11 void solutionsequence_newton(FemModel* femmodel){ -
issm/trunk-jpl/src/c/solutionsequences/solutionsequence_nonlinear.cpp
r15002 r15055 3 3 */ 4 4 5 #include "./solutionsequences.h" 5 6 #include "../toolkits/toolkits.h" 6 7 #include "../classes/classes.h" 7 8 #include "../shared/shared.h" 8 9 #include "../modules/modules.h" 9 #include "../analyses/analyses.h"10 10 11 11 void solutionsequence_nonlinear(FemModel* femmodel,bool conserve_loads){ -
issm/trunk-jpl/src/c/solutionsequences/solutionsequence_stokescoupling_nonlinear.cpp
r15002 r15055 3 3 */ 4 4 5 #include "./solutionsequences.h" 5 6 #include "../toolkits/toolkits.h" 6 7 #include "../classes/classes.h" 7 8 #include "../shared/shared.h" 8 9 #include "../modules/modules.h" 9 #include "../analyses/analyses.h"10 10 11 11 void solutionsequence_stokescoupling_nonlinear(FemModel* femmodel,bool conserve_loads){ -
issm/trunk-jpl/src/c/solutionsequences/solutionsequences.h
r14992 r15055 6 6 #define _SOLUTION_SEQUENCES_H_ 7 7 8 struct OptArgs;9 8 class FemModel; 9 class Parameters; 10 template <class doubletype> class Matrix; 11 template <class doubletype> class Vector; 12 #include "../shared/Numerics/types.h" 10 13 11 14 void solutionsequence_thermal_nonlinear(FemModel* femmodel); … … 17 20 void solutionsequence_adjoint_linear(FemModel* femmodel); 18 21 22 /*convergence*/ 23 void convergence(bool* pconverged, Matrix<IssmDouble>* K_ff,Vector<IssmDouble>* p_f,Vector<IssmDouble>* u_f,Vector<IssmDouble>* u_f_old,Parameters* parameters); 24 19 25 #endif
Note:
See TracChangeset
for help on using the changeset viewer.