Changeset 2267
- Timestamp:
- 09/21/09 11:15:46 (16 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/ModelProcessorx/Control/CreateParametersControl.cpp
r2211 r2267 24 24 25 25 double* fit=NULL; 26 double* cm jump=NULL;26 double* cm_jump=NULL; 27 27 double* optscal=NULL; 28 28 double* maxiter=NULL; … … 114 114 /*Now, recover fit, optscal and maxiter as vectors: */ 115 115 IoModelFetchData((void**)&iomodel->fit,NULL,NULL,iomodel_handle,"fit","Matrix","Mat"); 116 IoModelFetchData((void**)&iomodel->cm jump,NULL,NULL,iomodel_handle,"cmjump","Matrix","Mat");116 IoModelFetchData((void**)&iomodel->cm_jump,NULL,NULL,iomodel_handle,"cm_jump","Matrix","Mat"); 117 117 IoModelFetchData((void**)&iomodel->optscal,NULL,NULL,iomodel_handle,"optscal","Matrix","Mat"); 118 118 IoModelFetchData((void**)&iomodel->maxiter,NULL,NULL,iomodel_handle,"maxiter","Matrix","Mat"); … … 124 124 125 125 count++; 126 param= new Param(count,"cm jump",DOUBLEVEC);127 param->SetDoubleVec(iomodel->cm jump,iomodel->nsteps);126 param= new Param(count,"cm_jump",DOUBLEVEC); 127 param->SetDoubleVec(iomodel->cm_jump,iomodel->nsteps); 128 128 parameters->AddObject(param); 129 129 … … 139 139 140 140 xfree((void**)&iomodel->fit); 141 xfree((void**)&iomodel->cm jump);141 xfree((void**)&iomodel->cm_jump); 142 142 xfree((void**)&iomodel->optscal); 143 143 xfree((void**)&iomodel->maxiter); -
issm/trunk/src/c/ModelProcessorx/IoModel.cpp
r2212 r2267 108 108 /*!solution parameters: */ 109 109 iomodel->fit=NULL; 110 iomodel->cm jump=NULL;110 iomodel->cm_jump=NULL; 111 111 iomodel->meanvel=0; 112 112 iomodel->epsvel=0; … … 241 241 xfree((void**)&iomodel->n); 242 242 xfree((void**)&iomodel->fit); 243 xfree((void**)&iomodel->cm jump);243 xfree((void**)&iomodel->cm_jump); 244 244 xfree((void**)&iomodel->optscal); 245 245 xfree((void**)&iomodel->maxiter); -
issm/trunk/src/c/ModelProcessorx/IoModel.h
r2212 r2267 107 107 /*solution parameters: */ 108 108 double* fit; 109 double* cm jump;109 double* cm_jump; 110 110 double meanvel,epsvel; 111 111 int artificial_diffusivity; -
issm/trunk/src/c/objects/OptPars.h
r2188 r2267 11 11 double xmax; 12 12 double tolerance; 13 double cm jump;13 double cm_jump; 14 14 int maxiter; 15 15 -
issm/trunk/src/c/parallel/control_core.cpp
r2255 r2267 32 32 int gsize; 33 33 double* maxiter=NULL; 34 double* cm jump=NULL;34 double* cm_jump=NULL; 35 35 double eps_cm; 36 36 double tolx; … … 66 66 model->FindParam(&optscal,"optscal"); 67 67 model->FindParam(&maxiter,"maxiter"); 68 model->FindParam(&cm jump,"cmjump");68 model->FindParam(&cm_jump,"cm_jump"); 69 69 model->FindParam(&eps_cm,"eps_cm"); 70 70 model->FindParam(&tolx,"tolx"); … … 125 125 optargs.model=model; 126 126 optargs.param_g=param_g; optargs.grad_g=grad_g_double; optargs.inputs=inputs;optargs.n=n; 127 optpars.xmin=0; optpars.xmax=1; optpars.tolerance=tolx; optpars.maxiter=(int)maxiter[n];optpars.cm jump=cmjump[n];127 optpars.xmin=0; optpars.xmax=1; optpars.tolerance=tolx; optpars.maxiter=(int)maxiter[n];optpars.cm_jump=cm_jump[n]; 128 128 BrentSearch(&search_scalar,J+n,&optpars,&objectivefunctionC,&optargs); 129 129 _printf_("%s\n"," done."); … … 216 216 xfree((void**)&optscal); 217 217 xfree((void**)&maxiter); 218 xfree((void**)&cm jump);218 xfree((void**)&cm_jump); 219 219 VecFree(&new_grad_g); //do not VecFree grad_g and grad_g_old, they point to new_grad_g 220 220 xfree((void**)&grad_g_double); -
issm/trunk/src/c/shared/Numerics/BrentSearch.cpp
r2188 r2267 39 39 double tol1,tol2,seps,tolerance; 40 40 int maxiter; 41 double cm jump;41 double cm_jump; 42 42 43 43 /*counters: */ … … 49 49 tolerance=optpars->tolerance; 50 50 maxiter=optpars->maxiter; 51 cm jump=optpars->cmjump;51 cm_jump=optpars->cm_jump; 52 52 53 53 //initialize counter and boundaries … … 66 66 67 67 //test if jump option activated and xmin==0 68 if (!isnan(cm jump) && (xmin==0)){68 if (!isnan(cm_jump) && (xmin==0)){ 69 69 70 70 //test ration between fxmin and fxmax. if < criterion, return 71 if((fxmax/fxmin)<cm jump){71 if((fxmax/fxmin)<cm_jump){ 72 72 73 73 /*Assign output pointers: */ -
issm/trunk/src/m/classes/@model/model.m
r2212 r2267 185 185 md.maxcontrolconstraint=0; 186 186 md.fit=[]; 187 md.cm jump=[];187 md.cm_jump=[]; 188 188 md.epsvel=0; 189 189 md.meanvel=0; -
issm/trunk/src/m/classes/@model/setdefaultparameters.m
r2226 r2267 189 189 md.fit=0*ones(md.nsteps,1); 190 190 191 %cm jump192 md.cm jump=.7*ones(md.nsteps,1); %30 per cent decrement.191 %cm_jump 192 md.cm_jump=.7*ones(md.nsteps,1); %30 per cent decrement. 193 193 194 194 %eps_cm is a criteria to stop the control methods. -
issm/trunk/src/m/classes/public/display/displaycontrol.m
r2211 r2267 16 16 fielddisplay(md,'optscal','scaling factor on gradient direction during optimization, for each optimization step'); 17 17 fielddisplay(md,'fit','''absolute: 0'', ''relative: 1'', or ''logarithmic: 2''. default is ''absolute: 0'', for each optimization steps'); 18 fielddisplay(md,'cm jump','decrease threshold for misfit, default is 30%');18 fielddisplay(md,'cm_jump','decrease threshold for misfit, default is 30%'); 19 19 fielddisplay(md,'maxiter','maximum iterations during each optimization step'); 20 20 fielddisplay(md,'tolx','minimum tolerance which will stop one optimization search'); -
issm/trunk/src/m/classes/public/geography.m
r1116 r2267 42 42 elements=md.elements; 43 43 44 invert=0; 45 44 46 %Fist recover arrays of ice shelf grids and elements, and ice sheet grids and elements. 45 47 if strcmp(iceshelfname,''), %no iceshelf contour file, we are dealing with a pure ice sheet. … … 50 52 elementoniceshelf=ones(md.numberofelements,1); 51 53 else 54 if strcmpi(iceshelfname(1),'~'), 55 iceshelfname=iceshelfname(2:length(iceshelfname)); 56 invert=1; 57 end 52 58 [gridoniceshelf,elementoniceshelf]=ContourToMesh(elements,x,y,expread(iceshelfname,1),'element and node',2); 59 end 60 if invert, 61 gridoniceshelf=1-gridoniceshelf; 62 elementoniceshelf=1-elementoniceshelf; 53 63 end 54 64 -
issm/trunk/src/m/classes/public/ismodelselfconsistent.m
r2211 r2267 351 351 352 352 %LENGTH CONTROL FIELDS 353 if (length(md.maxiter)~=md.nsteps | length(md.optscal)~=md.nsteps | length(md.fit)~=md.nsteps | length(md.cm jump)~=md.nsteps)354 disp('maxiter, optscal, fit and cm jump must have the length specified by nsteps')353 if (length(md.maxiter)~=md.nsteps | length(md.optscal)~=md.nsteps | length(md.fit)~=md.nsteps | length(md.cm_jump)~=md.nsteps) 354 disp('maxiter, optscal, fit and cm_jump must have the length specified by nsteps') 355 355 bool=0;return; 356 356 end -
issm/trunk/src/m/classes/public/marshall.m
r2212 r2267 101 101 %Write solution parameters 102 102 WriteData(fid,md.fit,'Mat','fit'); 103 WriteData(fid,md.cm jump,'Mat','cmjump');103 WriteData(fid,md.cm_jump,'Mat','cm_jump'); 104 104 WriteData(fid,md.yts,'Scalar','yts'); 105 105 WriteData(fid,md.meanvel,'Scalar','meanvel'); -
issm/trunk/src/m/classes/public/plot/plot_riftpenetration.m
r1 r2267 44 44 normal(2)=penaltypairs(j,6); 45 45 46 vx1=md.vx(penaltypairs(j,1)); vx2=md.vx(penaltypairs(j,2)); vy1=md.vy(penaltypairs(j,1)); vy2=md.vy(penaltypairs(j,2)); 46 vx1=md.vx(penaltypairs(j,1)); 47 vx2=md.vx(penaltypairs(j,2)); 48 vy1=md.vy(penaltypairs(j,1)); 49 vy2=md.vy(penaltypairs(j,2)); 47 50 penetration=(vx2-vx1)*normal(1)+(vy2-vy1)*normal(2); 48 51 %if penetration is negative, plot in black, positive, plot in red;: ie: if rift is closing, black, if rift is opening, red. -
issm/trunk/src/m/classes/public/plot/plot_transient_results.m
r740 r2267 24 24 string='plotmodel(md'; 25 25 for i=1:length(md.results.transient), 26 string=[string ',''data'', ''results.transient(' num2str(i) ').thickness'',''title'',''Thickness at time ' num2str(md.results.transient(i).time) ' a'''];26 string=[string ',''data'',md.results.transient(' num2str(i) ').thickness,''title'',''Thickness at time ' num2str(md.results.transient(i).time) ' a''']; 27 27 end 28 28 string=[string ',''figure'',1,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight) ');']; … … 32 32 string='plotmodel(md'; 33 33 for i=1:length(md.results.transient), 34 string=[string ',''data'', ''results.transient(' num2str(i) ').vel'',''view'',3,''title'',''Velocity at time ' num2str(md.results.transient(i).time) ' a'''];34 string=[string ',''data'',md.results.transient(' num2str(i) ').vel,''view'',3,''title'',''Velocity at time ' num2str(md.results.transient(i).time) ' a''']; 35 35 end 36 36 string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight) ');']; … … 38 38 clear string; 39 39 40 string='plotmodel(md'; 41 for i=1:length(md.results.transient), 42 string=[string ',''data'',''results.transient(' num2str(i) ').temperature'',''view'',3,''title'',''Temperature at time ' num2str(md.results.transient(i).time) ' a''']; 40 if strcmpi(md.type,'3d'), 41 string='plotmodel(md'; 42 for i=1:length(md.results.transient), 43 string=[string ',''data'',md.results.transient(' num2str(i) ').temperature,''view'',3,''title'',''Temperature at time ' num2str(md.results.transient(i).time) ' a''']; 44 end 45 string=[string ',''figure'',3,''colorbar#all'',''on'',''view'',3,''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight) ');']; 46 eval(string); 47 clear string; 43 48 end 44 string=[string ',''figure'',3,''colorbar#all'',''on'',''view'',3,''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight) ');'];45 eval(string);46 clear string;47 49 48 50 string='plotmodel(md'; … … 62 64 clear string; 63 65 64 string='plotmodel(md'; 65 for i=2:length(md.results.transient), 66 string=[string ',''data'',md.results.transient(' num2str(i) ').temperature-md.results.transient(' num2str(i-1) ').temperature,''view'',3,''title'',''Delta temperature at time ' num2str(md.results.transient(i).time) ' a''']; 66 if strcmpi(md.type,'3d'), 67 string='plotmodel(md'; 68 for i=2:length(md.results.transient), 69 string=[string ',''data'',md.results.transient(' num2str(i) ').temperature-md.results.transient(' num2str(i-1) ').temperature,''view'',3,''title'',''Delta temperature at time ' num2str(md.results.transient(i).time) ' a''']; 70 end 71 string=[string ',''figure'',6,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight) ');']; 72 eval(string); 73 clear string; 67 74 end 68 string=[string ',''figure'',6,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight) ');'];69 eval(string);70 clear string; -
issm/trunk/src/mex/ControlOptimization/ControlOptimization.cpp
r2188 r2267 29 29 mxArray* n=NULL; 30 30 int n_value; 31 double* cm jump=NULL;31 double* cm_jump=NULL; 32 32 33 33 /*Boot module: */ … … 45 45 46 46 /*Parameters: */ 47 FetchData((void**)&cm jump,NULL,NULL,mxGetField(PARAMETERS,0,"cmjump"),"Matrix","Mat");47 FetchData((void**)&cm_jump,NULL,NULL,mxGetField(PARAMETERS,0,"cm_jump"),"Matrix","Mat"); 48 48 FetchData((void**)&n_value,NULL,NULL,STEP,"Integer",NULL); 49 49 … … 61 61 optpars.tolerance=tolerance; 62 62 optpars.maxiter=maxiter; 63 optpars.cm jump=cmjump[n_value-1];63 optpars.cm_jump=cm_jump[n_value-1]; 64 64 65 65 BrentSearch(&search_scalar,&J,&optpars,&OptFunc,&optargs); … … 71 71 /*Free ressources: */ 72 72 xfree((void**)&function_name); 73 xfree((void**)&cm jump);73 xfree((void**)&cm_jump); 74 74 75 75 /*end module: */
Note:
See TracChangeset
for help on using the changeset viewer.