To set up a physics-informed neural network (PINN) for an inverse Navier–Stokes problem, train it to fit measured flow data and satisfy the governing equations at the same time. For a reproducible starting point, use the published two-dimensional, incompressible cylinder-wake benchmark at Reynolds number 100: infer the flow field and unknown equation coefficients from velocity observations, while using momentum residuals to constrain predictions between observations. That benchmark demonstrates a setup; it does not guarantee accuracy or parameter recovery for other geometries, noise levels, or flow regimes.
What is the inverse problem?
In a forward problem, the equations and their parameters are given, and the goal is to calculate the flow. In an inverse problem, some of that information is unknown. A PINN represents the flow with a neural network, then adjusts the network and unknown physical coefficients so its predictions agree with measurements and satisfy the equations.
As an Amazon Associate I earn from qualifying purchases.
For two-dimensional incompressible flow, write the velocity components as u(t,x,y) and v(t,x,y), and pressure as p(t,x,y). In the inverse formulation described by Raissi, Perdikaris, and Karniadakis (2019), two coefficients, λ1 and λ2, are inferred along with the flow representation. The continuity equation is:
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallux + vy = 0.
For a nondimensional formulation, the momentum equations can be written with residuals:
#1 Best Overall
f = ut + λ1(u ux + v uy) + px − λ2(uxx + uyy)
g = vt + λ1(u vx + v vy) + py − λ2(vxx + vyy).
A solution satisfies the momentum equations when f and g are zero. In this formulation, λ1 and λ2 are equation coefficients; their interpretation depends on the chosen dimensional or nondimensional equations. For the paper’s nondimensional cylinder example, free-stream speed and cylinder diameter are each 1, and kinematic viscosity is 0.01. Do not interpret a learned coefficient as a viscosity estimate until you have checked how the equations were scaled and defined.
How do you enforce incompressibility in a PINN?
Use a stream function when continuity should hold by construction
The 2019 inverse formulation predicts a stream function ψ and pressure p, then derives velocity as:
u = ψy, v = −ψx.
With sufficiently smooth outputs and the derivatives used in the model, this makes ux + vy = 0 by equality of mixed partial derivatives. Continuity is therefore built into the representation rather than enforced only by adding a separate continuity penalty.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
Directly predict velocity when that fits the implementation
A network can instead predict u, v, and p directly. In that case, incompressibility must be imposed explicitly, commonly through a continuity residual. The choice is a trade-off: the stream-function form enforces divergence-free velocity by construction but requires differentiating the stream function to obtain velocity; direct velocity outputs are simpler to interpret as network outputs but require an additional continuity constraint. Neither representation removes the need to check that the equations, boundary conditions, and data are appropriate for the problem.
How do you build the PINN residuals?
For each training coordinate (t,x,y), evaluate the network and use automatic differentiation to calculate the derivatives in the equations. The momentum residuals above require first derivatives in time and space and second spatial derivatives. Automatic differentiation is the approach described in the original PINN framework; it computes derivatives of the network with respect to its inputs rather than approximating them with finite differences.
Keep the equations and units consistent. If you nondimensionalize, apply the same scales to coordinates, velocity, pressure, and coefficients throughout the network, residuals, and data loss. A coefficient’s numerical value is meaningful only in the context of those definitions. Record the precise equations and scaling alongside the trained model so that a later coefficient interpretation can be reproduced.
Rank #3
How should the data and physics losses be combined?
At observed points, penalize disagreement between predicted and measured velocity. At collocation points, penalize nonzero momentum residuals. A basic objective is:
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →L = wdataLdata + wmomentumLmomentum,
where Ldata measures the velocity mismatch, Lmomentum measures the residuals f and g, and the w terms set their relative influence. Add boundary or initial-condition terms when the problem supplies those conditions and the chosen formulation represents them.
There is no universal weighting prescription established by the cited examples. State how each loss is normalized, what units its underlying quantities use, and how the weights were chosen. If one term dominates numerically, a low total loss can conceal poor fit to the other term. Inspect the component losses separately as training proceeds, and validate with held-out data and residual behavior rather than treating a single objective value as proof of a sound inverse solution.
Rank #4
How can you reproduce the Re=100 cylinder-wake example?
Benchmark data and validation
Raissi, Perdikaris, and Karniadakis (2019) report randomly selecting 5,000 velocity observations, described as 1% of their high-resolution cylinder-wake dataset, for the inverse demonstration at Re = 100. They retain the remaining observations for validation. This is a benchmark sampling choice, not a minimum data requirement or a guarantee that 5,000 points will be enough for another flow.
For a new problem, reserve measurements that are not used to fit the network. Evaluate velocity error on those observations and inspect momentum residuals in the domain. If the true coefficients are known from a synthetic case or can be independently justified, compare recovered values against them. If they are not known, report that limitation rather than presenting fitted values as verified physical properties.
DeepXDE example settings
DeepXDE’s inverse Navier–Stokes cylinder example provides a practical baseline. The repository script describes a Re=100 case, loads measured velocity data, defines a space-time domain, constrains observed velocity components, and treats two PDE coefficients as trainable external variables. Its example network takes (x,y,t) as input and uses a fully connected network with six hidden layers of 50 units, tanh activation, Glorot uniform initialization, and three outputs.
The script specifies 700 domain points, 200 boundary points, and 100 initial points. It trains in two Adam stages: 10,000 iterations at a learning rate of 10−3, followed by 10,000 at 10−4. These are settings from that example, not a generally optimal architecture, sampling plan, or training schedule. In particular, use point counts and losses that correspond to your own domain, boundary and initial conditions, and measurements.
- Define the problem: specify the domain, time interval, equations, unknown coefficients, measurement locations and any available initial or boundary conditions.
- Prepare the data: organize velocity observations with their coordinates and units. Separate fitting observations from held-out validation observations before training.
- Choose outputs and residuals: decide whether to represent velocity with a stream function or predict velocity directly, then implement the matching continuity and momentum constraints.
- Configure training: set collocation points, data constraints, network architecture, loss scales, optimizer settings, and trainable physical coefficients. Treat the DeepXDE values above as a baseline to reproduce, not as a prescription.
- Check the result: assess held-out velocity errors, residuals, and coefficient recovery where a justified reference exists. Fix or report problems with scaling, pressure reference, boundary conditions, noise, or identifiability rather than relying on training loss alone.
DeepXDE supports PINNs for forward and inverse differential-equation problems. Its versioned inverse-problem documentation lists the cylinder-flow example, while its stable documentation describes broader functionality. Because code and documentation can change, record the DeepXDE version or repository branch and confirm compatibility with the backend you intend to use. The example script lists TensorFlow, PyTorch, TensorFlow compat v1, and Paddle among supported backends; verify the support and compatibility of the specific release in your environment.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.How do you infer pressure, and what can the coefficients tell you?
Pressure needs a reference
In the cylinder-wake inverse example, pressure is reconstructed only up to an additive constant. The pressure gradients enter the momentum equations, so adding a constant to pressure does not change those gradients. Consequently, velocity observations and momentum residuals alone do not determine an absolute pressure level. To report pressure values, define a reference convention, such as fixing pressure at a chosen location, and state it with the results.
Coefficient recovery is not guaranteed by adding physics
Jointly fitting a flow representation and equation coefficients makes parameter inference possible, but a physics loss does not by itself make unknowns identifiable or ensure that optimization converges to the correct answer. Whether viscosity or another coefficient can be recovered depends on the equations, available observations, noise, domain, and imposed conditions. Assess that question for the particular setup, and distinguish a coefficient that minimizes the chosen loss from one independently validated as a physical value.
What should you check when results are unreliable?
- Scaling: verify coordinate, velocity, pressure, and time scales, and confirm that coefficient definitions match the residual equations.
- Loss balance: inspect data and residual losses individually; document normalization and weights instead of assuming raw magnitudes are comparable.
- Data and conditions: check measurement noise, spatial and temporal coverage, and whether initial and boundary conditions are represented correctly.
- Identifiability: determine whether the observations can distinguish the coefficients you are trying to infer. A good fit to measured velocities does not alone establish unique parameter recovery.
- Pressure gauge: specify a pressure reference before interpreting absolute predicted pressure.
- Generalization: evaluate observations withheld from fitting and residual behavior beyond the training points. Success on the published Re=100 cylinder case is not evidence of equivalent performance on a different flow regime or geometry.
A fluid-mechanics review of PINN work discusses a broader set of approaches, including sampling, domain decomposition, uncertainty quantification, and training pathologies. Those topics can motivate further problem-specific investigation, but they do not establish a universally superior architecture or optimizer for this inverse task. The strongest starting point is a clearly specified physical model, transparent loss construction, and validation matched to the intended application.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




