deepxde icon indicating copy to clipboard operation
deepxde copied to clipboard

Numerical instability

Open jdellag opened this issue 1 year ago • 2 comments

After a few months of tying up loose ends and really getting to know the ins/outs of DeepXDE, I have finally found a solution to a basic inverse problem that I have been working on in Stoke's flow. Now, I am trying to move beyond this simple problem into considerably more complex problems but am encountering some severe numerical instability.

Say one component of my exact solution is given by the following code:

def uexact_func(x):
    r2 = np.power(x[:,0:1], 2)
    r4 = np.power(x[:,0:1], 4)
    cth = np.cos(x[:,1:2])
    cth_sq = np.power(cth,2) 
    u2 = alpha*((-1/r2)+(1/r4))*((1/2)*(3*cth_sq-1))
    return u2

Where alpha is some constant. Now, the original problem I considered had alpha = -1 and I was able to achieve decent results (L2 error on the order of 1e-2). However, when changing alpha = 1 I am given a completely wrong exact solution of my flow field. But, if I just change each of the exact functions by completely stripping out the alpha term, I come to a completely correct exact solution to my flow field.

My question: is this normal? Do exact solutions need to be adjusted such that they have the smallest number of operations possible? Does the L2 error on the order of 1e-2 point towards further optimizations that I need to make?

I appreciate your time looking at this issue and look forward to hearing back.

jdellag avatar Sep 25 '23 14:09 jdellag

For what it's worth, this issue seems to happen when utilizing a GPU via the official DeepXDE docker image. It does not happen when I run the code on Apple silicon.

jdellag avatar Oct 05 '23 16:10 jdellag

hey, it is difficult to understand your problem. Can you share the entire code? You have only shared the exact solution which is not very helpful

praksharma avatar Oct 17 '23 09:10 praksharma