Changeset 8365
- Timestamp:
- 05/19/11 21:33:36 (14 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/ModelProcessorx/CreateDataSets.cpp
r8363 r8365 21 21 Elements *elements = NULL; 22 22 Materials *materials = NULL; 23 Parameters *parameters = NULL; 23 24 24 25 /*Create elements, vertices and materials, independent of analysis_type: */ … … 114 115 UpdateElementsAndMaterialsControl(elements,materials,iomodel,iomodel_handle); 115 116 116 /*Update Elements in case we are running a transient solution: */117 if(analysis_counter==(nummodels-1)&& (solution_type==Transient2DSolutionEnum || solution_type==Transient3DSolutionEnum)){118 UpdateElementsTransient(elements,iomodel,iomodel_handle,analysis_counter,analysis_type);119 }120 121 122 117 /*Generate objects that are not dependent on any analysis_type: */ 123 118 CreateParameters(pparameters,iomodel,iomodel_handle,solution_type,analysis_type,analysis_counter); 119 120 /*Update Elements in case we are running a transient solution: */ 121 parameters=*pparameters; 122 if(analysis_counter==(nummodels-1)&& (solution_type==Transient2DSolutionEnum || solution_type==Transient3DSolutionEnum)){ 123 UpdateElementsTransient(elements,parameters,iomodel,iomodel_handle,analysis_counter,analysis_type); 124 } 124 125 125 126 /*Sort datasets: */ -
issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.h
r8330 r8365 93 93 94 94 /*transient: */ 95 void UpdateElementsTransient(Elements* elements, IoModel* iomodel,FILE* iomodel_handle,int analysis_counter,int analysis_type);95 void UpdateElementsTransient(Elements* elements,Parameters* parameters,IoModel* iomodel,FILE* iomodel_handle,int analysis_counter,int analysis_type); 96 96 97 97 /*partitioning: */ -
issm/trunk/src/c/modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp
r8363 r8365 13 13 #include "../ModelProcessorx.h" 14 14 15 void UpdateElementsTransient(Elements* elements, IoModel* iomodel,FILE* iomodel_handle,int analysis_counter,int analysis_type){15 void UpdateElementsTransient(Elements* elements, Parameters* parameters,IoModel* iomodel,FILE* iomodel_handle,int analysis_counter,int analysis_type){ 16 16 17 17 /*Intermediary*/ 18 int i,j ;18 int i,j,k; 19 19 int counter; 20 20 Element *element = NULL; 21 21 char fetchstring[100]; 22 22 double time; 23 double forcingenum; 23 24 25 /*if no forcings, bail out: */ 26 printf("numforcings: %i\n",iomodel->numforcings); 27 if(!iomodel->numforcings)return; 28 29 /*download whatever data will persist through forcing loop: */ 30 IoModelFetchData(&iomodel->elements,NULL,NULL,iomodel_handle,"elements"); 24 31 25 /*download whatever data will persist through forcing processing: */26 IoModelFetchData(&iomodel-> elements,NULL,NULL,iomodel_handle,"elements");32 /*download forcing types: */ 33 IoModelFetchData(&iomodel->forcingtypes,NULL,NULL,iomodel_handle,"forcingtypes"); 27 34 28 /*Ok, let's go through forcings: */ 29 /*first, accumulation: */ 30 if(iomodel->forcing_accumulation_num_time_steps==0)_error_("accumulation forcing not available!"); 35 /*loop over forcings: */ 36 for(i=0;i<iomodel->numforcings;i++){ 31 37 32 iomodel->forcing_numtimesteps=iomodel->forcing_accumulation_num_time_steps; 33 IoModelFetchData(&iomodel->timesteps,NULL,NULL,iomodel_handle,"forcing_accumulation_time_steps"); 38 forcingenum=iomodel->forcingtypes[i]; 39 printf("forcing enum: %g\n",iomodel->forcingtypes[i]); 40 41 sprintf(&fetchstring[0],"forcing_%s_num_time_steps",EnumToStringx(forcingenum)); 42 IoModelFetchData(&iomodel->forcing_numtimesteps,iomodel_handle,fetchstring); 43 sprintf(&fetchstring[0],"forcing_%s_time_steps",EnumToStringx(forcingenum)); 44 IoModelFetchData(&iomodel->timesteps,NULL,NULL,iomodel_handle,fetchstring); 34 45 35 for(i=0;i<iomodel->forcing_accumulation_num_time_steps;i++){ 36 time=iomodel->timesteps[i]; 37 sprintf(&fetchstring[0],"forcing_accumulation_%i",i+1); 38 IoModelFetchData(&iomodel->forcing,NULL,NULL,iomodel_handle,fetchstring); 46 for(j=0;j<iomodel->forcing_numtimesteps;j++){ 47 48 time=iomodel->timesteps[j]; 49 sprintf(&fetchstring[0],"forcing_%s_%i",EnumToStringx(forcingenum),j+1); 50 IoModelFetchData(&iomodel->forcing,NULL,NULL,iomodel_handle,fetchstring); 39 51 40 41 42 /*we now have the forcing for the corresponding time step, for all the nodes. Use this 43 *to write over the existing accumulation input: */ 44 45 counter=0; 46 for (j=0;j<iomodel->numberofelements;j++){ 47 if(iomodel->my_elements[j]){ 48 element=(Element*)elements->GetObjectByOffset(counter); 49 element->UpdateForcing(j,iomodel,i,time,AccumulationRateEnum); //we need j to index into elements. 50 counter++; 51 52 /*we now have the forcing for the corresponding time step, for all the nodes. Use this 53 *to write over the existing accumulation input: */ 54 counter=0; 55 for (k=0;k<iomodel->numberofelements;k++){ 56 if(iomodel->my_elements[k]){ 57 element=(Element*)elements->GetObjectByOffset(counter); 58 element->UpdateForcing(k,iomodel,j,time,forcingenum,parameters); 59 counter++; 60 } 52 61 } 62 /*Free ressources:*/ 63 xfree((void**)&iomodel->forcing); 53 64 } 54 65 55 56 57 66 /*Free ressources:*/ 58 xfree((void**)&iomodel-> forcing);67 xfree((void**)&iomodel->timesteps); 59 68 } 60 61 69 62 70 /*Free ressources:*/ … … 64 72 xfree((void**)&iomodel->timesteps); 65 73 xfree((void**)&iomodel->elements); 66 74 xfree((void**)&iomodel->forcingtypes); 67 75 } -
issm/trunk/src/c/objects/Elements/Element.h
r8363 r8365 59 59 virtual void DeleteResults(void)=0; 60 60 virtual void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type)=0; 61 virtual void UpdateForcing(int index, IoModel* iomodel,int step,double time, int FieldEnum )=0;61 virtual void UpdateForcing(int index, IoModel* iomodel,int step,double time, int FieldEnum,Parameters* parameters)=0; 62 62 virtual void InputToResult(int enum_type,int step,double time)=0; 63 63 virtual void ControlInputGetGradient(Vec gradient,int enum_type)=0; -
issm/trunk/src/c/objects/Elements/Penta.h
r8363 r8365 129 129 double SurfaceArea(void); 130 130 void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type); 131 void UpdateForcing(int index, IoModel* iomodel,int step,double time, int FieldEnum ){_error_("not supported yet!");}131 void UpdateForcing(int index, IoModel* iomodel,int step,double time, int FieldEnum,Parameters* parameters){_error_("not supported yet!");} 132 132 int UpdateShelfStatus(Vec new_shelf_nodes); 133 133 void UpdateShelfFlags(double* new_shelf_nodes); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r8363 r8365 5868 5868 /*}}}*/ 5869 5869 /*FUNCTION Tria::UpdateForcing(int index,IoModel* iomodel,int step,double time, int FieldEnum){{{1*/ 5870 void Tria::UpdateForcing(int index,IoModel* iomodel,int step,double time, int FieldEnum ){5870 void Tria::UpdateForcing(int index,IoModel* iomodel,int step,double time, int FieldEnum,Parameters* parameters){ 5871 5871 5872 5872 /*Intermediaries*/ … … 5880 5880 /*recover forcing for this time step: */ 5881 5881 for(i=0;i<3;i++)nodeinputs[i]=iomodel->forcing[tria_vertex_ids[i]-1]; 5882 5883 /*process units: */ 5884 UnitConversion(&nodeinputs[0], 3 ,ExtToIuEnum, FieldEnum, parameters); 5882 5885 5883 5886 if(step==0){ -
issm/trunk/src/c/objects/Elements/Tria.h
r8363 r8365 134 134 double SurfaceArea(void); 135 135 void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type); 136 void UpdateForcing(int index, IoModel* iomodel,int step,double time, int FieldEnum );136 void UpdateForcing(int index, IoModel* iomodel,int step,double time, int FieldEnum,Parameters* parameters); 137 137 int UpdateShelfStatus(Vec new_shelf_nodes); 138 138 int UpdatePotentialSheetUngrounding(double* potential_sheet_ungrounding,Vec vec_nodes_on_iceshelf,double* nodes_on_iceshelf); -
issm/trunk/src/c/objects/IoModel.cpp
r8363 r8365 89 89 xfree((void**)&this->melting_rate_correction); 90 90 xfree((void**)&this->accumulation_rate); 91 xfree((void**)&this->forcingtypes); 91 92 xfree((void**)&this->forcing); 92 93 xfree((void**)&this->timesteps); … … 221 222 IoModelFetchData(&this->gl_melting_rate,iomodel_handle,"gl_melting_rate"); 222 223 IoModelFetchData(&this->rheology_law,iomodel_handle,"rheology_law"); 223 IoModelFetchData(&this-> forcing_accumulation_num_time_steps,iomodel_handle,"forcing_accumulation_num_time_steps");224 IoModelFetchData(&this->numforcings,iomodel_handle,"numforcings"); 224 225 225 226 /*qmu: */ … … 402 403 403 404 /*forcings: */ 404 this->forcing_accumulation_num_time_steps=0; 405 this->numforcings=0; 406 this->forcingtypes=NULL; 405 407 this->forcing_numtimesteps=0; 406 408 this->forcing=NULL; 407 409 this->timesteps=NULL; 408 410 409 411 /*parameter output: */ 410 412 this->numoutput=0; -
issm/trunk/src/c/objects/IoModel.h
r8363 r8365 198 198 199 199 /*forcings: */ 200 int forcing_accumulation_num_time_steps; 200 int numforcings; 201 double* forcingtypes; 201 202 int forcing_numtimesteps; 202 203 double* forcing; -
issm/trunk/src/c/shared/Numerics/UnitConversion.cpp
r6412 r8365 69 69 case DhDtEnum: scale=yts;break; //m/yr 70 70 case MeltingRateEnum: scale=yts;break; //m/yr 71 case AccumulationRateEnum: scale=yts;break; //m/yr 71 72 case MisfitEnum: scale=pow(yts,2);break; //(m/yr)^2 72 73 case MassFluxEnum: scale=pow(10,-12)*yts;break; // (GigaTon/year) -
issm/trunk/src/c/solutions/transient2d_core.cpp
r8363 r8365 87 87 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedEnum,step,time); 88 88 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,AccumulationRateEnum,step,time); 89 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,MeltingRateEnum,step,time); 89 90 if(gl_migration!=NoneEnum)InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ElementOnIceShelfEnum,step,time); 90 91 -
issm/trunk/src/m/classes/model.m
r8330 r8365 183 183 184 184 %Forcings 185 forcing _accumulation=NaN;185 forcings=NaN; 186 186 187 187 %Statics parameters -
issm/trunk/src/m/model/ismodelselfconsistent.m
r8352 r8365 289 289 end 290 290 291 %Check that forcing has length numberofnodes+1 292 fields={'forcing_accumulation'}; 293 checklength(md,fields,md.numberofnodes+1) 291 %Check that all forcings have length numberofnodes+1 292 forcingnames=fieldnames(md.forcings); 293 forcingfields={}; 294 for i=1:length(forcingnames), 295 forcingfields{end+1}=['forcings.' forcingnames{i}]; 296 end 297 checklength(md,forcingfields,md.numberofnodes+1) 294 298 295 299 %Check that forcing columns are properly ordered 296 if md.forcing_accumulation(end,:)~=sort(md.forcing_accumulation(end,:)), 297 error(['model not consistent: model ' md.name ' forcing_accumulation field columns should be chronological']); 298 end 299 300 for i=1:length(forcingnames), 301 if md.forcings.(forcingnames{i})(end,:)~=sort(md.forcings.(forcingnames{i})(end,:)), 302 error(['model not consistent: model ' md.name ' forcings.' forcingnames{i} ' columns should be chronological']); 303 end 304 end 300 305 301 306 end -
issm/trunk/src/m/model/marshall.m
r8363 r8365 94 94 WriteData(fid,md.melting_rate_correction_apply,'Integer','melting_rate_correction_apply'); 95 95 96 if ~isnan(md.forcing_accumulation), 97 WriteData(fid,size(md.forcing_accumulation,2),'Integer','forcing_accumulation_num_time_steps'); 98 WriteData(fid,md.forcing_accumulation(end,:),'Mat','forcing_accumulation_time_steps'); 99 for i=1:size(md.forcing_accumulation,2), 100 WriteData(fid,md.forcing_accumulation(1:end-1,i),'Mat',['forcing_accumulation_' num2str(i)]); 96 %deal with forcings 97 if ~isnans(md.forcings), 98 forcingnames=fieldnames(md.forcings); 99 numforcings=length(forcingnames); 100 forcingtypes=zeros(numforcings,1); 101 for i=1:numforcings, 102 forcingtypes(i)=StringToEnum(forcingnames{i}); 103 end 104 WriteData(fid,numforcings,'Integer','numforcings'); 105 WriteData(fid,forcingtypes,'Mat','forcingtypes'); 106 107 for i=1:numforcings, 108 forcing=md.forcings.(forcingnames{i}); 109 forcingname=forcingnames{i}; 110 111 WriteData(fid,size(forcing,2),'Integer',['forcing_' forcingname '_num_time_steps']); 112 WriteData(fid,forcing(end,:),'Mat',['forcing_' forcingname '_time_steps']); 113 for j=1:size(forcing,2), 114 WriteData(fid,forcing(1:end-1,j),'Mat',['forcing_' forcingname '_' num2str(j)]); 115 end 101 116 end 102 117 else 103 WriteData(fid,0,'Integer',' forcing_accumulation_num_time_steps');118 WriteData(fid,0,'Integer','numforcings'); 104 119 end 105 120 -
issm/trunk/src/m/utils/BC/SetIceSheetBC.m
r8320 r8365 31 31 if isnan(md.accumulation_rate), 32 32 md.accumulation_rate=zeros(md.numberofnodes,1); 33 md.forcing _accumulation=[zeros(md.numberofnodes+1,1)];33 md.forcings.AccumulationRate=[zeros(md.numberofnodes+1,1)]; 34 34 disp(' no accumulation_rate specified: values set as zero'); 35 35 end -
issm/trunk/src/m/utils/BC/SetIceShelfBC.m
r8320 r8365 62 62 if isnan(md.accumulation_rate), 63 63 md.accumulation_rate=zeros(md.numberofnodes,1); 64 md.forcing _accumulation=zeros(md.numberofnodes+1,1);64 md.forcings.AccumulationRate=zeros(md.numberofnodes+1,1); 65 65 disp(' no accumulation_rate specified: values set as zero'); 66 66 end -
issm/trunk/src/m/utils/BC/SetMarineIceSheetBC.m
r8320 r8365 72 72 if isnan(md.accumulation_rate), 73 73 md.accumulation_rate=zeros(md.numberofnodes,1); 74 md.forcing _accumulation=zeros(md.numberofnodes+1,1);74 md.forcings.AccumulationRate=zeros(md.numberofnodes+1,1); 75 75 disp(' no accumulation_rate specified: values set as zero'); 76 76 end
Note:
See TracChangeset
for help on using the changeset viewer.