Conserved Minimizers

class pfc_util.NonlocalConservedRK4(field: RealField2D, dt: floating | float64 | float, eps: floating | float64 | float, *, k_regularizer: floating | float64 | float = 0.1, inertia: floating | float64 | float = 100)

Bases: NonlocalConservedRK4Base, MinimizerMixin

RK4 nonlocal conserved dynamics with inertia

The evolution equations are

\[\dot\psi = M \phi\]
\[\dot\phi = - \left(\phi + \frac{\delta F}{\delta \psi}\Big\vert_{k\neq 0}\right)\]
__init__(field: RealField2D, dt: floating | float64 | float, eps: floating | float64 | float, *, k_regularizer: floating | float64 | float = 0.1, inertia: floating | float64 | float = 100)
Parameters:
  • field – the PFC field to be minimized

  • dt – time step

  • eps – PFC epsilon

  • k_regularizer – k-space regulator to suppress high frequency modes from blowing up

  • inertia – coefficient of 1st time derivative

derivative(f: RealField2D) ndarray[Any, dtype[ScalarType]]

Return the derivative of the free energy functional w.r.t. f

start() None

A hook method that is called before evolution When overriden, super().start() should be invoked

property field: T_field

An alias for .subject

property grid: T_grid

An alias for .subject

property info

using .info is deprecated, use .data directly instead

init_pfc_variables(eps: floating | float64 | float)

Setup variables related to PFC

initialize_fft(*, reinit: bool = True, threads: int = 1, planning_timelimit: float | None = None, effort: Literal['FFTW_ESTIMATE', 'FFTW_MEASURE', 'FFTW_PATIENT', 'FFTW_EXHAUSTIVE'] | None = None, wisdom_only: bool = False, destroy_input: bool = False, unaligned: bool = False)

Call .grid.initialize_fft() with the same arguments

psi_dot() Tuple[ndarray[Any, dtype[ScalarType]], ndarray[Any, dtype[ScalarType]]]

Return the first and second derivatives of psi w.r.t. time The derivative should be computed with self.grid_tmp, not self.grid

resolve_hooks(hooks: EvolverHooks | None) EvolverHooks

Each Evolver instance is also an instance of EvolverHooks. By default none of the hook methods are implemented.

run(n_steps: int, hooks: EvolverHooks | None = None)

Run evolution loop. hooks.on_nonstop_step() will be called every [n_steps] steps. The minimization will be run on a separate thread.

run_multisteps(n_steps: int, n_epochs: int, hooks: EvolverHooks | None = None)

Run evolution loop

run_steps(n_steps: int)

Run [n_steps] minimization steps.

step()

Run a single minimization step.

wait()

Wait till the evolution thread ends

data: Dict[str, Any]

Used to store fields used by hooks, will be cleared everytime start() is called. I.e., before every evolution.