Docsity

Physics and Neural Network, Summaries of Artificial Intelligence

Partial preview of the text

Download Physics and Neural Network and more Summaries Artificial Intelligence in PDF only on Docsity!

Session 1 ยท Teaching Physics to a Neural Network: Physics-Informed Neural

Networks

Centrum IntelliPhysics

Three sessions, one storyline Session 1 (today) Session 2 Session 3 Live application How deep does a burn go? Any load on a cantilever beam Hidden physics ยท inverse ยท FE + NO

Centrum IntelliPhysics

Todayโ€™s problem: how deep does a burn go? POLL (chat + handout) 5 s contact at 70 ยฐC. How deep is the burn? (a) 0.01 mm (b) 0.1 mm (c) 0.4 mm (d) 2 mm Why this problem?

  • everyone has felt it
  • a 1D PDE with an exact solution โ†’ we can measure our error honestly
  • the output is a clinical decision , not a contour plot

Our deliverable today: a PINN that predicts T(x,t) inside the skin โ†’ burn depth for any contact time

Centrum IntelliPhysics

Why depth is the number that matters The decision

  • heals on its own vs. needs a skin graft
  • decided by depth , at the scale of 0.1โ€“2 mm Our target
  • T(x, t) inside the tissue
  • โ†’ damage integral ฮฉ(x)
  • โ†’ burn depth for any contact time

The boundary between โ€œhealsโ€ and โ€œgraftโ€ is a depth โ€” fractions of a millimetre.

Why AI/ML for computational

mechanics?

The simulation bottleneck ยท where classical surrogates fall short ยท the physics-informed idea

Centrum IntelliPhysics

The simulation bottleneck Image taken from https://www.ansys.com/products/structures#tab1- 5

Centrum IntelliPhysics

Numerical solvers vs. machine-learning solvers Numerical Solvers Machine Learning Solvers Hybrid SciML: Best of both worlds Error guarantees Few parameters (e.g. RK) Large inductive bias No data Slow Generalization? Fast Lots of parameters (e.g. deep NN) Little inductive bias Lots of data No error guarantees Generalization?

Centrum IntelliPhysics

Where classical surrogates fall short โ€” our burn problem Classical data-driven surrogates

  • tied to the sensor / grid locations seen in training
  • poor extrapolation beyond the data
  • no handle on inverse problems (hidden parameters) Same network, same 63 measurements + physics - PDE residual = free labels everywhere - boundary & initial conditions enforced - error 15 % โ†’ 2.8 %

Three thermocouples (โ–ฒ, 63 noisy readings). Physics fills in what the sensors cannot see โ€” the skin surface, where the

burn is.

Neural-network refresher โ€”

only what PINNs need

Networks as function approximators ยท activations and smoothness ยท automatic differentiation

Centrum IntelliPhysics

A neural network is just a smooth function you can tune

xฬ‚

tฬ‚

ฮธ input hidden layers (tanh) output zoom on one neuron (orange) w w w ฮฃ + b tanh โ„Ž = tanh(เท ๐‘– ๐‘ค๐‘– โ„Ž๐‘– + ๐‘๐‘–)

  • the network is the candidate solution ฮธ(xฬ‚, tฬ‚)
  • universal approximation: it can represent it - not a promise that training will find it Cybenko, Math. Control Signals Syst. 1989 ยท Hornik, Neural Netw. 1991 ยท Kingma & Ba, ICLR 2015

Centrum IntelliPhysics

Three ways to get derivatives Method Accuracy Cost / caveat Finite differences O(h) or O(hยฒ) + round-off pick h; poor for 2nd derivatives Symbolic exact expression swell with depth Automatic (AD) exact to machine precision โ‰ˆ 2โ€“ 4 ร— a forward pass (reverse mode)

  • AD records every elementary operation in the forward pass, then applies the chain rule backwards
  • the same machinery gives โˆ‚ฮธ/โˆ‚xฬ‚ (for the PDE) and โˆ‚โ„’/โˆ‚w (for training)

AD is not finite differences and not symbolic algebra: it is the chain rule applied by the computer,

exactly.

LIVE DEMO D1 ยท cell 2 Baydin et al., J. Mach. Learn. Res. 18 ( 2018 ) 1 โ€” Automatic differentiation in machine learning: a survey

Centrum IntelliPhysics

Automatic differentiation by hand โ€” one neuron x z = wโ‚x + bโ‚^ a = tanh z^ u = wโ‚‚ a reverse pass: multiply local derivatives along the path ๐‘‘๐‘ข ๐‘‘๐‘ฅ = ๐‘ค 2 ๐‘‘๐‘ข/๐‘‘๐‘Ž 1 โˆ’ tanh 2 ๐‘ง ๐‘‘๐‘Ž/๐‘‘๐‘ง ๐‘ค 1 ๐‘‘๐‘ง/๐‘‘๐‘ฅ ACTIVITY (2 min, handout) Differentiate once more: dยฒu/dxยฒ =? Type it in the chat. why it matters: d u/dx is again a graph of simple ops โ†’ differentiate again (= create_graph=True) PyTorch x.requires_grad_(True) u = model(x) u_x = torch.autograd.grad( u, x, torch.ones_like(u), create_graph=True)[0] u_xx = torch.autograd.grad( u_x, x, torch.ones_like(u_x), create_graph=True)[0]

Three gotchas: inputs need requires_grad ยท pass grad_outputs = ones_like(u) ยท create_graph=True to differentiate again

and train.

Centrum IntelliPhysics

Step 1 ยท From skin to a model ๐œ•๐‘‡ ๐œ•๐‘ก = ๐›ผ ๐œ•

๐‘‡ ๐œ•๐‘ฅ

, 0 < ๐‘ฅ < ๐ฟ, 0 < ๐‘ก โ‰ค ๐‘ก๐‘’๐‘›๐‘‘ T( 0 ,t) = 70 ยฐC ยท T(L,t) = 37 ยฐC ยท T(x, 0 ) = 37 ยฐC ยท ฮฑ โ‰ˆ 1.1ร— 10 โปโท mยฒ/s ยท L = 2 mm ยท t_end = 10 s neglected for now: blood perfusion (Pennes term), layered properties โ†’ one extra term / input; same PINN machinery Pennes, J. Appl. Physiol. 1 (1948) 93 ยท Duck, Physical Properties of Tissue (1990)

Centrum IntelliPhysics

Step 2 ยท Non-dimensionalise (the most skipped step) quantity SI scale after scaling depth x 10โปยณ m xฬ‚ = x / L โˆˆ [0,1] time t 10 s tฬ‚ = t / t_end โˆˆ [0,1] temperature 310 โ€“ 343 K ฮธ = (Tโˆ’T_b)/(T_sโˆ’T_b) โˆˆ [0,1] coefficient ฮฑ ~ 10โปโท ฮบ = ฮฑ t_end / Lยฒ ๐œ•๐œƒ ๐œ• ๐‘กฦธ = ๐œ… ๐œ• 2 ๐œƒ ๐œ• ๐‘ฅเทœ 2 , ๐œ… = ๐›ผ๐‘ก ๐‘’๐‘›๐‘‘ ๐ฟ 2

Handout Q 1 ( 1 min) Compute ฮบ for t_end = 10 s. Type it in the chat.

  • tanh neurons see inputs โ‰ˆ10โปยณ and must output โ‰ˆ
  • after scaling everything is O(1) Same PINN, same physics โ€” only the units differ exact ยท network in SI units (m, s, K): 878 % error ยท scaled network: 3.2 % (offline lab O2-1)

Inputs and outputs of O(1); the physics collapses into one Fourier number ฮบ. Always scale before you train.