Changeset 5487
- Timestamp:
- 08/23/10 00:37:16 (15 years ago)
- Location:
- issm/trunk/src/m/qmu
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/qmu/expandvariables.m
r5215 r5487 18 18 for j=1:length(variables.(fnames{i})) 19 19 %call setupdesign 20 dvar.(fnames{i})=QmuSetup Design(md,dvar.(fnames{i}),variables.(fnames{i})(j));20 dvar.(fnames{i})=QmuSetupVariables(md,dvar.(fnames{i}),variables.(fnames{i})(j)); 21 21 end 22 22 end -
issm/trunk/src/m/qmu/preqmu.m
r5215 r5487 41 41 responses=md.responses(options.iresp); 42 42 43 %expand variables 43 %expand variables and responses 44 44 variables=expandvariables(md,md.variables); 45 responses=expandresponses(md,md.responses); 45 46 46 %go through variables, and check they don't have more than md.npart values 47 %go through variables and responses, and check they don't have more than md.npart values. Also determine numvariables and numresponses{{{1 48 numvariables=0; 47 49 variable_fieldnames=fieldnames(variables); 48 50 for i=1:length(variable_fieldnames), … … 52 54 error('preqmu error message: one of the expanded variables has more values than the number of partitions (setup in md.npart)'); 53 55 end 54 end55 56 %create m and in files for dakota57 dakota_in_data(md.qmu_method(options.imethod),variables,md.responses,md.qmu_params(options.iparams),options.qmufile);58 59 %in library mode, we only need the dakota in file60 system(['rm -rf ' md.name '.m']);61 62 %figure out number of variables and responses, it's not straightforwared63 numvariables=0;64 variable_fieldnames=fieldnames(variables);65 for i=1:length(variable_fieldnames),66 field_name=variable_fieldnames{i};67 fieldvariables=variables.(field_name);68 56 numvariables=numvariables+numel(variables.(field_name)); 69 57 end … … 74 62 field_name=response_fieldnames{i}; 75 63 fieldresponses=responses.(field_name); 64 if numel(fieldresponses)>md.npart, 65 error('preqmu error message: one of the expanded responses has more values than the number of partitions (setup in md.npart)'); 66 end 76 67 numresponses=numresponses+numel(responses.(field_name)); 77 68 end 69 %}}}} 78 70 79 % ok, now, for this particular qmu analysis, iresp and ivar specifiy the variables and responses.80 %The Qmu module will need a list of variable descriptors and response descriptors. 81 %For ease of use, we gather this list here. 71 %create in file for dakota 72 dakota_in_data(md.qmu_method(options.imethod),variables,responses,md.qmu_params(options.iparams),options.qmufile); 73 system(['rm -rf ' md.name '.m']); 82 74 83 count=0; 84 variable_fieldnames=fieldnames(variables); 75 %build a list of variables and responses descriptors. the list is not expanded. {{{1 85 76 variabledescriptors={}; 77 variable_fieldnames=fieldnames(md.variables); 86 78 for i=1:length(variable_fieldnames), 87 79 field_name=variable_fieldnames{i}; 88 fieldvariables=variables.(field_name); 89 for j=1:length(fieldvariables), 90 descriptor=fieldvariables(j).descriptor; 91 variabledescriptors{end+1}=descriptor; 92 count=count+1; 93 end 80 variabledescriptors{end+1}=md.variables.(field_name).descriptor; 94 81 end 95 82 96 count=0;97 response_fieldnames=fieldnames(responses);98 83 responsedescriptors={}; 84 response_fieldnames=fieldnames(md.responses); 99 85 for i=1:length(response_fieldnames), 100 86 field_name=response_fieldnames{i}; 101 fieldresponses=responses.(field_name); 102 for j=1:length(fieldresponses), 103 descriptor=fieldresponses(j).descriptor; 104 responsedescriptors{end+1}=descriptor; 105 count=count+1; 106 end 87 responsedescriptors{end+1}=md.responses.(field_name).descriptor; 107 88 end 89 %}}} 108 90 109 91 %register the fields that will be needed by the Qmu model. … … 112 94 md.variabledescriptors=variabledescriptors; 113 95 md.responsedescriptors=responsedescriptors; 96 md.numvariabledescriptors=numel(md.variabledescriptors); 97 md.numresponsedescriptors=numel(md.responsedescriptors); 114 98 115 99 %now, we have to provide all the info necessary for the solutions to compute the responses. For ex, if mass_flux -
issm/trunk/src/m/qmu/process_qmu_response_data.m
r4861 r5487 16 16 17 17 %Do we have to process mass flux profiles? 18 if strncmpi(md.responsedescriptors{i},' MassFlux',8),18 if strncmpi(md.responsedescriptors{i},'indexed_MassFlux',16), 19 19 num_mass_flux=num_mass_flux+1; 20 20 process_mass_flux_profiles=1; -
issm/trunk/src/m/qmu/qmumarshall.m
r5215 r5487 21 21 end 22 22 23 % write number of variables to disk23 %deal with variables 24 24 WriteData(fid,md.numberofvariables,'Integer','numberofvariables'); 25 26 %now, for each variable, write descriptor 27 for i=1:numel(md.variabledescriptors), 25 WriteData(fid,md.numvariabledescriptors,'Integer','numvariabledescriptors'); 26 for i=1:md.numvariabledescriptors, 28 27 field_name=md.variabledescriptors{i}; 29 28 WriteData(fid,field_name,'String',['variabledescriptor' num2str(i)]); 30 29 end 31 32 30 33 31 %deal with responses … … 35 33 %write number of responses to disk 36 34 WriteData(fid,md.numberofresponses,'Integer','numberofresponses'); 37 38 %now, for each response, write descriptor 39 for i=1:numel(md.responsedescriptors), 35 WriteData(fid,md.numresponsedescriptors,'Integer','numresponsedescriptors'); 36 for i=1:md.numresponsedescriptors, 40 37 field_name=md.responsedescriptors{i}; 41 38 WriteData(fid,field_name,'String',['responsedescriptor' num2str(i)]); 42 39 end 43 44 40 45 41 %write response specific data … … 48 44 for i=1:numel(md.responsedescriptors), 49 45 field_name=md.responsedescriptors{i}; 50 if strncmpi(field_name,' MassFlux',8),46 if strncmpi(field_name,'indexed_MassFlux',16), 51 47 qmu_segments=1; 52 48 end
Note:
See TracChangeset
for help on using the changeset viewer.