OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
time.hpp File Reference

Time state management for simulation time integration. More...

#include <array>
#include <cmath>
#include <iostream>
Include dependency graph for time.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  pfc::Time
 

Detailed Description

Time state management for simulation time integration.

This file defines the Time class, which manages the temporal state of simulations in OpenPFC. The Time class tracks:

  • Start time (t0), end time (t1), and time step (dt)
  • Current simulation time and increment counter
  • Save interval (saveat) for output scheduling

The Time class provides queries for:

  • Current time: get_time()
  • Time step: get_dt()
  • Completion status: is_done()
  • Save scheduling: is_save_step()

Typical usage:

// Define simulation time parameters
pfc::Time time({0.0, 100.0, 0.1}, 1.0); // t0=0, t1=100, dt=0.1, saveat=1.0
// Time integration loop
while (!time.is_done()) {
model.step(time.get_dt());
if (time.is_save_step()) {
write_results(time.get_time());
}
time.increment(); // Advances time by dt
}
Definition time.hpp:233

This file is part of the Simulation Control module, managing temporal aspects of time-dependent simulations.

See also
simulator.hpp for time integration loop
model.hpp for physics model receiving dt
Author
OpenPFC Contributors
Date
2025