Refinement Interface#

class RefinementInterface(sample_every, condition_to_update=None)[source]#

Bases: Callback

Interface class of Refinement approaches.

Initializes the RefinementInterface.

Parameters:
  • sample_every (int) – The number of epochs between each refinement.

  • condition_to_update (list(str) | tuple(str) | str) – The conditions to update during the refinement process. If None, all conditions with a domain will be updated. Default is None.

on_train_start(trainer, solver)[source]#

Called when the training begins. It initializes the conditions and dataset.

Parameters:
  • trainer (Trainer) – The trainer object.

  • solver (SolverInterface) – The solver object associated with the trainer.

Raises:
  • RuntimeError – If the solver is not a PINNInterface.

  • RuntimeError – If the conditions do not have a domain to sample from.

on_train_epoch_end(trainer, solver)[source]#

Performs the refinement at the end of each training epoch (if needed).

Parameters:
  • ~lightning.pytorch.trainer.trainer.Trainer – The trainer object.

  • solver (PINNInterface) – The solver object.

abstract sample(current_points, condition_name, solver)[source]#

Samples new points based on the condition.

Parameters:
  • current_points – Current points in the domain.

  • condition_name – Name of the condition to update.

  • solver (PINNInterface) – The solver object.

Returns:

New points sampled based on the R3 strategy.

Return type:

LabelTensor

property dataset#

Returns the dataset for training.

property initial_population_size#

Returns the dataset for training size.