OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
staggeredproblem.C
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
35 #include "staggeredproblem.h"
36 #include "engngm.h"
37 #include "timestep.h"
38 #include "function.h"
39 #include "metastep.h"
40 #include "exportmodulemanager.h"
41 #include "mathfem.h"
42 #include "oofemtxtdatareader.h"
43 #include "util.h"
44 #include "verbose.h"
45 #include "classfactory.h"
46 #include "domain.h"
47 
48 #include <stdlib.h>
49 
50 #ifdef __OOFEG
51  #include "oofeggraphiccontext.h"
52 #endif
53 
54 namespace oofem {
55 REGISTER_EngngModel(StaggeredProblem);
56 
58  adaptiveStepLength(false),
59  minStepLength(0.),
60  maxStepLength(0.),
61  reqIterations(0.),
62  adaptiveStepSince(0.),
63  endOfTimeOfInterest(0.),
64  prevStepLength(0.),
65  currentStepLength(0.)
66 {
67  ndomains = 1; // domain is needed to store the time step function
68 
69  dtFunction = 0;
70  stepMultiplier = 1.;
72 }
73 
75 {}
76 
78 int
80 {
81  int result;
82  result = EngngModel :: instanciateYourself(dr, ir, dataOutputFileName, desc);
83  ir->finish();
84  // instanciate slave problems
85  result &= this->instanciateSlaveProblems();
86  return result;
87 }
88 
89 int
91 {
92  if ( timeDefinedByProb ) {
93  /* just set a nonzero number of steps;
94  * needed for instanciateDefaultMetaStep to pass; overall has no effect as time stepping is deteremined by slave
95  */
96  this->numberOfSteps = 1;
97  }
99  //there are no slave problems initiated so far, the overall metaStep will defined in a slave problem instantiation
100  return 1;
101 }
102 
103 int
105 {
106  //first instantiate master problem if defined
107  //EngngModel *timeDefProb = NULL;
108  emodelList.resize( inputStreamNames.size() );
109  if ( timeDefinedByProb ) {
111  std :: unique_ptr< EngngModel >prob( InstanciateProblem(dr, this->pMode, this->contextOutputMode, this) );
112  //timeDefProb = prob.get();
113  emodelList [ timeDefinedByProb - 1 ] = std :: move(prob);
114  }
115 
116  for ( int i = 1; i <= ( int ) inputStreamNames.size(); i++ ) {
117  if ( i == timeDefinedByProb ) {
118  continue;
119  }
120 
121  OOFEMTXTDataReader dr(inputStreamNames [ i - 1 ]);
122  //the slave problem dictating time needs to have attribute master=NULL, other problems point to the dictating slave
123  std :: unique_ptr< EngngModel >prob( InstanciateProblem(dr, this->pMode, this->contextOutputMode, this) );
124  emodelList [ i - 1 ] = std :: move(prob);
125  }
126 
127  return 1;
128 }
129 
130 
133 {
134  IRResultType result; // Required by IR_GIVE_FIELD macro
135 
137  if ( numberOfSteps <= 0 ) {
138  OOFEM_ERROR("nsteps not specified, bad format");
139  }
141  result = EngngModel :: initializeFrom(ir);
142  if ( result != IRRT_OK ) {
143  return result;
144  }
146  dtFunction = 0;
148  result = EngngModel :: initializeFrom(ir);
149  if ( result != IRRT_OK ) {
150  return result;
151  }
153  dtFunction = 0;
154  } else if ( ir->hasField(_IFT_StaggeredProblem_dtf) ) {
156  } else {
158  }
159 
161  adaptiveStepLength = true;
162  this->minStepLength = 0.;
164  this->maxStepLength = 1.e32;
166  this->reqIterations = 1;
168  this->endOfTimeOfInterest = 1.e32;
170  this->adaptiveStepSince = 0.;
172  }
173 
174 
176  if ( stepMultiplier < 0 ) {
177  OOFEM_WARNING("stepMultiplier must be > 0");
178  return IRRT_BAD_FORMAT;
179  }
180 
181  // timeLag = 0.;
182  // IR_GIVE_OPTIONAL_FIELD(ir, timeLag, _IFT_StaggeredProblem_timeLag);
183 
184  inputStreamNames.resize(2);
186  inputStreamNames.resize(3);
187  }
188 
192 
193 
194  renumberFlag = true; // The staggered problem itself should always try to check if the sub-problems needs renumbering.
195 
198 
199 
200  if ( dtFunction < 1 ) {
201  ndomains = 0;
202  domainNeqs.clear();
204  domainList.clear();
205  }
206 
208 
209  if ( suppressOutput ) {
210  printf("Suppressing output.\n");
211  } else {
212 
213  if ( ( outputStream = fopen(this->dataOutputFileName.c_str(), "w") ) == NULL ) {
214  OOFEM_ERROR("Can't open output file %s", this->dataOutputFileName.c_str());
215  }
216 
217  fprintf(outputStream, "%s", PRG_HEADER);
218  fprintf(outputStream, "\nStarting analysis on: %s\n", ctime(& this->startTime) );
219  fprintf(outputStream, "%s\n", simulationDescription.c_str());
220 
221 #ifdef __PARALLEL_MODE
222  if ( this->isParallel() ) {
223  fprintf(outputStream, "Problem rank is %d/%d on %s\n\n", this->rank, this->numProcs, this->processor_name);
224  }
225 #endif
226  }
227 
228 
229 
230  return IRRT_OK;
231 }
232 
233 
234 void
236 {
237  IRResultType result; // Required by IR_GIVE_FIELD macro
238 
239  InputRecord *ir = mStep->giveAttributesRecord();
240 
242 
243  // update attributes of slaves
244  for ( auto &emodel: emodelList ) {
245  emodel->updateAttributes(mStep);
246  }
247 
248  if ( !timeDefinedByProb ) {
253  if ( stepMultiplier < 0 ) {
254  OOFEM_ERROR("stepMultiplier must be > 0")
255  }
258  }
259  }
260 }
261 
263 // Returns the load-time function of the receiver.
264 {
265  if ( !dtFunction ) {
266  return NULL;
267  }
268 
269  return giveDomain(1)->giveFunction(dtFunction);
270 }
271 
272 double
274 {
275  if ( giveDtFunction() ) {
276  return giveDtFunction()->evaluateAtTime(n);
277  }
278 
279  //in the first step the time increment is taken as the initial, user-specified value
280  if ( stepMultiplier != 1 && currentStep ) {
281  if ( currentStep->giveNumber() >= 2 ) {
282  return ( currentStep->giveTargetTime() * ( stepMultiplier ) );
283  }
284  }
285 
286  if ( discreteTimes.giveSize() > 0 ) {
287  return this->giveDiscreteTime(n) - this->giveDiscreteTime(n - 1);
288  }
289 
290  if ( adaptiveStepLength ) {
291  EngngModel *sp;
292  int nite = 1;
293  double adjustedDeltaT = deltaT;
294 
295  if ( currentStep != NULL ) {
296  if ( currentStep->giveNumber() != 0 ) {
297  // return prescribed deltaT for times until time = adaptiveStepSince
298  // can be used for consecutive force loading applied in a specified number of steps
299  if ( !( currentStep->giveTargetTime() > this->adaptiveStepSince ) ) {
300  return adjustedDeltaT;
301  }
302 
303  for ( int i = 1; i <= this->giveNumberOfSlaveProblems(); i++ ) {
304  sp = this->giveSlaveProblem(i);
305  nite = max(sp->giveCurrentNumberOfIterations(), nite);
306  }
307 
308  if ( nite > reqIterations ) {
309  adjustedDeltaT = this->prevStepLength * reqIterations / nite;
310  } else {
311  adjustedDeltaT = this->prevStepLength * sqrt( sqrt( ( double ) reqIterations / ( double ) nite ) );
312  }
313 
314  if ( adjustedDeltaT > maxStepLength ) {
315  adjustedDeltaT = maxStepLength;
316  }
317 
318  if ( adjustedDeltaT < minStepLength ) {
319  adjustedDeltaT = minStepLength;
320  }
321  }
322  }
323 
324  this->currentStepLength = adjustedDeltaT;
325 
326  return adjustedDeltaT;
327  }
328 
329  return deltaT;
330 }
331 
332 double
334 {
335  if ( ( iStep > 0 ) && ( iStep <= discreteTimes.giveSize() ) ) {
336  return ( discreteTimes.at(iStep) );
337  }
338 
339  if ( ( iStep == 0 ) && ( iStep <= discreteTimes.giveSize() ) ) {
340  return ( 0.0 );
341  }
342 
343  OOFEM_ERROR("invalid iStep");
344  return 0.0;
345 }
346 
347 TimeStep *
349 {
350  if ( timeDefinedByProb ) {
351  return emodelList [ timeDefinedByProb - 1 ].get()->giveCurrentStep(true);
352  } else {
354  }
355 }
356 
357 TimeStep *
359 {
360  if ( timeDefinedByProb ) {
361  return emodelList [ timeDefinedByProb - 1 ].get()->givePreviousStep(true);
362  } else {
364  }
365 }
366 
367 TimeStep *
369 {
370  if ( timeDefinedByProb ) {
371  return emodelList [ timeDefinedByProb - 1 ].get()->giveSolutionStepWhenIcApply(true);
372  } else {
373  if ( !stepWhenIcApply ) {
374  int nFirst = giveNumberOfFirstStep();
375  //stepWhenIcApply.reset( new TimeStep(giveNumberOfTimeStepWhenIcApply(), this, 0, -giveDeltaT(nFirst), giveDeltaT(nFirst), 0) );//previous version for [-dt, 0]
376  stepWhenIcApply.reset( new TimeStep(giveNumberOfTimeStepWhenIcApply(), this, 0, 0., giveDeltaT(nFirst), 0) );//now go from [0, dt]
377  }
378 
379  return stepWhenIcApply.get();
380  }
381 }
382 
383 int
385 {
386  if ( timeDefinedByProb && !force) {
387  return emodelList [ timeDefinedByProb - 1 ].get()->giveNumberOfFirstStep(true);
388  } else {
390  }
391 }
392 
393 
394 TimeStep *
396 {
397  int istep = this->giveNumberOfFirstStep();
398  double totalTime = 0;
399  StateCounterType counter = 1;
400 
401  if ( !currentStep ) {
402  // first step -> generate initial step
404  }
405 
406  double dt = this->giveDeltaT(currentStep->giveNumber()+1);
407  istep = currentStep->giveNumber() + 1;
408  totalTime = currentStep->giveTargetTime() + this->giveDeltaT(istep);
409  counter = currentStep->giveSolutionStateCounter() + 1;
410  previousStep = std :: move(currentStep);
411  currentStep.reset( new TimeStep(*previousStep, dt) );
412 
413  if ( ( totalTime >= this->endOfTimeOfInterest ) && this->adaptiveStepLength ) {
414  totalTime = this->endOfTimeOfInterest;
415  OOFEM_LOG_INFO("\n==================================================================\n");
416  OOFEM_LOG_INFO( "\nAdjusting time step length to: %lf \n\n", totalTime - previousStep->giveTargetTime() );
417  currentStep.reset( new TimeStep(istep, this, 1, totalTime, totalTime - previousStep->giveTargetTime(), counter) );
418  this->numberOfSteps = istep;
419  } else {
420  if ( this->adaptiveStepLength ) {
421  OOFEM_LOG_INFO("\n==================================================================\n");
422  OOFEM_LOG_INFO( "\nAdjusting time step length to: %lf \n\n", totalTime - previousStep->giveTargetTime() );
423  }
424  currentStep.reset( new TimeStep(istep, this, 1, totalTime, totalTime - previousStep->giveTargetTime(), counter) );
425  }
426 
427  // time and dt variables are set eq to 0 for statics - has no meaning
428  return currentStep.get();
429 }
430 
431 
432 void
434 {
435  EngngModel *sp;
436  if ( !timeDefinedByProb ) {
437  sp = this;
438  } else { //time dictated by slave problem
440  }
441 
442  int smstep = 1, sjstep = 1;
444 
445  if ( sp->giveCurrentStep() ) {
446  smstep = sp->giveCurrentStep()->giveMetaStepNumber();
447  sjstep = sp->giveMetaStep(smstep)->giveStepRelativeNumber( sp->giveCurrentStep()->giveNumber() ) + 1;
448  }
449 
450  for ( int imstep = smstep; imstep <= sp->giveNumberOfMetaSteps(); imstep++ ) { //loop over meta steps
451  MetaStep *activeMStep = sp->giveMetaStep(imstep);
452  // update state according to new meta step in all slaves
453  this->initMetaStepAttributes(activeMStep);
454 
455  int nTimeSteps = activeMStep->giveNumberOfSteps();
456  for ( int jstep = sjstep; jstep <= nTimeSteps; jstep++ ) { //loop over time steps
459  sp->preInitializeNextStep();
460  sp->giveNextStep();
461 
462  // renumber equations if necessary. Ensure to call forceEquationNumbering() for staggered problems
463  if ( this->requiresEquationRenumbering( sp->giveCurrentStep() ) ) {
464  this->forceEquationNumbering();
465  }
466 
467  this->initializeYourself( sp->giveCurrentStep() );
468  this->solveYourselfAt( sp->giveCurrentStep() );
469  this->updateYourself( sp->giveCurrentStep() );
470  this->terminate( sp->giveCurrentStep() );
471 
473  double _steptime = this->timer.getUtime(EngngModelTimer :: EMTT_SolutionStepTimer);
474  OOFEM_LOG_INFO("EngngModel info: user time consumed by solution step %d: %.2fs\n",
475  sp->giveCurrentStep()->giveNumber(), _steptime);
476 
477  if(!suppressOutput) {
478  fprintf(this->giveOutputStream(), "\nUser time consumed by solution step %d: %.3f [s]\n\n",
479  sp->giveCurrentStep()->giveNumber(), _steptime);
480  }
481 
482 #ifdef __PARALLEL_MODE
483  if ( loadBalancingFlag ) {
484  this->balanceLoad( sp->giveCurrentStep() );
485  }
486 
487 #endif
488 
489  if ( ( sp->giveCurrentStep()->giveTargetTime() >= this->endOfTimeOfInterest ) && this->adaptiveStepLength ) {
490  break;
491  }
492  }
493  }
494 }
495 
496 void
498 {
499 #ifdef VERBOSE
500  OOFEM_LOG_RELEVANT("Solving [step number %5d, time %e]\n", tStep->giveNumber(), tStep->giveTargetTime());
501 #endif
502  for ( auto &emodel: emodelList ) {
503  emodel->solveYourselfAt(tStep);
504  }
505 
506  tStep->incrementStateCounter();
507 }
508 
509 int
511 {
512  int neqs = 0;
513  for ( auto &emodel: emodelList ) {
514  // renumber equations if necessary
515  if ( emodel->requiresEquationRenumbering( emodel->giveCurrentStep() ) ) {
516  neqs += emodel->forceEquationNumbering();
517  }
518  }
519 
520  return neqs;
521 }
522 
523 void
525 {
526  if ( adaptiveStepLength ) {
527  this->prevStepLength = this->currentStepLength;
528  }
529 
530  for ( auto &emodel: emodelList ) {
531  emodel->updateYourself(tStep);
532  }
533 
535 }
536 
537 void
539 {
540  for ( auto &emodel: emodelList ) {
541  emodel->terminate(tStep);
542  }
543 }
544 
545 void
547 {
548  for ( auto &emodel: emodelList ) {
549  emodel->giveExportModuleManager()->doOutput(tStep);
550  }
551 }
552 
553 
554 void
556 {
557  // Subproblems handle the output themselves.
558 }
559 
560 
563 {
564  EngngModel :: saveContext(stream, mode);
565  for ( auto &emodel: emodelList ) {
566  emodel->saveContext(stream, mode);
567  }
568 
569  return CIO_OK;
570 }
571 
572 
575 {
576  EngngModel :: restoreContext(stream, mode);
577  for ( auto &emodel: this->emodelList ) {
578  emodel->restoreContext(stream, mode);
579  }
580 
581  return CIO_OK;
582 }
583 
584 
585 EngngModel *
587 {
588  if ( ( i > 0 ) && ( i <= this->giveNumberOfSlaveProblems() ) ) {
589  return this->emodelList [ i - 1 ].get();
590  } else {
591  OOFEM_ERROR("Undefined problem");
592  }
593 
594  return NULL;
595 }
596 
597 
598 int
600 {
601  // check internal consistency
602  // if success returns nonzero
603  int result = 1;
604  for ( auto &emodel: emodelList ) {
605  result &= emodel->checkProblemConsistency();
606  }
607 
608 # ifdef VERBOSE
609  if ( result ) {
610  OOFEM_LOG_DEBUG("Consistency check: OK\n");
611  } else {
612  VERBOSE_PRINTS("Consistency check", "failed")
613  exit(1);
614  }
615 
616 # endif
617 
618  return result;
619 }
620 
621 void
623 {
624  for ( auto &emodel: emodelList ) {
625  emodel->updateDomainLinks();
626  }
627 }
628 
629 void
631 {
632  for ( auto &emodel: emodelList ) {
633  emodel->setRenumberFlag();
634  }
635 }
636 
637 #ifdef __OOFEG
639 {
640  int ap = gc.getActiveProblemIndx();
641  if ( ( ap > 0 ) && ( ap <= giveNumberOfSlaveProblems() ) ) {
642  this->giveSlaveProblem(ap)->drawYourself(gc);
643  }
644 }
645 
647 {
648  int ap = gc.getActiveProblemIndx();
649  if ( ( ap > 0 ) && ( ap <= giveNumberOfSlaveProblems() ) ) {
650  this->giveSlaveProblem(ap)->drawElements(gc);
651  }
652 }
653 
655 {
656  int ap = gc.getActiveProblemIndx();
657  if ( ( ap > 0 ) && ( ap <= giveNumberOfSlaveProblems() ) ) {
658  this->giveSlaveProblem(ap)->drawNodes(gc);
659  }
660 }
661 #endif
662 } // end namespace oofem
EngngModelTimer timer
E-model timer.
Definition: engngm.h:267
virtual void updateAttributes(MetaStep *mStep)
Update receiver attributes according to step metaStep attributes.
Definition: engngm.C:589
#define _IFT_StaggeredProblem_maxsteplength
FILE * outputStream
Output stream.
Definition: engngm.h:242
virtual void doStepOutput(TimeStep *tStep)
Prints the ouput of the solution step (using virtual this->printOutputAtservice) to the stream detemi...
std::unique_ptr< TimeStep > currentStep
Current time step.
Definition: engngm.h:231
virtual ~StaggeredProblem()
Destructor.
std::string simulationDescription
Definition: engngm.h:316
InputRecord * giveAttributesRecord()
Returns e-model attributes.
Definition: metastep.h:95
int giveNumberOfSteps()
Returns number of Steps it represent.
Definition: metastep.h:91
virtual EngngModel * giveSlaveProblem(int i)
Returns i-th slave problem.
void initMetaStepAttributes(MetaStep *mStep)
Update e-model attributes attributes according to step metaStep attributes.
Definition: engngm.C:580
char processor_name[PROCESSOR_NAME_LENGTH]
Processor name.
Definition: engngm.h:283
virtual bool requiresEquationRenumbering(TimeStep *tStep)
Returns true if equation renumbering is required for given solution step.
Definition: engngm.h:852
StaggeredProblem(int i, EngngModel *_master=NULL)
Constructor.
std::string dataOutputFileName
Path to output stream.
Definition: engngm.h:238
#define _IFT_StaggeredProblem_deltat
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description in input reader.
Definition: engngm.C:262
virtual int forceEquationNumbering()
Forces equation renumbering on all domains associated to engng model.
Class representing meta step.
Definition: metastep.h:62
virtual void solveYourselfAt(TimeStep *tStep)
Solves problem for given time step.
void startTimer(EngngModelTimerType t)
Definition: timer.h:128
int timeDefinedByProb
Optional parameter which specify problems to define load time functions.
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
std::vector< std::unique_ptr< Domain > > domainList
List of problem domains.
Definition: engngm.h:207
virtual void solveYourself()
Starts solution process.
#define _IFT_StaggeredProblem_adaptivestepsince
std::unique_ptr< TimeStep > previousStep
Previous time step.
Definition: engngm.h:233
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
int max(int i, int j)
Returns bigger value form two given decimals.
Definition: mathfem.h:71
MetaStep * giveMetaStep(int i)
Returns the i-th meta step.
Definition: engngm.C:1765
long StateCounterType
StateCounterType type used to indicate solution state.
#define _IFT_StaggeredProblem_adaptiveStepLength
double giveDiscreteTime(int n)
Returns time for time step number n (array discreteTimes must be specified)
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
std::unique_ptr< TimeStep > stepWhenIcApply
Solution step when IC (initial conditions) apply.
Definition: engngm.h:229
Function * giveDtFunction()
Returns time function for time step increment.
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
time_t startTime
Solution start time.
Definition: engngm.h:259
int numProcs
Total number of collaborating processes.
Definition: engngm.h:278
double minStepLength
adaptive time step length - minimum
void initTimer(EngngModelTimerType t)
Definition: timer.h:132
double giveTargetTime()
Returns target time.
Definition: timestep.h:146
bool isParallel() const
Returns true if receiver in parallel mode.
Definition: engngm.h:1056
void incrementStateCounter()
Updates solution state counter.
Definition: timestep.h:190
virtual void initializeYourself(TimeStep *tStep)
Provides the opportunity to initialize state variables stored in element integration points according...
virtual TimeStep * giveNextStep()
Returns next time step (next to current step) of receiver.
Definition: engngm.h:701
void stopTimer(EngngModelTimerType t)
Definition: timer.h:129
#define _IFT_StaggeredProblem_timeDefinedByProb
Class representing the abstraction for input data source.
Definition: datareader.h:50
#define _IFT_StaggeredProblem_dtf
REGISTER_EngngModel(ProblemSequence)
#define OOFEM_LOG_DEBUG(...)
Definition: logger.h:128
#define _IFT_StaggeredProblem_prescribedtimes
double stepMultiplier
Constant multiplier, optional input parameter.
#define OOFEM_LOG_RELEVANT(...)
Definition: logger.h:126
double giveDeltaT(int n)
Returns the timestep length for given step number n, initial step is number 0.
#define _IFT_StaggeredProblem_reqiterations
problemMode pMode
Domain mode.
Definition: engngm.h:255
virtual void drawYourself(oofegGraphicContext &gc)
EngngModel * InstanciateProblem(DataReader &dr, problemMode mode, int contextFlag, EngngModel *_master, bool parallelFlag)
Instanciates the new problem.
Definition: util.C:45
#define VERBOSE_PRINTS(str, str1)
Definition: verbose.h:55
bool loadBalancingFlag
If set to true, load balancing is active.
Definition: engngm.h:295
virtual TimeStep * givePreviousStep(bool force=false)
Returns previous time step.
double endOfTimeOfInterest
alternative overriding the number of steps "nsteps" - necessary for time-driven analyses when the app...
virtual void preInitializeNextStep()
Does a pre-initialization of the next time step (implement if necessarry)
Definition: engngm.h:716
IntArray coupledModels
List of slave models to which this model is coupled.
int giveNumber()
Returns receiver&#39;s number.
Definition: timestep.h:129
#define OOFEM_LOG_INFO(...)
Definition: logger.h:127
FILE * giveOutputStream()
Returns file descriptor of output file.
Definition: engngm.C:1791
virtual int giveNumberOfSlaveProblems()
Returns number of slave problems.
IntArray domainPrescribedNeqs
Number of prescribed equations per domain.
Definition: engngm.h:217
double adaptiveStepSince
adaptive time step length applies after prescribed time
virtual void drawNodes(oofegGraphicContext &gc)
Definition: engngm.C:1929
#define OOFEM_ERROR(...)
Definition: error.h:61
virtual void drawElements(oofegGraphicContext &gc)
Definition: engngm.C:1920
void clear()
Clears the array (zero size).
Definition: intarray.h:177
int numberOfSteps
Total number of time steps.
Definition: engngm.h:209
int ndomains
Number of receiver domains.
Definition: engngm.h:205
int rank
Domain rank in a group of collaborating processes (0..groupSize-1).
Definition: engngm.h:276
virtual void updateAttributes(MetaStep *mStep)
Update receiver attributes according to step metaStep attributes.
virtual void balanceLoad(TimeStep *tStep)
Recovers the load balance between processors, if needed.
Definition: engngm.C:2035
virtual void updateYourself(TimeStep *tStep)
Updates internal state after finishing time step.
Definition: engngm.C:612
double reqIterations
adaptive time step length - required (=optimum) number of iterations
virtual int instanciateYourself(DataReader &dr, InputRecord *ir, const char *outFileName, const char *desc)
Initializes whole problem according to its description stored in inputStream.
#define _IFT_EngngModel_suppressOutput
Definition: engngm.h:84
virtual void drawYourself(oofegGraphicContext &gc)
Definition: engngm.C:1908
#define _IFT_StaggeredProblem_prob1
virtual int giveNumberOfFirstStep(bool force=false)
Returns number of first time step used by receiver.
Definition: engngm.h:730
#define _IFT_EngngModel_nsteps
Definition: engngm.h:68
virtual int giveNumberOfFirstStep(bool force=false)
Returns number of first time step used by receiver.
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
#define _IFT_StaggeredProblem_endoftimeofinterest
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description in input reader.
virtual int giveCurrentNumberOfIterations()
Returns number of iterations that was required to reach equilibrium - used for adaptive step length i...
Definition: engngm.h:545
#define _IFT_StaggeredProblem_prob3
#define _IFT_StaggeredProblem_prob2
Function * giveFunction(int n)
Service for accessing particular domain load time function.
Definition: domain.C:268
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode)
Stores the state of model to output stream.
Definition: engngm.C:1527
int giveNumberOfMetaSteps()
Return number of meta steps.
Definition: engngm.h:738
Initializes the variable VERBOSE, in order to get a few intermediate messages on screen: beginning an...
FloatArray discreteTimes
Time lag specifying how much is the second sub-problem delayed after the first one during this period...
IntArray domainNeqs
Number of equations per domain.
Definition: engngm.h:215
std::vector< std::string > inputStreamNames
Abstract base class representing a function with vector input and output.
Definition: function.h:88
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual int instanciateDefaultMetaStep(InputRecord *ir)
Instanciate default metastep, if nmsteps is zero.
Definition: engngm.C:374
virtual TimeStep * giveCurrentStep(bool force=false)
Returns current time step.
virtual int checkProblemConsistency()
Allows programmer to test problem its internal data, before computation begins.
virtual void updateDomainLinks()
Updates domain links after the domains of receiver have changed.
virtual TimeStep * giveNextStep()
Returns next time step (next to current step) of receiver.
int giveStepRelativeNumber(int stepNumber)
Returns the step relative number to receiver.
Definition: metastep.h:107
int giveMetaStepNumber()
Returns receiver&#39;s meta step number.
Definition: timestep.h:135
int giveNumberOfTimeStepWhenIcApply()
Returns the time step number, when initial conditions should apply.
Definition: engngm.h:754
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode)
Stores the state of model to output stream.
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual int instanciateDefaultMetaStep(InputRecord *ir)
Instanciate default metastep, if nmsteps is zero.
virtual int instanciateYourself(DataReader &dr, InputRecord *ir, const char *outFileName, const char *desc)
Initializes whole problem according to its description stored in inputStream.
Definition: engngm.C:201
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
bool renumberFlag
Renumbering flag (renumbers equations after each step, necessary if Dirichlet BCs change)...
Definition: engngm.h:219
virtual TimeStep * givePreviousStep(bool force=false)
Returns previous time step.
Definition: engngm.h:693
bool suppressOutput
Flag for suppressing output to file.
Definition: engngm.h:314
double maxStepLength
adaptive time step length - maximum
#define _IFT_StaggeredProblem_stepmultiplier
#define _IFT_StaggeredProblem_minsteplength
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Prints output of receiver to output domain stream, for given time step.
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
virtual TimeStep * giveCurrentStep(bool force=false)
Returns current time step.
Definition: engngm.h:683
virtual void drawElements(oofegGraphicContext &gc)
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
Class representing the implementation of plain text date reader.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode)
Restores the state of model from output stream.
Definition: engngm.C:1592
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual void setRenumberFlag()
Sets the renumber flag to true.
Domain * giveDomain(int n)
Service for accessing particular problem domain.
Definition: engngm.C:1720
virtual void finish(bool wrn=true)=0
Terminates the current record session and if the flag is true, warning is printed for unscanned token...
virtual void terminate(TimeStep *tStep)
Terminates the solution of time step.
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
virtual void updateYourself(TimeStep *tStep)
Updates internal state after finishing time step.
virtual TimeStep * giveSolutionStepWhenIcApply(bool force=false)
Returns the solution step when Initial Conditions (IC) apply.
ContextOutputMode contextOutputMode
Domain context output mode.
Definition: engngm.h:246
#define _IFT_StaggeredProblem_coupling
std::vector< std::unique_ptr< EngngModel > > emodelList
List of engineering models to solve sequentially.
double getUtime(EngngModelTimerType t)
Returns total user time elapsed.
Definition: timer.C:154
virtual double evaluateAtTime(double t)
Returns the value of the function at given time.
Definition: function.C:76
#define OOFEM_WARNING(...)
Definition: error.h:62
Class representing solution step.
Definition: timestep.h:80
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mod)
Restores the state of model from output stream.
virtual void drawNodes(oofegGraphicContext &gc)
int dtFunction
Associated time function for time step increment.

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:31 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011