ElmerFoamFSI  2.0
ElmerFoamFSI is fluid-solid interaction simulation application built up from OpenFOAM CFD and Elmer CSM coupled through the IMPACT multiphysics software integration infrastructure.
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Groups Pages
virtual int Run ( )
inlinevirtual

Reimplemented from couplingbase.

Definition at line 340 of file FsiCouplingPar.H.

References agentbase::FinalizeTimeStep(), fluidsAgent, agentbase::InitializeTimeStep(), openfoamagentpar::Run(), elmeragentpar::Run(), runMode, simulationFinalTime, simulationTime, simulationTimeStep, structuresAgent, TransferDisplacementsToFluid(), and TransferLoadsToStructures().

340  {
341  FunctionEntry("Run");
342  // Enter timestepping
343  int innerCount = 0;
344  int maxSubSteps = 1000;
345  int dumpinterval = 1;
346  int systemStep = 0;
347 
348  // gathering some information for user
349  time_t nowStart = time(0);
350  char* dtChar = ctime(&nowStart);
351  char* hostName;
352  gethostname(hostName, 150);
353 
354  std::stringstream outString;
355  outString << std::endl << std::endl
356  << "************************************************* " << std::endl;
357  outString << "* Starting Stepping in Time * " << std::endl;
358  outString << "************************************************* " << std::endl;
359  outString << "* Starting Simulation at " << dtChar;
360  outString << "* Summary of the simulation: " << std::endl;
361  outString << "* " << std::endl;
362  outString << "* Simulation Type = ElmerFoamFSIPar " << std::endl;
363  outString << "* Simulation start time = " << simulationTime << std::endl;
364  outString << "* Simulation final time = " << simulationFinalTime << std::endl;
365  outString << "* Simulation time step = " << simulationTimeStep << std::endl;
366  outString << "* Number of time steps = " << int(simulationFinalTime/simulationTimeStep) << std::endl;
367  outString << "* " <<std::endl;
368  outString << "* Hostname = " << hostName << std::endl;
369  outString << "* Number of processors = " << NProc() << std::endl;
370  outString << "************************************************* " << std::endl;
371  outString << std::endl;
372  StdOut(outString.str(),0,true);
373  outString.clear();
374  outString.str("");
376 
377  // Write some stuff to screen
378  outString << "System timestep " << ++systemStep
379  << " @ Time = " << simulationTime << std::endl;
380  StdOut(outString.str(),1,true);
381  outString.clear();
382  outString.str("");
383 
384 
385  if(!runMode){
386  // Transfer displacements @ Tn to fluids
387  outString << "Transferring displacements from structures to fluids @ time("
388  << simulationTime << ")" << std::endl;
389  StdOut(outString.str(),1,true);
390  outString.clear();
391  outString.str("");
393  }
394 
395  if(runMode < 2){
397  // Step fluids to get loads @ T(n+1)
398  outString << "Stepping fluids to time("
399  << simulationTime+simulationTimeStep << ")" << std::endl;
400  StdOut(outString.str(),1,true);
401  outString.clear();
402  outString.str("");
404  }
405 
406  if(!runMode){
407  outString << "Transferring loads from fluids to structures @ time("
408  << simulationTime << ")" << std::endl;
409  StdOut(outString.str(),1,true);
410  // Transfer loads @ T(n+1) to structures
411  //std::cout << "FSICoupling: Transferring loads from fluids to structures @ time("
412  // << simulationTime+simulationTimeStep << ")" << std::endl;
414  }
415 
416  if(!(runMode==1)){
418  // Step structures to get displacements @ T(n+1)
419  outString << "Stepping structures to time("
420  << simulationTime+simulationTimeStep << ")" << std::endl;
421  StdOut(outString.str(),1,true);
422  outString.clear();
423  outString.str("");
425  }
426 
427  // Finalize timestep and advance time T(n) --> T(n+1)
428  bool converged = true;
429  if(converged){
431  outString << "Converged at time("
432  << simulationTime << ")" << std::endl;
433  StdOut(outString.str(),1,true);
434  outString.clear();
435  outString.str("");
436  if(runMode < 2)
438  if(!(runMode == 1))
440  innerCount = 0;
441  } else {
442  innerCount++;
443  if(innerCount > maxSubSteps){
444  outString << "Failed to converge after "
445  << maxSubSteps << ", giving up." << std::endl;
446  StdOut(outString.str(),0,true);
447  outString.clear();
448  outString.str("");
449  return(1);
450  }
451  }
452 
453  StdOut(outString.str(),0,true);
454  outString.clear();
455  outString.str("");
456 
457  if(!(systemStep%dumpinterval)){
458  //DumpSolution();
459  }
460 
461  }
462  Communicator().Barrier();
463 
464  // gathering some information for user
465  time_t nowEnd = time(0);
466  dtChar = ctime(&nowEnd);
467  outString << std::endl << std::endl
468  << "************************************************* " << std::endl;
469  outString << "* Finishing Stepping in Time * " << std::endl;
470  outString << "************************************************* " << std::endl;
471  outString << "* Ending simulation at " << dtChar;
472  outString << "* Total simulation time (s) = " << nowEnd - nowStart << std::endl;
473  outString << "* Summary of the simulation: " << std::endl;
474  outString << "* " << std::endl;
475  outString << "* Simulation Type = ElmerFoamFSIPar " << std::endl;
476  outString << "* Simulation final time = " << simulationFinalTime << std::endl;
477  outString << "* Simulation time step = " << simulationTimeStep << std::endl;
478  outString << "* Number of time steps = " << int(simulationFinalTime/simulationTimeStep) << std::endl;
479  outString << "* " <<std::endl;
480  outString << "* Hostname = " << hostName << std::endl;
481  outString << "* Number of processors = " << NProc() << std::endl;
482  outString << "************************************************* " << std::endl;
483  outString << std::endl;
484  StdOut(outString.str(),0,true);
485 
486  FunctionExit("Run");
487 
488  return(0);
489  };
double simulationTimeStep
solidagentpar * structuresAgent
int TransferDisplacementsToFluid(solidagentpar *solidAgent, fluidagentpar *fluidAgent)
virtual int FinalizeTimeStep(double time)
Definition: Orchestrator.H:25
int TransferLoadsToStructures(fluidagentpar *fluidAgent, solidagentpar *solidAgent)
double simulationTime
virtual int Run(double endTime)
virtual int InitializeTimeStep(double time)
Definition: Orchestrator.H:24
virtual int Run(double time)
Definition: ElmerParAgent.H:79
fluidagentpar * fluidsAgent
double simulationFinalTime

Here is the call graph for this function: