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

Simulation orchestration and time integration loop. More...

#include "core/world.hpp"
#include "field_modifier.hpp"
#include "model.hpp"
#include "results_writer.hpp"
#include "time.hpp"
#include <iostream>
#include <memory>
#include <unordered_map>
Include dependency graph for simulator.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  pfc::Simulator
 The Simulator class is responsible for running the simulation of the model. More...
 

Functions

void pfc::step (class Simulator &s, Model &m)
 

Detailed Description

Simulation orchestration and time integration loop.

This file defines the Simulator class, which orchestrates the execution of phase-field simulations in OpenPFC. The Simulator manages:

  • Time integration loop (calling Model::step repeatedly)
  • Initial condition application via FieldModifiers
  • Boundary condition enforcement
  • Results output scheduling via ResultsWriters
  • Simulation checkpointing and restart

The Simulator acts as the "main loop" that coordinates all simulation components:

// Typical simulation setup
MyPhysicsModel model(fft, world);
pfc::Time time({0.0, 100.0, 0.1}, 1.0); // t0, t1, dt, saveat
pfc::Simulator sim(model, time);
// Add initial conditions
sim.add_initial_condition(std::make_unique<pfc::Constant>(0.5));
// Add results writer
sim.add_results_writer("output", std::make_unique<pfc::BinaryWriter>("data.bin"));
// Run simulation
sim.run();
The Simulator class is responsible for running the simulation of the model.
Definition simulator.hpp:63
Definition time.hpp:233

This file is part of the Simulation Control module, providing the main execution framework for time-dependent simulations.

See also
model.hpp for physics model implementation
time.hpp for time state management
field_modifier.hpp for initial/boundary conditions
results_writer.hpp for output handling