Changeset 25473
- Timestamp:
- 08/25/20 15:11:38 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/cores/transient_core.cpp
r25472 r25473 24 24 /*parameters: */ 25 25 IssmDouble finaltime,dt,yts; 26 bool isoceancoupling,iscontrol,isautodiff,isgroundingline,isslr; 27 bool save_results,dakota_analysis; 26 bool isoceancoupling,iscontrol,isautodiff,isslr; 28 27 int timestepping; 29 int output_frequency; 30 int sb_coupling_frequency; 31 int recording_frequency; 32 int groundingline_migration,smb_model,amr_frequency,amr_restart; 33 int numoutputs; 28 int output_frequency,recording_frequency; 29 int amr_frequency,amr_restart; 34 30 char **requested_outputs = NULL; 35 31 … … 47 43 femmodel->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum); 48 44 femmodel->parameters->FindParam(&yts,ConstantsYtsEnum); 49 femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);50 45 femmodel->parameters->FindParam(&output_frequency,SettingsOutputFrequencyEnum); 51 femmodel->parameters->FindParam(&sb_coupling_frequency,SettingsSbCouplingFrequencyEnum);52 46 femmodel->parameters->FindParam(×tepping,TimesteppingTypeEnum); 53 47 femmodel->parameters->FindParam(&isslr,TransientIsslrEnum); 54 femmodel->parameters->FindParam(&isgroundingline,TransientIsgroundinglineEnum);55 48 femmodel->parameters->FindParam(&isoceancoupling,TransientIsoceancouplingEnum); 56 49 femmodel->parameters->FindParam(&amr_frequency,TransientAmrFrequencyEnum); 57 50 femmodel->parameters->FindParam(&iscontrol,InversionIscontrolEnum); 58 51 femmodel->parameters->FindParam(&isautodiff,AutodiffIsautodiffEnum); 59 if(isgroundingline) femmodel->parameters->FindParam(&groundingline_migration,GroundinglineMigrationEnum);60 femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum);61 if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,TransientRequestedOutputsEnum);62 52 63 53 #if defined(_HAVE_BAMG_) && !defined(_HAVE_AD_) … … 99 89 femmodel->parameters->SetParam(step,StepEnum); 100 90 101 if(VerboseSolution()) _printf0_("iteration " << step << "/" << ceil((finaltime-time)/dt)+step << " time [yr]: " << setprecision(4) << time/yts << " (time step: " << dt/yts << ")\n"); 102 if(step%output_frequency==0 || (time >= finaltime - (yts*DBL_EPSILON)) || step==1) 103 save_results=true; 104 else 105 save_results=false; 91 if(VerboseSolution()){ 92 _printf0_("iteration " << step << "/" << ceil((finaltime-time)/dt)+step << \ 93 " time [yr]: " << setprecision(4) << time/yts << " (time step: " << dt/yts << ")\n"); 94 } 95 bool save_results=false; 96 if(step%output_frequency==0 || (time >= finaltime - (yts*DBL_EPSILON)) || step==1) save_results=true; 106 97 femmodel->parameters->SetParam(save_results,SaveResultsEnum); 107 98 … … 110 101 111 102 /*unload results*/ 112 if(VerboseSolution()) _printf0_(" computing requested outputs\n");113 femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs,save_results);114 if(isgroundingline && (groundingline_migration==AggressiveMigrationEnum || groundingline_migration==ContactEnum)){115 int outputs[1] = {MaskOceanLevelsetEnum};116 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1,save_results);117 }118 119 103 if(save_results){ 120 104 if(VerboseSolution()) _printf0_(" saving temporary results\n"); … … 156 140 if(iscontrol && isautodiff) femmodel->parameters->SetParam(dependent_objects,AutodiffDependentObjectsEnum); 157 141 158 /*Free ressources:*/159 if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}160 161 142 }/*}}}*/ 162 143 void transient_step(FemModel* femmodel){/*{{{*/ … … 164 145 /*parameters: */ 165 146 bool isstressbalance,ismasstransport,issmb,isthermal,isgroundingline,isgia,isesa; 166 bool isslr,ismovingfront,isdamageevolution,ishydrology,isoceancoupling; 167 bool save_results; 147 bool isslr,ismovingfront,isdamageevolution,ishydrology,isoceancoupling,save_results; 168 148 int step,sb_coupling_frequency; 169 int domaintype, smb_model;149 int domaintype,numoutputs; 170 150 171 151 /*then recover parameters common to all solutions*/ 172 152 femmodel->parameters->FindParam(&domaintype,DomainTypeEnum); 153 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 173 154 femmodel->parameters->FindParam(&step,StepEnum); 174 155 femmodel->parameters->FindParam(&sb_coupling_frequency,SettingsSbCouplingFrequencyEnum); … … 185 166 femmodel->parameters->FindParam(&isdamageevolution,TransientIsdamageevolutionEnum); 186 167 femmodel->parameters->FindParam(&ishydrology,TransientIshydrologyEnum); 168 femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum); 187 169 188 170 #if defined(_HAVE_OCEAN_ ) … … 193 175 if(issmb){ 194 176 bool isenthalpy; 177 int smb_model; 195 178 femmodel->parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum); 196 179 femmodel->parameters->FindParam(&smb_model,SmbEnum); … … 272 255 } 273 256 257 /*Any requested output that needs to be saved?*/ 258 if(numoutputs){ 259 char **requested_outputs = NULL; 260 femmodel->parameters->FindParam(&requested_outputs,&numoutputs,TransientRequestedOutputsEnum); 261 262 if(VerboseSolution()) _printf0_(" computing transient requested outputs\n"); 263 femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs,save_results); 264 265 /*Free ressources:*/ 266 for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs); 267 } 274 268 }/*}}}*/ 275 269 … … 279 273 /*parameters: */ 280 274 IssmDouble finaltime,dt,yts; 281 bool isoceancoupling,iscontrol,isautodiff,isgroundingline,isslr; 282 bool save_results,dakota_analysis; 275 bool isoceancoupling,iscontrol,isautodiff,isslr; 283 276 int timestepping; 284 277 int output_frequency; 285 int sb_coupling_frequency;286 278 int recording_frequency; 287 int groundingline_migration,smb_model,amr_frequency,amr_restart; 288 int numoutputs; 289 char **requested_outputs = NULL; 279 int amr_frequency,amr_restart; 290 280 291 281 /*intermediary: */ … … 302 292 femmodel->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum); 303 293 femmodel->parameters->FindParam(&yts,ConstantsYtsEnum); 304 femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);305 294 femmodel->parameters->FindParam(&output_frequency,SettingsOutputFrequencyEnum); 306 femmodel->parameters->FindParam(&sb_coupling_frequency,SettingsSbCouplingFrequencyEnum);307 295 femmodel->parameters->FindParam(×tepping,TimesteppingTypeEnum); 308 296 femmodel->parameters->FindParam(&isslr,TransientIsslrEnum); 309 femmodel->parameters->FindParam(&isgroundingline,TransientIsgroundinglineEnum);310 297 femmodel->parameters->FindParam(&amr_frequency,TransientAmrFrequencyEnum); 311 298 femmodel->parameters->FindParam(&iscontrol,InversionIscontrolEnum); 312 299 femmodel->parameters->FindParam(&isautodiff,AutodiffIsautodiffEnum); 313 femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum); 314 if(isgroundingline) femmodel->parameters->FindParam(&groundingline_migration,GroundinglineMigrationEnum); 315 if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,TransientRequestedOutputsEnum); 316 317 DataSet* dependent_objects=NULL; 300 301 DataSet* dependent_objects=NULL; 318 302 if(iscontrol){ 319 303 femmodel->parameters->FindParam(&dependent_objects,AutodiffDependentObjectsEnum); … … 346 330 transient_step(femmodel); 347 331 348 /*unload results*/349 if(VerboseSolution()) _printf0_(" computing requested outputs\n");350 femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs,false);351 352 332 if(recording_frequency && (step%recording_frequency==0)){ 353 333 if(VerboseSolution()) _printf0_(" checkpointing model \n"); … … 366 346 if(!iscontrol) femmodel->RequestedDependentsx(); 367 347 if(iscontrol) femmodel->parameters->SetParam(dependent_objects,AutodiffDependentObjectsEnum); 368 369 /*Free ressources:*/370 if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}371 372 348 }/*}}}*/ 373 349 #endif
Note:
See TracChangeset
for help on using the changeset viewer.