PDE Solve Class for PDE's in x and y

Class which is returned in solvePDE_xy calls

pde_xy_solution

__init__(eqn, setup_boundaries, x_bdry, y_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", "ux", "uy", "uxx", "uyy", etc. for including function, i.e. cos(u), use tf.cos(u), or for ln(x), np.log(x). Write equation as would be written in code.

  • setup_boundaries (boundary) –

    boundary conditions set up from return of pde_Boundaries_2var call

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

  • N_pde (int) –

    Number of randomly sampled collocation points along x and y 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 ("uxx", "uyyy", etc). If derivative not definded then input as string in list. Ex, if using "uxy" and "uxyx", then set extra_ders = ["uxy", "uxyx]

  • 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, X: sampled points along x direction, and Y: sampled points along y direction. Then calls PINNtrainSelect_xy 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)

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()

Returns:
  • eqn( string ) –

    input equation

get_N_pde()

Return input N_pde

get_epochs()

Return input epochs

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_bc_loss()

Return model boundary condition loss

get_iv_loss()

Return model initial value loss

get_x_points()

Return sampled x points

get_y_points()

Return sampled y points

get_solution_prediction()

Return model solution prediction

get_model()

Return trained model

get_pde_points()

Return sampled pe 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_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_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_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_losses 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