Changeset 22281
- Timestamp:
- 11/30/17 08:06:43 (7 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
r22280 r22281 315 315 void TransientInput::GetInputAverageOnTimes(IssmDouble** pvalues, IssmDouble init_time){/*{{{*/ 316 316 317 IssmDouble time;318 IssmDouble preceding_time;317 int numnodes; 318 IssmDouble subtimestep; 319 319 IssmDouble* values= NULL; 320 321 values=xNew<IssmDouble>(3); 322 320 Input* input=NULL; 321 322 /*Initialize numnode from transientinput out of time loop*/ 323 323 for(int i=0;i<this->numtimesteps;i++){ 324 time = this->timesteps[i]; 325 TriaInput* input = (TriaInput*)this->inputs->GetObjectByOffset(i); _assert_(input); 326 int numnodes = input->NumberofNodes(input->interpolation_type); 324 /*First compute the lengt of the sub-timestep*/ 327 325 if(i==0){ 328 preceding_time = init_time; 329 for(int j=0;j<numnodes;j++){ 330 values[j]=(input->values[j]*(time-preceding_time)); 331 } 326 subtimestep = this->timesteps[i]-init_time; 332 327 } 333 328 else{ 334 preceding_time = this->timesteps[i-1]; 329 subtimestep = this->timesteps[i]-this->timesteps[i-1]; 330 } 331 /*Figure out type of input and get it*/ 332 input = xDynamicCast<Input*>(this->inputs->GetObjectByOffset(i)); _assert_(input); 333 switch(input->ObjectEnum()){ 334 case TriaInputEnum:{ 335 TriaInput* triainput = xDynamicCast<TriaInput*>(this->inputs->GetObjectByOffset(i)); _assert_(triainput); 336 numnodes= triainput->NumberofNodes(triainput->interpolation_type); 337 values=xNewZeroInit<IssmDouble>(numnodes); 338 /*Sum the values weighted by their respective sub-timestep*/ 335 339 for(int j=0;j<numnodes;j++){ 336 values[j]+=(input->values[j]*(time-preceding_time)); 337 if(i==this->numtimesteps-1){ 338 values[j]=values[j]/(this->timesteps[this->numtimesteps-1]-init_time); 339 } 340 values[j]+=(triainput->values[j]*subtimestep); 340 341 } 342 break; 341 343 } 344 case PentaInputEnum:{ 345 PentaInput* pentainput = xDynamicCast<PentaInput*>(this->inputs->GetObjectByOffset(i)); _assert_(pentainput); 346 numnodes= pentainput->NumberofNodes(pentainput->interpolation_type); 347 values=xNewZeroInit<IssmDouble>(numnodes); 348 /*Sum the values weighted by their respective sub-timestep*/ 349 for(int j=0;j<numnodes;j++){ 350 values[j]+=(pentainput->values[j]*subtimestep); 351 } 352 break; 353 } 354 case TetraInputEnum:{ 355 TetraInput* tetrainput = xDynamicCast<TetraInput*>(this->inputs->GetObjectByOffset(i)); _assert_(tetrainput); 356 numnodes= tetrainput->NumberofNodes(tetrainput->interpolation_type); 357 values=xNewZeroInit<IssmDouble>(numnodes); 358 /*Sum the values weighted by their respective sub-timestep*/ 359 for(int j=0;j<numnodes;j++){ 360 values[j]+=(tetrainput->values[j]*subtimestep); 361 } 362 break; 363 } 364 default: _error_("not implemented yet"); 365 } 366 } 367 /*Compute the average based on the length of the full timestep*/ 368 for(int j=0;j<numnodes;j++){ 369 values[j]=values[j]/(this->timesteps[this->numtimesteps-1]-init_time); 342 370 } 343 371 *pvalues=values; -
issm/trunk-jpl/src/c/cores/hydrology_core.cpp
r22277 r22281 24 24 femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum); 25 25 26 if(VerboseSolution()) _printf0_(" computing water heads\n"); 27 28 /*first compute slopes: */ 26 /*Using the Shreve based Model*/ 29 27 if (hydrology_model==HydrologyshreveEnum){ 28 if(VerboseSolution()) _printf0_(" computing water heads\n"); 29 /*first compute slopes: */ 30 30 surfaceslope_core(femmodel); 31 31 bedslope_core(femmodel); 32 } 33 34 /*Using the Shreve based Model*/ 35 if (hydrology_model==HydrologyshreveEnum){ 32 /*and then go to water column*/ 36 33 if(VerboseSolution()) _printf0_(" computing water column\n"); 37 34 femmodel->SetCurrentConfiguration(HydrologyShreveAnalysisEnum); … … 45 42 int outputs[3] = {WatercolumnEnum,HydrologyWaterVxEnum,HydrologyWaterVyEnum}; 46 43 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3); 47 48 /*unload results*/49 if(VerboseSolution()) _printf0_(" saving temporary results\n");50 OutputResultsx(femmodel);51 44 } 52 45 } … … 56 49 /*intermediary: */ 57 50 int step,hydroslices; 58 int numoutputs ;51 int numoutputs=0; 59 52 char **requested_outputs = NULL; 60 53 IssmDouble time,init_time,hydrotime,yts; … … 111 104 if(VerboseSolution()) _printf0_(" saving results \n"); 112 105 femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs); 113 /*unload results removed 23/11 needs checking*/114 /* if(VerboseSolution()) _printf0_(" saving temporary results\n"); */115 /* OutputResultsx(femmodel); */116 106 } 117 107 /*Free ressources:*/ … … 119 109 for(int i=0;i<numoutputs;i++){ 120 110 xDelete<char>(requested_outputs[i]); 121 } 111 } 122 112 xDelete<char*>(requested_outputs); 123 113 } … … 138 128 int outputs[5] = {HydrologyHeadEnum,HydrologyGapHeightEnum,EffectivePressureEnum,HydrologyBasalFluxEnum,DegreeOfChannelizationEnum}; 139 129 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],5); 140 141 /*unload results*/142 if(VerboseSolution()) _printf0_(" saving temporary results\n");143 OutputResultsx(femmodel);144 130 } 145 131 }
Note:
See TracChangeset
for help on using the changeset viewer.