Scientific ML Studio
Learn/ Studio Tour/ 3.3
3.3 · The blocks, one at a time

Choose the equation

Pick the type, pick the equation, set its coefficients. One thing to check twice: the Lab writes Poisson as the Laplacian of u equal to f, with no minus sign.

The PDE block holds the physics that must hold at every interior point. It takes the Domain's Coords and Interior points, and gives out a PDE residual: the amount by which the equation fails to hold at those points. That residual is what the Loss block squares and minimises (see the residual as a loss).

Wire it first: Domain Coords → PDE Coords, and Domain Interior → PDE Interior.

1. Pick the type, then the equation

Two dropdowns work together.

Equation type filters the list underneath, and tells the validator which conditions to expect:

Type Meaning Needs time? Needs
Elliptic (steady) Nothing changes in time No Boundary conditions
Parabolic (diffusive, first order in time) Smooths out as time passes Yes Boundary conditions and an initial value
Hyperbolic (wave-like) Carries information along Yes Boundary conditions and an initial value

Equation is the specific PDE. For each one, the table shows what you set and the residual the Studio minimises. (Subscripts are derivatives: $u_t$ is the time derivative, $u_{xx}$ the second derivative in $x$. $\nabla^2 u = u_{xx} + u_{yy}$ in 2-D.)

Equation Type You set Residual that is driven to zero
Heat parabolic Diffusivity $a$ (default 0.1) $u_t - a\,u_{xx}$
Diffusion-reaction parabolic $D$ (0.1), reaction rate $k$ (1) $u_t - D\,u_{xx} - k\,u$
Wave hyperbolic Wave speed $c$ (1) $u_{tt} - c^2 u_{xx}$
Advection hyperbolic Speed $a$ (1) $u_t + a\,u_x$
Burgers hyperbolic Viscosity $\nu$ (0.01) $u_t + u\,u_x - \nu\,u_{xx}$
Poisson elliptic Source $f(x,y)$ $\nabla^2 u - f$
Laplace elliptic nothing $\nabla^2 u$
Steady heat conduction elliptic Conductivity $k$ (1), source $q(x,y)$ $k\,\nabla^2 T + q$
Helmholtz elliptic Wavenumber $k$ (1) $\nabla^2 u + k^2 u$
Custom residual any A formula whatever you write
General coefficient form any A table of coefficients see section 4

The Applies to network output field is for problems with several unknowns: it says which output of the Network the named equations act on (and which output u means in a custom residual). Leave it at 1 for a single field. To couple several unknowns in one equation, use a custom residual (section 5).

2. The Poisson sign

The Studio's Poisson equation is ∇²u = f, with no minus sign

In the Studio, Poisson means $\nabla^2 u = f$. A textbook often writes it as $-\nabla^2 u = g$. To solve $-\nabla^2 u = g$, enter $f = -g$.

Example: to solve $-u'' = \pi^2\sin(\pi x)$ on a line, enter -pi**2*sin(pi*x) as the source. The starter Poisson on a square does exactly this: its summary reads $\nabla^2 u = -2\pi^2\sin(\pi x)\sin(\pi y)$, and the exact answer is $\sin(\pi x)\sin(\pi y)$.

If a Poisson run converges to a mirror image of the answer you expected (the right shape, upside down), the sign of $f$ is the first thing to check.

3. Equation type must agree with the Domain

Three of the Graph check's notes are about this pairing.

  • an elliptic equation is steady, but the Domain has its time dimension switched on. Switch time off on the Domain.
  • a parabolic equation evolves in time, but the Domain has no time dimension, so its time derivative is dropped and the steady-state form is solved. Tick Time dimension on the Domain. Note that the Studio does not stop you: if you ignore the note you get the steady-state problem.
  • 'heat' is a parabolic equation but the block is set to elliptic. The parabolic rules will be applied. The Equation type dropdown and the Equation disagree. The equation wins, and the note tells you which rules were used.

4. The general coefficient form

When none of the named equations fits, choose General coefficient form. It is one scalar equation with a table of coefficients:

$$ e_a u_{tt} + d_a u_t + \nabla\!\cdot(-c\nabla u - \boldsymbol\alpha u + \boldsymbol\gamma) + \boldsymbol\beta\cdot\nabla u + a\,u = f . $$

The panel shows this equation, a table of coefficients ($e_a$, $d_a$ are numbers; $c$, $\alpha$, $\beta$, $\gamma$, $a$ and $f$ are formulas that can use the coordinates and $u$), and a Coefficient preset menu with a Load preset button. The presets are Heat, Wave, Poisson ($\nabla^2 u = f$, which sets $c = -1$), and Advection along $x$. Loading a preset overwrites the table, so load first, then edit.

A line under the table tells you what you have built: Stationary, First order in time or Second order in time, and reminds you to turn time on if the equation needs it.

The boundary conditions here prescribe $u$ or its normal derivative. A physical flux condition on a general-coefficient problem must also account for $c$, $\alpha$ and $\gamma$; it is not automatically a plain derivative condition.

5. A custom residual

Choose Custom residual and write the equation as an expression that should equal zero. You can use the coordinates, u, and its derivatives:

  • first derivatives: u_x, u_y, u_t
  • second derivatives: u_xx, u_yy, u_tt, and the mixed one as u_xy (always in coordinate order: u_xy, never u_yx)

For example, Burgers' equation with a different viscosity would be u_t + u*u_x - 0.003*u_xx. The default text is u_t - 0.1*u_xx.

Several unknowns in one equation

If the Network has more than one output (its Network outputs field), a custom residual can use every output, by number: u1, u2, u3, … and their derivatives, spelled the same way: u1_x, u3_y, u2_yy, u1_xy. This is how equations that couple several fields are built, one PDE block per equation, all wired to the same Domain and Loss.

The steady, incompressible Navier-Stokes equations in two dimensions, with $u_1 = u$, $u_2 = v$, $u_3 = p$ and Reynolds number 20, are three PDE blocks:

Block Residual Applies to network output
x-momentum u1*u1_x + u2*u1_y + u3_x - 0.05*(u1_xx + u1_yy) 1
y-momentum u1*u2_x + u2*u2_y + u3_y - 0.05*(u2_xx + u2_yy) 2
continuity u1_x + u2_y 3

Set each block's Equation type to Elliptic, since the flow is steady. The Applies to network output number does not change these residuals, which name their outputs explicitly; it labels the block and sets what a plain u would mean. With several PDE blocks, the loss log names them PDE1, PDE2, PDE3 in the order you placed them. Worked problem 13.11 builds this flow around a cylinder from start to finish.

Asking for an output the Network does not have (u4 on a three-output network) is an error the Graph check reports, listing what is available.

The rules for formulas (which functions, ** instead of ^) are on Read and change a block's settings. The generator emits only the derivatives your expression actually mentions.

the PDE block with *Elliptic* and *Poisson* selected and a source term typed in

Next: boundary and initial conditions.