pde_TrainingICBCP_dirichlet_soft

Functions which trains a model for solving a solvePDE_tx call with dirichlet boundaries and soft 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_tx()

PINNtrain(pde_points, init_points, t_order, setup_boundaries, epochs, eqn, N_pde, N_iv, model, extra_ders)

Main function called by PINNtrainSelect_tx when solving equation in tx with dirichlet boundaries with soft constraint.

Parameters:
  • pde_points (list) –

    pde_points returned from defineCollocationPoints_tx()

  • init_points (list) –

    inits returned from defineCollocationPoints_tx()

  • t_order (int) –

    Order of t in equation

  • setup_boundaries (boundary) –

    boundary conditions set up from return of pde_Boundaries_2var call.

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

  • N_iv (int) –

    Number of randomly sampled collocation points along inital t 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, inits, bcs, model, t_order, eqnparam, extra_ders)

Function which does the training for a single epoch

Parameters:
  • pdes (list) –

    Sampled pde points network uses to train

  • inits (list) –

    Inital value points for learning initial conditon

  • bcs (list) –

    Boundary value points for learning boundary conditions

  • model (PINN) –

    Model to train

  • t_order (int) –

    Order of equation to solve

  • 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, inital values, and boundary values.

Returns:
  • PDEloss( list ) –

    Loss of training network to match function along pdes points

  • IVloss( list ) –

    Loss of training network to match initial values

  • BCloss( list ) –

    Loss of training network to match boundary values

  • grads( array ) –

    Gradients of network for optimization