![]() |
OpenPFC
0.1.4
Phase Field Crystal simulation framework
|
The Model class represents the physics model for simulations in OpenPFC. More...
#include <model.hpp>

Public Member Functions | |
| ~Model () | |
| Destroy the Model object. | |
| Model (FFT &fft, const World &world) | |
| Model (const Model &)=delete | |
| Disable copy constructor. | |
| Model & | operator= (const Model &)=delete |
| Disable copy assignment operator. | |
| bool | is_rank0 () const noexcept |
| Check if current MPI rank is 0. | |
| const World & | get_world () const noexcept |
| Get the decomposition object associated with the model. | |
| FFT & | get_fft () noexcept |
| virtual void | step (double t)=0 |
| virtual void | initialize (double dt)=0 |
| virtual size_t | get_allocated_memory_bytes () const |
| bool | has_real_field (std::string_view field_name) const noexcept |
| Check if the model has a real-valued field with the given name. | |
| void | add_real_field (std::string_view name, RealField &field) |
| bool | has_complex_field (std::string_view field_name) const noexcept |
| void | add_complex_field (std::string_view name, ComplexField &field) |
| RealField & | get_real_field (std::string_view name) |
| const RealField & | get_real_field (std::string_view name) const |
| Retrieve a registered real-valued field by name (const version) | |
| ComplexField & | get_complex_field (std::string_view name) |
| const ComplexField & | get_complex_field (std::string_view name) const |
| Retrieve a registered complex-valued field by name (const version) | |
| void | add_field (const std::string &name, RealField &field) |
| Add a field to the model. | |
| void | add_field (const std::string &name, ComplexField &field) |
| Add a field to the model. | |
| bool | has_field (std::string_view field_name) const noexcept |
| virtual Field & | get_field () |
| Get a reference to the default primary unknown field. | |
The Model class represents the physics model for simulations in OpenPFC.
The Model class is responsible for introducing the physics to the simulation model. Users can override the initialize and step functions to define their own functionality and implement specific physics for their simulations.
The initialize function is called at the beginning of the simulation and is used to allocate arrays, pre-calculate operators used in time integration, and perform other necessary initialization tasks.
The step function is called sequentially during the time integration process. OpenPFC currently uses a semi-implicit time integration scheme, where the linear part is solved implicitly and the non-linear part is solved explicitly.
Add a field to the model.
| name | Name of the field |
| field | Reference to the ComplexField object representing the field |
Add a field to the model.
| name | Name of the field |
| field | Reference to the RealField object representing the field |
|
inline |
Retrieve a registered complex-valued field by name (const version)
Returns a const reference to a previously registered complex field for reading.
| name | Name of the field to retrieve |
| std::out_of_range | if field name not registered |
|
inlinevirtual |
Get a reference to the default primary unknown field.
This is deprecated function and will likely be removed in future.


|
inline |
Retrieve a registered real-valued field by name (const version)
Returns a const reference to a previously registered field for reading.
| name | Name of the field to retrieve |
| std::out_of_range | if field name not registered |
Get the decomposition object associated with the model.
Get the world object associated with the model.

|
inlinenoexcept |
Check if the model has a real-valued field with the given name.
| field_name | Name of the field to check |

|
inlinenoexcept |
Check if current MPI rank is 0.
Useful for conditional output (only rank 0 prints).
