loadresultsfromdisk

PURPOSE ^

LOADRESULTSFROMDISK - load results of solution sequence from disk file "filename"

SYNOPSIS ^

function md=loadresultsfromdisk(md,filename,solutiontype)

DESCRIPTION ^

LOADRESULTSFROMDISK - load results of solution sequence from disk file "filename"            

   Usage:
      md=loadresultsfromdisk(md,filename);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function md=loadresultsfromdisk(md,filename,solutiontype)
0002 %LOADRESULTSFROMDISK - load results of solution sequence from disk file "filename"
0003 %
0004 %   Usage:
0005 %      md=loadresultsfromdisk(md,filename);
0006 
0007 %We convert all results to m/a units, from m/s
0008 
0009 if ((nargin~=3) | (nargout~=1)),
0010     help loadresultsfromdisk;
0011     error('loadresultsfromdisk: error message.');
0012 end
0013 
0014 
0015 results=parseresultsfromdisk(filename);
0016 
0017 %First get solution type
0018 analysis_type=results{1};
0019 
0020 %Get uset.gsize
0021 uset.gsize=results{2};
0022 
0023 %Get tpart
0024 tpart=results{3};
0025 
0026 %now to specialized reading
0027 if strcmpi(analysis_type,'diagnostic_horiz'),
0028 
0029     %Get u_g
0030     u_g=results{4};
0031 
0032     %Used to recover velocities
0033     indx=1:6:uset.gsize;
0034     indy=2:6:uset.gsize;
0035     indx=indx(tpart);
0036     indy=indy(tpart);
0037 
0038     %Recover velocity
0039     md.vx=u_g(indx)*md.yts;
0040     md.vy=u_g(indy)*md.yts;
0041     md.vel=sqrt(md.vx.^2+md.vy.^2);
0042 
0043 elseif strcmpi(analysis_type,'control'),
0044 
0045     %read num_control_parameters
0046     num_control_parameters=results{4};
0047     nsteps=results{5};
0048     
0049     %read J
0050     md.cont_J=results{6};
0051 
0052     %Used to recover parameters and velocit
0053     indx=1:6:uset.gsize;
0054     indy=2:6:uset.gsize;
0055     indx=indx(tpart);
0056     indy=indy(tpart);
0057 
0058 
0059     %read parameters
0060     for i=1:num_control_parameters,
0061         control_parameter=results{6+i};
0062         cont_parameters{i}=control_parameter(indx);
0063     end
0064     md.cont_parameters=cont_parameters;
0065 
0066     %Recover velocity
0067     u_g=results{7+num_control_parameters};
0068 
0069     md.cont_vx=u_g(indx)*md.yts;
0070     md.cont_vy=u_g(indy)*md.yts;
0071     md.cont_vel=sqrt(md.cont_vx.^2+md.cont_vy.^2);
0072 elseif strcmpi(analysis_type,'thermalsteady'),
0073 
0074     %read t_g
0075     t_g=results{4};
0076 
0077     %Used to recover velocities
0078     indx=1:6:uset.gsize;
0079     indx=indx(tpart);
0080 
0081     %Recover velocity
0082     md.temperature=t_g(indx);
0083 else
0084     error(['loadresultsfromdisk error message: unknow solution type ',analysis_type]);
0085 end
0086 
0087 
0088 %Check result is consistent
0089 disp(sprintf('%s\n','checking result consistency'));
0090 
0091 if ~isresultconsistent(md,solutiontype),
0092     disp('!! results not consistent correct the model !!') %it would be very cruel to put an error, it would kill the computed results (even if not consistent...)
0093 end

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003