Use multiple output neural network in NeuralPDE

Hey everyone,

I am trying out neural PDE to solve Euler’s equations in 1D. In my problem, I have two inputs : t and x, and I have three outputs : density ρ, velocity v and pressure p. Here are the equations:

\partial_t \rho + \rho~\partial_x v + v~\partial_x \rho = 0
\partial_t v + v~\partial_x v + \partial_x p / \rho = 0
\partial_t p + v~\partial_x p + \gamma p~\partial_x v = 0

I have noticed that in NeuralPDE, you always use neural networks with one output, so in this problem, I would need to train three different neural networks for each of my output quantities. Is it possible to use only one neural network with three outputs in NeuralPDE?

Thank you for yout answers!

This is a missing optimization. Using a single neural network is a lot slower if you have one equation which needs a higher derivative in one variable, which is very common for example to diffuse in one set but have other sets be algebraic. However, there are a few cases that could specialize on having all the same derivatives, like Euler’s equations. We are planning to allow for this optimization in the near future with the new parser, and that’s scheduled to finish before the end of this year.

1 Like

Perfect, thank you for your answer!