pde_TrainingBCP_dirichlet_hard

Functions which trains a model for solving a solvePDE_xy call with dirichlet boundaries and hard constraints implemented in TensorFlow.

While available to user, not meant to be used. Meant to be used through object returned from solvePDE calls, where training file is selected through pde_trainingSelects.PINNtrainSelect_xy()

PINNtrain(pde_points, epochs, eqn, N_pde, model, extra_ders)

Main function called by PINNtrainSelect_xy when solving equation in xy with dirichlet boundaries with hard constraint.

Parameters:
  • pde_points (list) –

    pde_points returned from defineCollocationPoints_xy()

  • epochs (int) –

    Number of epochs model gets trained for

  • eqn (string) –

    Equation to be solved

  • N_pde (int) –

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

  • model (PINN) –

    Model created from pde_ModelFuncs_2var or input model

  • extra_ders (list) –

    Extra derivatives needed to be computed for user equation

Returns:
  • epoch_loss( list ) –

    Total loss over training of model

  • iv_loss( list ) –

    Inital value loss over training of model

  • bc_loss( list ) –

    Boundary condition loss over training of model

  • pde_loss( list ) –

    Differential equation loss over training of model

  • model( PINN ) –

    Trained model to predict equation solution

Packages data correctly and calls trainStep in executing training routine, and handles optimization of the network.

trainStep(pdes, model, eqnparam, extra_ders)

Function which does the training for a single epoch

Parameters:
  • pdes (list) –

    Sampled pde points network uses to train

  • model (PINN) –

    Model to train

  • eqnparam (string) –

    Equation to solve.

  • extra_ders (list) –

    Extra derivatives needed to be computed for user equation

Generates derivatives of model using automatic differentiation. Computes mean squared error of loss along pdes points.

Returns:
  • PDEloss( list ) –

    Loss of training network to match function along pdes points

  • grads( array ) –

    Gradients of network for optimization