lu-group / deeponet-fno

DeepONet & FNO (with practical extensions)
Other
202 stars 41 forks source link

Suggestion: Adevection case 3 input #6

Open jonny97 opened 1 year ago

jonny97 commented 1 year ago

Hi Professor Lu, thanks for the well-written codes. I am reading the advection data generation code, case 3, where the input function is defined to be a square wave plus a continuous bump, the following are your parameter setting:

    c1 = 0.1 * rng.random() + 0.2  # [0.2, 0.3]
    w = 0.1 * rng.random() + 0.1  # [0.1, 0.2]
    h1 = 1.5 * rng.random() + 0.5  # [0.5, 2]
    c2 = 0.1 * rng.random() + 0.7  # [0.7, 0.8]
    a = 5 * rng.random() + 5  # 1 / [0.1, 0.2] = [5, 10]
    h2 = 1.5 * rng.random() + 0.5  # [0.5, 2]
    pde = Advection_v2(0, 1, c1, w, h1, c2, a, h2)

Thus, the c2 + a / h2 could be bigger than 1. In pde.solve code, seems like this case is never handled, and because of the periodic boundary condition assumption, the current implementation may have the following inputs: Initial condition: image solution at t = 29/40 image

which means currently, the initial boundary will always be 0, which is not ideal (shall not be a big concern though). I am not sure if this is intended. Please let me know if there are some reasons behind this, thanks!

lululxvi commented 1 year ago

What do you mean the initial boundary will always be 0?

jonny97 commented 1 year ago

Sorry for the confusion. The initial condition in advection, case 3, according to the paper is:

$$u_0(x) = h1 1{(c_1 - \frac{w}{2}, c_1 + \frac{w}{2})} + \sqrt{\max(h_2^2 - a^2(x-c_2)^2, 0)}$$

with periodic boundary condition. In the code, $$a\in[5,10], h_2 \in [0.5,2], c_2 \in [0.7, 0.8]$$. For example, if $c_2 = 0.8, a = 5, h_2 = 2$, for the second term to be nonzero, we have $x \in [0.4,1.2]$. The problem occurs at the boundary, $x=1$, $u_0(1)$ will be nonzero in this case but $u_0(0)$ is always zero with the current choice of $c_1, w$.

In the current implementation, $u_0(1)$ is not computed as we are using the periodic boundary, but this will lead to a jump of discontinuity in the function definition. The plot I attached in this initial post gives such an example. I am not sure if this is intended.

lululxvi commented 1 year ago

Good catch. We don't intend to have the jump, but it is not a problem in practice, because the network can learn the jump.