Closed ViktorC closed 3 years ago
No, DeepXDE doesn't support variable ICs. You need to modify the code. Is the IC a number or a function?
Generally, it would be a function (which could be discretised if that helps). However, for ODEs, it would be just a scalar and for ODE systems, a vector.
Then you have to modify the code. As you can see in data/pde.py, the training points are generated only once in the beginning. To support variable ICs, basically in each iteration, we need to use different training points. you need to modify PDE.train_next_batch()
such that each batch uses different data.
Great, thank you. So once the caching in PDE.train_next_batch()
is disabled, I can use an IC with a dynamic function that may return different values for the same input, right? But is there a way to make the map aware of the current IC somehow (at least for ODEs where the ICs are discrete)? I imagine the input layer would require an extra neuron (or multiple extra neurons for systems of ODEs) and it would require some code changes to propagate the ICs to the map.
Yes, you are right.
PDE.losses()
It may be also helpful to look at the "Q: More details about DeepXDE source code" at FAQ.
That all makes sense. Thank you for your input. I'll make sure to check the FAQ out.
On a side note, it should be possible to extend this to PDEs as well by discretising the ICs, right? E.g. in the case of a time-dependent PDE with 2 spatial dimensions and Dirichlet ICs, one could fit a 2D grid onto the ICs and include the values at the vertices of this grid in the input layer of the map.
Yes. If IC is a function, then you can either use vertices values or (maybe better) coefficients of some spectral basis.
On the other hand, you may be interested in DeepONet (https://arxiv.org/abs/1910.03193).
Great, thank you for confirming.
Thanks for the link, skimming through the paper, I noticed that Figure 1 A illustrates exactly what we just discussed. 🙂 I'll definitely give it a good read.
Hi @lululxvi,
Is there a way to use DeepXDE with variable initial conditions? E.g. in the case of an ODE, is it possible to train a PINN on just the ODE (or just the ODE and a range of different initial conditions) so that the initial condition is one of the input variables of the model? If not, could you please advise on what changes would need to be made to allow for this (if it's possible at all)?
Many thanks, Viktor