Propagator base class#
Propagator base class.
- class struphy.propagators.base.Propagator[source]#
Bases:
objectBase class for propagators used in StruphyModels.
Note
All Struphy propagators are subclasses of
Propagatorand must be added understruphy/propagators/.- class Variables[source]#
Bases:
objectDefine variable names and types to be updated by the propagator.
- property var1#
- class Options(opt1: Literal['implicit', 'explicit'] = 'implicit')[source]#
Bases:
OptionsBaseTemplate for configuration options of a propagator.
Subclasses should override this to define specific propagator options.
- OptsTemplate#
alias of
Literal[‘implicit’, ‘explicit’]
- opt1: Literal['implicit', 'explicit'] = 'implicit'#
- prepare_time_step(dt: float)[source]#
Set up the data that depends on the time step (e.g. preconditioners) for
dt, before the first call withdt, so that it is part of the setup rather than of the first time step (seerun()). Optional; does nothing by default.- Parameters:
dt (float) – Time step size of the first call.
- update_feec_variables(**new_coeffs)[source]#
Return max_diff = max(abs(new - old)) for each new_coeffs, update feec coefficients and update ghost regions.
- Returns:
diffs – max_diff for all feec variables.
- Return type:
dict
- kernels() tuple[Kernel, ...][source]#
The
Kernelobjects this propagator calls in a time step.Used by
compile_cuda_kernels()to compile the CUDA kernels before the time stepping. The default collects them from the attributes of the propagator (afterallocate()): kernels kept as attributes, and the kernels of attributes with akernels()method (Pusher,KernelSetup,Accumulator,AccumulatorVector), also inside lists, tuples and dicts. A propagator that calls a kernel it does not keep (e.g. a module-level kernel called directly in__call__()) overrides this method and adds it.
- property init_kernels: tuple[KernelSetup, ...]#
Tuple of initialization kernel setups for evaluation at \(\boldsymbol \eta^n\) in an iterative
Pusher.
- property eval_kernels: tuple[KernelSetup, ...]#
Tuple of evaluation kernel setups for evaluation at \(\alpha_i \eta_{i}^{n+1,k} + (1 - \alpha_i) \eta_{i}^n\) for \(i=1, 2, 3\) and different \(\alpha_i \in [0,1]\), in an iterative
Pusher.
- property rank#
MPI rank, is 0 if no communicator.
- property domain: Domain#
Domain object that characterizes the mapping from the logical to the physical domain.
- property mass_ops: WeightedMassOperators#
Weighted mass operators.
- property basis_ops: BasisProjectionOperators#
Basis projection operators.
- property projected_equil: ProjectedFluidEquilibriumWithB#
Fluid equilibrium projected on 3d Derham sequence with commuting projectors.
- property time_state#
A pointer to the time variable of the dynamics (‘t’).
- add_time_state(time_state)[source]#
Add a pointer to the time variable of the dynamics (‘t’).
- Parameters:
time_state (ndarray) – Of size 1, holds the current physical time ‘t’.
- add_init_kernel(setup: KernelSetup)[source]#
Register an evaluation at the start of each push.
The setup names the callable, its arguments, and the exact output marker columns. Its evaluation weights must all be zero.
- add_eval_kernel(setup: KernelSetup)[source]#
Register an evaluation before each pusher stage/iteration.
The setup’s alpha weights determine both the evaluation state and the preceding MPI sort.