MCPcopy Create free account
hub / github.com/SeisSol/SeisSol / simulate

Method simulate

src/Solver/Simulator.cpp:79–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77
78
79void seissol::Simulator::simulate(seissol::SeisSol& seissolInstance) {
80 SCOREP_USER_REGION( "simulate", SCOREP_USER_REGION_TYPE_FUNCTION )
81
82 auto* faultOutputManager = seissolInstance.timeManager().getFaultOutputManager();
83 faultOutputManager->writePickpointOutput(0.0, 0.0);
84
85 Stopwatch simulationStopwatch;
86 simulationStopwatch.start();
87
88 Stopwatch computeStopwatch;
89 Stopwatch ioStopwatch;
90
91 ioStopwatch.start();
92
93 // Set start time (required for checkpointing)
94 seissolInstance.timeManager().setInitialTimes(m_currentTime);
95
96 double timeTolerance = seissolInstance.timeManager().getTimeTolerance();
97
98 // Write initial wave field snapshot
99 if (m_currentTime == 0.0) {
100 Modules::callHook<ModuleHook::SimulationStart>();
101 }
102
103 // intialize wave field and checkpoint time
104 Modules::setSimulationStartTime(m_currentTime);
105
106 // derive next synchronization time
107 double upcomingTime = m_finalTime;
108 // NOTE: This will not call the module specific implementation of the synchronization hook
109 // since the current time is the simulation start time. We only use this function here to
110 // get correct upcoming time. To be on the safe side, we use zero time tolerance.
111 upcomingTime = std::min( upcomingTime, Modules::callSyncHook(m_currentTime, 0.0) );
112
113 double lastSplit = 0;
114
115 ioStopwatch.pause();
116
117 Stopwatch::print("Time spent for initial IO:", ioStopwatch.split(), seissol::MPI::mpi.comm());
118
119 while( m_finalTime > m_currentTime + timeTolerance ) {
120 if (upcomingTime < m_currentTime + timeTolerance) {
121 logError() << "Simulator did not advance in time from" << m_currentTime << "to" << upcomingTime;
122 }
123 if (m_abort) {
124 logInfo(seissol::MPI::mpi.rank()) << "Aborting simulation.";
125 break;
126 }
127
128 // update the DOFs
129 computeStopwatch.start();
130 seissolInstance.timeManager().advanceInTime( upcomingTime );
131 computeStopwatch.pause();
132
133 ioStopwatch.start();
134
135 // update current time
136 m_currentTime = upcomingTime;

Callers 1

seissolMainMethod · 0.80

Calls 15

printFunction · 0.85
writePickpointOutputMethod · 0.80
setInitialTimesMethod · 0.80
getTimeToleranceMethod · 0.80
pauseMethod · 0.80
splitMethod · 0.80
commMethod · 0.80
rankMethod · 0.80
advanceInTimeMethod · 0.80
printTimeMethod · 0.80

Tested by

no test coverage detected