pde_DeepONetModelFuncs_2var

Functions for creating PINN's in PDE DeepONet solvers of tx and xy.

While available to user, not meant to be used. Instead interface through net_layers, net_units, and constraint parameters of solving functions detailed in "Main User Functions".

We have described commonly used layer classes and functions used throughout many models, models for specific solvePDE_DeepONet_tx equations, and models for specifc solvePDE_DeepONet_xy equations.

Commonly used layer classes and functions

PeriodicBCs

Bases: Layer

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

Normalize

Bases: Layer

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

Models for solving solvePDE_tx equations

mlp_network(inp, n_layers, n_units)

Function which creates simple mlp to be used as basis of trunk and branch nets in DeepONets

Parameters:
  • inp (tensor) –

    Input layer data to mlp

  • n_layers (int) –

    Number of network internal layers

  • n_units (int) –

    Number of units per internal network layer

Returns:
  • out( tensor ) –

    Output data from output layer of network

Models for solving solvePDE_DeepONet_tx equations

select_DeepONet_tx(t_bdry, x_bdry, t_order, initial_t, net_layers, net_units, constraint, setup_boundaries, N_iv)

Main function called by solve class to select which model is needed in training, and calls that build_model function.

Parameters:
  • t_bdry (list) –

    List of two elements, the interval of t to be solved on.

  • x_bdry (list) –

    List of two elements, the interval of x to be solved on.

  • t_order (int) –

    Order of t in equation (highest derivative of t used).

  • initial_t (lambda) –

    Inital function for t=t0, as a python lambda funciton, with t0 being inital t in t_bdry.

  • net_layers (int) –

    Number of internal layers of PINN.

  • net_units (int) –

    Number of units in each internal layer.

  • constraint (string) –

    Determines hard or soft constraints.

  • setup_boundaries (boundary) –

    boundary conditions set up from return of pde_Boundaries_2var call.

  • N_iv (int) –

    Number of randomly sampled collocation points along initial t.

Returns:
  • model( DeepONet ) –

    Model generated by build_DeepONet function called in this function.

build_DeepONet_standard(n_layers, n_units, N, t_bdry, x_bdry)

Model used by both tx and xy equations, standard DeepONet with 2 variables, no periodic layers and no hard constrainting.

Used in solving:

  • solvePDE_DeepONet_tx with dirichlet boundaries and soft constraints
  • solvePDE_DeepONet_tx with neumann boundaries and soft constraints
  • solvePDE_DeepONet_xy with dirichlet boundaries and soft constraints
  • solvePDE_DeepONet_xy with neumann boundaries and soft constraints
Parameters:
  • n_layers (int) –

    Number of network internal layers

  • n_units (int) –

    Number of units per internal network layer

  • N (int) –

    N_iv or N_bc, Number of randomly sampled collocation points along initial t or number of randomly sampled collocation points along boundaries.

  • t_bdry (list) –

    Used as t or x boundary

  • x_bdry (list) –

    Used as x or y boundary

Returns:
  • model( DeepONet ) –

    Constructed model

build_DeepONet_periodic_tx(n_layers, n_units, N_iv, t_bdry, x_bdry)

Used in solving:

  • solvePDE_DeepONet_tx with periodic boundaries and soft constraints
Parameters:
  • n_layers (int) –

    Number of network internal layers

  • n_units (int) –

    Number of units per internal network layer

  • N_iv (int) –

    Number of randomly sampled collocation points along initial t

  • t_bdry (list) –

    Boundary to train t on

Returns:
  • model( DeepONet ) –

    Constructed model

build_DeepONet_periodic_tx_hard1(n_layers, n_units, N_iv, t_bdry, x_bdry, u0)

Used in solving:

  • solvePDE_DeepONet_tx with periodic boundaries, hard constraints of a single order equation (i.e, a single initial condtion)
Parameters:
  • n_layers (int) –

    Number of network internal layers

  • n_units (int) –

    Number of units per internal network layer

  • N_iv (int) –

    Number of randomly sampled collocation points along initial t

  • t_bdry (list) –

    Boundary to train t on

  • u0 (lambda) –

    Function for initial condition u(t0, x)

Returns:
  • model( DeepONet ) –

    Constructed model

build_DeepONet_periodic_tx_hard2(n_layers, n_units, N_iv, t_bdry, x_bdry, u0, ut0)

Used in solving:

  • solvePDE_DeepONet_tx with periodic boundaries, hard constraints of a second order equation (i.e, two initial condtions)
Parameters:
  • n_layers (int) –

    Number of network internal layers

  • n_units (int) –

    Number of units per internal network layer

  • N_iv (int) –

    Number of randomly sampled collocation points along initial t

  • t_bdry (list) –

    Boundary to train t on

  • u0 (lambda) –

    Function for initial condition, u(t0, x)

  • ut0 (lambda) –

    Function for initial condition of derivative, ut(t0, x)

Returns:
  • model( DeepONet ) –

    Constructed model

build_DeepONet_periodic_tx_hard3(n_layers, n_units, N_iv, t_bdry, x_bdry, u0, ut0, utt0)

Used in solving:

  • solvePDE_DeepONet_tx with periodic boundaries, hard constraints of a third order equation (i.e, three initial condtions)
Parameters:
  • n_layers (int) –

    Number of network internal layers

  • n_units (int) –

    Number of units per internal network layer

  • N_iv (int) –

    Number of randomly sampled collocation points along initial t

  • t_bdry (list) –

    Boundary to train t on

  • u0 (lambda) –

    Function for initial condition, u(t0, x)

  • ut0 (lambda) –

    Function for initial condition of derivative, ut(t0, x)

  • utt0 (lambda) –

    Function for initial condition of second derivative, utt(t0, x)

Returns:
  • model( DeepONet ) –

    Constructed model

Models for solving solvePDE_DeepONet_xy equations

select_DeepONet_xy(x_bdry, y_bdry, net_layers, net_units, constraint, setup_boundaries, N_bc)

Main function called by solve class to select which model is needed in training, and calls that build_model function.

Parameters:
  • x_bdry (list) –

    List of two elements, the interval of x to be solved on.

  • y_bdry (list) –

    List of two elements, the interval of y to be solved on.

  • net_layers (int) –

    Number of internal layers of PINN.

  • net_units (int) –

    Number of units in each internal layer.

  • constraint (string) –

    Determines hard or soft constraints.

  • setup_boundaries (boundary) –

    boundary conditions set up from return of pde_Boundaries_2var call.

  • N_bc (int) –

    Number of randomly sampled collocation points along boundaries.

Returns:
  • model( DeepONet ) –

    Model generated by build_model function called in this function.

build_DeepONet_standard(n_layers, n_units, N, t_bdry, x_bdry)

Model used by both tx and xy equations, standard DeepONet with 2 variables, no periodic layers and no hard constrainting.

Used in solving:

  • solvePDE_DeepONet_tx with dirichlet boundaries and soft constraints
  • solvePDE_DeepONet_tx with neumann boundaries and soft constraints
  • solvePDE_DeepONet_xy with dirichlet boundaries and soft constraints
  • solvePDE_DeepONet_xy with neumann boundaries and soft constraints
Parameters:
  • n_layers (int) –

    Number of network internal layers

  • n_units (int) –

    Number of units per internal network layer

  • N (int) –

    N_iv or N_bc, Number of randomly sampled collocation points along initial t or number of randomly sampled collocation points along boundaries.

  • t_bdry (list) –

    Used as t or x boundary

  • x_bdry (list) –

    Used as x or y boundary

Returns:
  • model( DeepONet ) –

    Constructed model

build_DeepONet_periodic_xy(n_layers, n_units, N_bc, x_bdry, y_bdry)

Used in solving:

  • solvePDE_DeepONet_xy with periodic boundaries and soft constraints
  • solvePDE_DeepONet_xy with periodic boundaries and hard constraints
Parameters:
  • n_layers (int) –

    Number of network internal layers

  • n_units (int) –

    Number of units per internal network layer

  • N_bc (int) –

    Number of randomly sampled collocation points along boundaries.

Returns:
  • model( DeepONet ) –

    Constructed model

If using periodic boundaries in a time independent equation, all boundaries are periodic and therefore there is nothing to be soft/hard constrainted, as periodic implemented on a network layer level.

build_DeepONet_dirichlet_hardconstraint_xy(n_layers, n_units, N_bc, x_bdry, y_bdry, xleft_bound, xright_bound, ylower_bound, yupper_bound)

Used in solving:

  • solvePDE_DeepONet_xy with dirichlet boundaries and hard constraints
Parameters:
  • n_layers (int) –

    Number of network internal layers

  • n_units (int) –

    Number of units per internal network layer

  • N_bc (int) –

    Number of randomly sampled collocation points along boundaries

  • x_bdry (list) –

    boundary to train x on

  • y_bdry (list) –

    boundary to train y on

  • xleft_bound (lambda) –

    Function which describes x left boundary condition, lambda of 2 variables

  • xright_bound (lambda) –

    Function which describes x right boundary condition, lambda of 2 variables

  • ylower_bound (lambda) –

    Function which describes y lower boundary condition, lambda of 2 variables

  • yupper_bound (lambda) –

    Function which describes y upper boundary condition, lambda of 2 variables

Returns:
  • model( DeepONet ) –

    Constructed model