pinn

Class which implements a pinn architecture

pinn

Class implementing a pinn architecture

__init__(data, eqns, layers=4, units=60, inner_act='tanh', out_act='linear', constraint='soft')

Constructor for class.

Parameters:
  • data (data) –

    Data to solve on pinn.

  • eqns (list) –

    List of eqns to solve as strings. Spatial dimensions x1, x2, etc. Time dimension t. If a single equation, use u, if multiple, u1, u2, etc. See tutorials how to do specific examples.

  • layers (int, default: 4 ) –

    Number of internal layers for pinn.

  • units (int, default: 60 ) –

    Number of units for internal layers for pinn.

  • inner_act (string, default: 'tanh' ) –

    Activation function for internal layers of pinn. Must be TensorFlow useable activation function.

  • out_act (string, default: 'linear' ) –

    Activation function for internal layers of pinn. Must be TensorFlow useable activation function.

  • constraint (string, default: 'soft' ) –

    Soft or hard constraint for network. Note only soft currently work, for hard, use legacy models.

get_network()

Returns:
  • model

    TensorFlow model.

get_epoch_loss()

Returns:
  • tensor

    Epoch loss after training.

get_domain()

Returns:
  • domain

    Domain pinn is trained on.

get_data()

Returns:
  • data

    Data the pinn uses to train.

get_epochs()

Returns:
  • int

    Epochs pinn was trained for.

get_boundaries()

Returns:
  • boundaries

    Boundaries pinn was trained on.

get_eqns()

Returns:
  • list

    Equations pinn was trained for.

train(epochs, opt='adam', meta='false', adapt_pt=None)

Main training function

Parameters:
  • epochs (int) –

    Epochs to train for.

  • opt (string, default: 'adam' ) –

    Optimizer to use.

  • meta (string, default: 'false' ) –

    Whether to meta-learned optimize. Not implemented.

  • adapt_pt (adaptive, default: None ) –

    Adaptive point sampling strategy to use.

trainNoTime(eqns, epochs, opt, meta, adapt_pt)

Main setup for training and training loop which calls trainStep. This is used for a purely spatial problem

Parameters:
  • eqns (list) –

    List of eqns to solve as strings.

  • epochs (int) –

    Epochs to train for.

  • opt (string) –

    Optimizer to use.

  • meta (string) –

    Whether to meta-learned optimize. Not implemented.

  • adapt_pt (adaptive) –

    Adaptive point sampling strategy to use.

trainTime(eqns, epochs, opt, meta, adapt_pt)

Main setup for training and training loop which calls trainStep. This is used for a spatio-temporal problem

Parameters:
  • eqns (list) –

    List of eqns to solve as strings.

  • epochs (int) –

    Epochs to train for.

  • opt (string) –

    Optimizer to use.

  • meta (string) –

    Whether to meta-learned optimize. Not implemented.

  • adapt_pt (adaptive) –

    Adaptive point sampling strategy to use.

Normalize

Bases: Layer

Class which describes a normalize layer for pinn. Returns input data normalized to interval [-1, 1].

Periodic

Bases: Layer

Class which describes a Periodic layer for pinn. Used in periodic models.