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

Physics model abstraction for phase-field simulations. More...

#include "core/decomposition.hpp"
#include "core/world.hpp"
#include "fft.hpp"
#include "mpi.hpp"
#include "openpfc/backends/heffte_adapter.hpp"
#include "types.hpp"
#include <algorithm>
#include <iostream>
#include <memory>
#include <numeric>
#include <string_view>
#include <vector>
Include dependency graph for model.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  pfc::Model
 The Model class represents the physics model for simulations in OpenPFC. More...
 

Detailed Description

Physics model abstraction for phase-field simulations.

This file defines the Model class, which represents the physics model in OpenPFC phase-field simulations. The Model class serves as the base class for implementing specific physics models such as:

  • Phase Field Crystal (PFC) models
  • Cahn-Hilliard equation
  • Allen-Cahn equation
  • Coupled multi-field models (temperature, concentration, etc.)

The Model class manages:

  • Registration and storage of real and complex fields
  • Access to FFT operations for spectral methods
  • Virtual interface for physics-specific initialization and time stepping

Users implement custom models by:

  1. Deriving from Model
  2. Overriding initialize() to set up initial conditions and operators
  3. Overriding step(dt) to define time evolution equations
  4. Registering fields via register_real_field() and register_complex_field()

Example:

class MyPhysicsModel : public pfc::Model {
public:
MyPhysicsModel(pfc::FFT& fft, const pfc::World& world)
: Model(fft, world) {}
void initialize() override {
// Register fields
register_real_field("density");
register_complex_field("density_fourier");
// Set initial conditions
// Precompute operators
}
void step(double dt) override {
// Implement time evolution equations
// Use FFT for spectral derivatives
}
};
The Model class represents the physics model for simulations in OpenPFC.
Definition model.hpp:95
FFT class for distributed-memory parallel Fourier transforms.
Definition fft.hpp:248
Represents the global simulation domain (the "world").
Definition world.hpp:91

This file is part of the Physics Models module, providing the core abstraction for describing material behavior and evolution equations.

See also
simulator.hpp for how models are executed in time integration
fft.hpp for spectral operations interface
core/world.hpp for computational domain
field_modifier.hpp for initial/boundary conditions