Changeset 17920
- Timestamp:
- 05/02/14 10:42:14 (12 years ago)
- Location:
- issm/trunk-jpl/src/m/classes
- Files:
-
- 3 edited
-
inversion.m (modified) (2 diffs)
-
m1qn3inversion.m (modified) (1 diff)
-
taoinversion.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/inversion.m
r17895 r17920 25 25 end 26 26 methods 27 function createxml(obj,fid) % {{{28 fprintf(fid, '<!-- inversion -->\n');29 30 % inversion parameters31 fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="inversion parameters">','<section name="inversion" />');32 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="iscontrol" type="',class(obj.iscontrol),'" default="',convert2str(obj.iscontrol),'">',' <section name="inversion" />',' <help> is inversion activated? </help>',' </parameter>');33 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="incomplete_adjoint" type="',class(obj.incomplete_adjoint),'" default="',convert2str(obj.incomplete_adjoint),'">',' <section name="inversion" />',' <help> 1: linear viscosity, 0: non-linear viscosity </help>',' </parameter>');34 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="control_parameters" type="',class(obj.control_parameters),'" default="',convert2str(obj.control_parameters),'">',' <section name="inversion" />',' <help> ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''} </help>',' </parameter>');35 36 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="nsteps" type="',class(obj.nsteps),'" default="',convert2str(obj.nsteps),'">',' <section name="inversion" />',' <help> number of optimization searches </help>',' </parameter>');37 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="cost_functions" type="',class(obj.cost_functions),'" default="',convert2str(obj.cost_functions),'">',' <section name="inversion" />',' <help> indicate the type of response for each optimization step </help>',' </parameter>');38 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="cost_functions_coefficients" type="',class(obj.cost_functions_coefficients),'" default="',convert2str(obj.cost_functions_coefficients),'">',' <section name="inversion" />',' <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>',' </parameter>');39 40 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="cost_function_threshold" type="',class(obj.cost_function_threshold),'" default="',convert2str(obj.cost_function_threshold),'">',' <section name="inversion" />',' <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>',' </parameter>');41 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="maxiter_per_step" type="',class(obj.maxiter_per_step),'" default="',convert2str(obj.maxiter_per_step),'">',' <section name="inversion" />',' <help> maximum iterations during each optimization step </help>',' </parameter>');42 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="gradient_scaling" type="',class(obj.gradient_scaling),'" default="',convert2str(obj.gradient_scaling),'">',' <section name="inversion" />',' <help> scaling factor on gradient direction during optimization, for each optimization step </help>',' </parameter>');43 44 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="step_threshold" type="',class(obj.step_threshold),'" default="',convert2str(obj.step_threshold),'">',' <section name="inversion" />',' <help> decrease threshold for misfit, default is 30% </help>',' </parameter>');45 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="min_parameters" type="',class(obj.min_parameters),'" default="',convert2str(obj.min_parameters),'">',' <section name="inversion" />',' <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>',' </parameter>');46 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="max_parameters" type="',class(obj.max_parameters),'" default="',convert2str(obj.max_parameters),'">',' <section name="inversion" />',' <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>',' </parameter>');47 48 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="vx_obs" type="',class(obj.vx_obs),'" default="',convert2str(obj.vx_obs),'">',' <section name="inversion" />',' <help> observed velocity x component [m/yr] </help>',' </parameter>');49 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="vy_obs" type="',class(obj.vy_obs),'" default="',convert2str(obj.vy_obs),'">',' <section name="inversion" />',' <help> observed velocity y component [m/yr] </help>',' </parameter>');50 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="vel_obs" type="',class(obj.vel_obs),'" default="',convert2str(obj.vel_obs),'">',' <section name="inversion" />',' <help> observed velocity magnitude [m/yr] </help>',' </parameter>');51 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="thickness_obs" type="',class(obj.thickness_obs),'" default="',convert2str(obj.thickness_obs),'">',' <section name="inversion" />',' <help> observed thickness [m]) </help>',' </parameter>');52 53 fprintf(fid,'%s\n%s\n','</frame>');54 55 fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Available cost functions">','<section name="inversion" />');56 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="SurfaceAbsVelMisfit" type="','string','" default="','101','">',' <section name="inversion" />',' <help> </help>',' </parameter>');57 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="SurfaceRelVelMisfit" type="','string','" default="','102','">',' <section name="inversion" />',' <help> </help>',' </parameter>');58 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="SurfaceLogVelMisfit" type="','string','" default="','103','">',' <section name="inversion" />',' <help> </help>',' </parameter>');59 60 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="SurfaceLogVxVyMisfit" type="','string','" default="','104','">',' <section name="inversion" />',' <help> </help>',' </parameter>');61 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="SurfaceAverageVelMisfit" type="','string','" default="','105','">',' <section name="inversion" />',' <help> </help>',' </parameter>');62 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="ThicknessAbsMisfit" type="','string','" default="','106','">',' <section name="inversion" />',' <help> </help>',' </parameter>');63 64 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="DragCoefficientAbsGradient" type="','string','" default="','107','">',' <section name="inversion" />',' <help> </help>',' </parameter>');65 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="RheologyBbarAbsGradient" type="','string','" default="','108','">',' <section name="inversion" />',' <help> </help>',' </parameter>');66 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="ThicknessAbsGradient" type="','string','" default="','109','">',' <section name="inversion" />',' <help> </help>',' </parameter>');67 68 fprintf(fid,'%s\n%s\n','</frame>');69 70 end % }}}27 function createxml(obj,fid) % {{{ 28 fprintf(fid, '<!-- inversion -->\n'); 29 30 % inversion parameters 31 fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="inversion parameters">','<section name="inversion" />'); 32 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="iscontrol" type="',class(obj.iscontrol),'" default="',convert2str(obj.iscontrol),'">',' <section name="inversion" />',' <help> is inversion activated? </help>',' </parameter>'); 33 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="incomplete_adjoint" type="',class(obj.incomplete_adjoint),'" default="',convert2str(obj.incomplete_adjoint),'">',' <section name="inversion" />',' <help> 1: linear viscosity, 0: non-linear viscosity </help>',' </parameter>'); 34 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="control_parameters" type="',class(obj.control_parameters),'" default="',convert2str(obj.control_parameters),'">',' <section name="inversion" />',' <help> ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''} </help>',' </parameter>'); 35 36 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="nsteps" type="',class(obj.nsteps),'" default="',convert2str(obj.nsteps),'">',' <section name="inversion" />',' <help> number of optimization searches </help>',' </parameter>'); 37 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="cost_functions" type="',class(obj.cost_functions),'" default="',convert2str(obj.cost_functions),'">',' <section name="inversion" />',' <help> indicate the type of response for each optimization step </help>',' </parameter>'); 38 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="cost_functions_coefficients" type="',class(obj.cost_functions_coefficients),'" default="',convert2str(obj.cost_functions_coefficients),'">',' <section name="inversion" />',' <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>',' </parameter>'); 39 40 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="cost_function_threshold" type="',class(obj.cost_function_threshold),'" default="',convert2str(obj.cost_function_threshold),'">',' <section name="inversion" />',' <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>',' </parameter>'); 41 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="maxiter_per_step" type="',class(obj.maxiter_per_step),'" default="',convert2str(obj.maxiter_per_step),'">',' <section name="inversion" />',' <help> maximum iterations during each optimization step </help>',' </parameter>'); 42 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="gradient_scaling" type="',class(obj.gradient_scaling),'" default="',convert2str(obj.gradient_scaling),'">',' <section name="inversion" />',' <help> scaling factor on gradient direction during optimization, for each optimization step </help>',' </parameter>'); 43 44 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="step_threshold" type="',class(obj.step_threshold),'" default="',convert2str(obj.step_threshold),'">',' <section name="inversion" />',' <help> decrease threshold for misfit, default is 30% </help>',' </parameter>'); 45 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="min_parameters" type="',class(obj.min_parameters),'" default="',convert2str(obj.min_parameters),'">',' <section name="inversion" />',' <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>',' </parameter>'); 46 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="max_parameters" type="',class(obj.max_parameters),'" default="',convert2str(obj.max_parameters),'">',' <section name="inversion" />',' <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>',' </parameter>'); 47 48 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="vx_obs" type="',class(obj.vx_obs),'" default="',convert2str(obj.vx_obs),'">',' <section name="inversion" />',' <help> observed velocity x component [m/yr] </help>',' </parameter>'); 49 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="vy_obs" type="',class(obj.vy_obs),'" default="',convert2str(obj.vy_obs),'">',' <section name="inversion" />',' <help> observed velocity y component [m/yr] </help>',' </parameter>'); 50 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="vel_obs" type="',class(obj.vel_obs),'" default="',convert2str(obj.vel_obs),'">',' <section name="inversion" />',' <help> observed velocity magnitude [m/yr] </help>',' </parameter>'); 51 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="thickness_obs" type="',class(obj.thickness_obs),'" default="',convert2str(obj.thickness_obs),'">',' <section name="inversion" />',' <help> observed thickness [m]) </help>',' </parameter>'); 52 53 fprintf(fid,'%s\n%s\n','</frame>'); 54 55 fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Available cost functions">','<section name="inversion" />'); 56 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="SurfaceAbsVelMisfit" type="','string','" default="','101','">',' <section name="inversion" />',' <help> </help>',' </parameter>'); 57 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="SurfaceRelVelMisfit" type="','string','" default="','102','">',' <section name="inversion" />',' <help> </help>',' </parameter>'); 58 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="SurfaceLogVelMisfit" type="','string','" default="','103','">',' <section name="inversion" />',' <help> </help>',' </parameter>'); 59 60 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="SurfaceLogVxVyMisfit" type="','string','" default="','104','">',' <section name="inversion" />',' <help> </help>',' </parameter>'); 61 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="SurfaceAverageVelMisfit" type="','string','" default="','105','">',' <section name="inversion" />',' <help> </help>',' </parameter>'); 62 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="ThicknessAbsMisfit" type="','string','" default="','106','">',' <section name="inversion" />',' <help> </help>',' </parameter>'); 63 64 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="DragCoefficientAbsGradient" type="','string','" default="','107','">',' <section name="inversion" />',' <help> </help>',' </parameter>'); 65 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="RheologyBbarAbsGradient" type="','string','" default="','108','">',' <section name="inversion" />',' <help> </help>',' </parameter>'); 66 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',' <parameter key ="ThicknessAbsGradient" type="','string','" default="','109','">',' <section name="inversion" />',' <help> </help>',' </parameter>'); 67 68 fprintf(fid,'%s\n%s\n','</frame>'); 69 70 end % }}} 71 71 function obj = inversion(varargin) % {{{ 72 72 switch nargin … … 74 74 obj=setdefaultparameters(obj); 75 75 case 1 76 if isa(varargin{1},'taoinversion'), 77 disp('converting taoinversion'); 78 in=varargin{1}; 79 obj=inversion(); 80 obj.iscontrol = in.iscontrol; 81 obj.incomplete_adjoint = in.incomplete_adjoint; 82 obj.control_parameters = in.control_parameters; 83 obj.nsteps = in.nsteps; 84 obj.maxiter_per_step = 10*ones(in.nsteps,1); 85 obj.cost_functions = in.cost_functions; 86 obj.cost_functions_coefficients = in.cost_functions_coefficients; 87 obj.gradient_scaling = 100*ones(in.nsteps,1); 88 obj.cost_function_threshold = NaN; 89 obj.min_parameters = in.min_parameters; 90 obj.max_parameters = in.max_parameters; 91 obj.step_threshold = .99*ones(in.nsteps,1); 92 obj.vx_obs = in.vx_obs; 93 obj.vy_obs = in.vy_obs; 94 obj.vz_obs = in.vz_obs; 95 obj.vel_obs = in.vel_obs; 96 obj.thickness_obs = in.thickness_obs; 97 elseif isa(varargin{1},'inversion'), 98 obj = varargin{1}; 99 else 100 error('constructor not supported'); 101 end 76 obj=structtoobj(inversion(),varargin{1}); 102 77 otherwise 103 78 error('constructor not supported'); -
issm/trunk-jpl/src/m/classes/m1qn3inversion.m
r17918 r17920 30 30 obj=setdefaultparameters(obj); 31 31 case 1 32 obj=structtoobj( obj,varargin{1});32 obj=structtoobj(m1qn3inversion(),varargin{1}); 33 33 otherwise 34 34 error('constructor not supported'); -
issm/trunk-jpl/src/m/classes/taoinversion.m
r17918 r17920 33 33 obj=setdefaultparameters(obj); 34 34 case 1 35 obj=structtoobj( obj,varargin{1});35 obj=structtoobj(taoinversion(),varargin{1}); 36 36 otherwise 37 37 error('constructor not supported');
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/trac/issm/chrome/common/trac_banner.png)