PDE Solve Class for PDE's in t and x

Class which is returned in solvePDE_tx calls

pde_tx_solution

Name of class returned

__init__(eqn, setup_initials, setup_boundaries, t_bdry, x_bdry, N_pde, net_layers, net_units, constraint, model, extra_ders, flag)

Constructer for class.

Parameters:
  • eqn (string) –

    Equation to solve in form of string. function and derivatives represented as "u", "ut", "ux", "utt", "uxx", etc. for including function, i.e. cos(u), use tf.cos(u), or for ln(t), np.log(t). Write equation as would be written in code.

  • setup_initials (initial) –

    initial conditions set up from return of pde_Initials.setup_initialconds_2var call. See examples or API for initials for how to use.

  • setup_boundaries (boundary) –

    boundary conditions set up from return of pde_Boundaries_2var call

  • 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.

  • N_pde (int) –

    Number of randomly sampled collocation points along t and x which PINN uses in training.

  • net_layers (int) –

    Number of internal layers of PINN

  • net_units (int) –

    Number of units in each internal layer

  • constraint (string) –

    Determines hard constrainting inital conditions or network learning inital conditions. "soft" or "hard"

  • model (PINN) –

    User may pass in user constructed network, however no guarentee of correct training.

  • extra_ders (list) –

    List of extra derivatives needed to be used. Network only computes single variable derivatives by default ("utt", "uxxx", etc). If derivative not definded then input as string in list. Ex, if using "utx" and "utxt", then set extra_ders = ["utx", "utxt]

  • flag (string) –

    Internal string used to identify what problem is being solved

Constructer also generates, model: model if model==None, pde_points: randomly sampled points for model to train with, init_points: points along t0 for network to train with, T: sampled points along t direction, and X: sampled points along x direction. Then train_model should be call to call PINNtrainSelect_tx function to train, then defines solution prediction from returned model.

Class Functions

Fucntions the user should call to access information from solvePDE call. Training, Getter, and Plotter functions

Training

train_model(epochs, RAR_adaptivity=['Frequency', 'PointsToAdd'])

Main function to train model. Defines solution prediction from model, and generates meshgrid data for plotting

Parameters:
  • epochs (int) –

    Epochs to train model for to epoch train

Getters

get_equation()

Return input equation

get_initial_t()

Return input initial_t function

get_t_bdry()

Return input t_bdry

get_x_bdry()

Return input x_bdry

get_N_pde()

Return input N_pde

get_epochs()

Return input epochs

get_t_order()

Return input t_order

get_flag()

Return internal flag

get_constraint()

Return input constraint

get_epoch_loss()

Return model total epoch loss

get_pde_loss()

Return model pde loss

get_iv_loss()

Return model initial value loss

get_bc_loss()

Return model boundary condition loss

get_t_points()

Return sampled t points

get_x_points()

Return sampled x points

get_solution_prediction()

Return model solution prediction

get_model()

Return trained model

get_pde_points()

Return sampled pde points

Plotters

plot_epoch_loss(filetitle='PDE-Epoch-Loss')

Calls pde_Plotters.plot_epoch_loss with correct data

Parameters:
  • filetitle (string, default: 'PDE-Epoch-Loss' ) –

    Title of saved file

plot_iv_loss(filetitle='PDE-IV-Loss')

Calls pde_Plotters.plot_iv_loss with correct data

Parameters:
  • filetitle (string, default: 'PDE-IV-Loss' ) –

    Title of saved file

plot_bc_loss(filetitle='PDE-BC-Loss')

Calls pde_Plotters.plot_bc_loss with correct data

Parameters:
  • filetitle (string, default: 'PDE-BC-Loss' ) –

    Title of saved file

plot_pde_loss(filetitle='PDE-DE-Loss')

Calls pde_Plotters.plot_pde_loss with correct data

Parameters:
  • filetitle (string, default: 'PDE-DE-Loss' ) –

    Title of saved file

plot_all_losses(filetitle='PDE-All-Losses')

Calls pde_Plotters.plot_all_losse with correct data

Parameters:
  • filetitle (string, default: 'PDE-All-Losses' ) –

    Title of saved file

plot_solution_prediction(filetitle='PDE-solution-pred')

Calls pde_Plotters.plot_solution_prediction with correct data

Parameters:
  • filetitle (string, default: 'PDE-solution-pred' ) –

    Title of saved file

plot_solution_prediction_3D(filetitle='PDE-solution-Pred-3D')

Calls pde_Plotters.plot_3d with correct data

Parameters:
  • filetitle (string, default: 'PDE-solution-Pred-3D' ) –

    Title of saved file

plot_predicted_exact(exact_eqn, filetitle='PDE-SolPred-Exact')

Calls pde_Plotters.plot_predicted_exact with correct data

Parameters:
  • exact_eqn (string) –

    Equation of exact solution which gets compared to model prediciton

  • filetitle (string, default: 'PDE-SolPred-Exact' ) –

    Title of saved file