lululxvi / deeponet

Learning nonlinear operators via DeepONet
Other
474 stars 130 forks source link

DeepONet Triple Data Shape | if branch & trunk inputs are just time a Parametric Space #17

Open cfd-ai opened 2 years ago

cfd-ai commented 2 years ago

I have a similar question to https://github.com/lululxvi/deeponet/issues/9. Imagine you have a transient simulation of a 3D domain and you are interested in an averaged quantity, e.g., Maximum Velocity V(t) . Then you would repeat this for various parameters (a parametric space), like Inlet Pressure (many Pi) and Inlet Temperature (many Ti). To translate this to the DeepONet terminology, I guess:

G(u)(y) = V(t)(Pi,Ti) That is to say, u is t :: Input to Branch is time (y) is (Pi, Ti) :: Input to Trunk is pair of (Pi, Ti)

Provided that the t array is always the same for all training, test, and future prediction values, I mean you are always interested in certain time values like [t1=0.1, t2=0.2, t3=0.3, ...], i.e., the objective is to predict V(t) always at the same times for any given (Pi,Ti), then I wonder which of the following forms is correct for the DeepONet Triple Data:

X_train=
[
    [
        [ V(t1)(P1,T1), V(t2)(P1,T1), V(t3)(P1,T1)... ] ,
        [ V(t1)(P2,T2), V(t2)(P2,T2), V(t3)(P2,T2)... ] ,
        ...
    ],
    [
        [ t1, t2, t3... ] ,
        [ t1, t2, t3... ] ,
        ...
    ]
]

y_train=
[
    [P1 , T1] ,
    [P2 , T2] ,
    ...
]

OR

X_train=
[
    [
        [ V(t1)(P1,T1) ] ,
        [ V(t2)(P1,T1) ] ,
        [ V(t3)(P1,T1) ] ,
        ...
        [ V(t1)(P2,T2) ] ,
        [ V(t2)(P2,T2) ] ,
        [ V(t3)(P2,T2) ] ,
        ...
    ],
    [
        [t1] ,
        [t2] ,
        [t3] ,
        ...
        [t1] ,
        [t2] ,
        [t3] ,
        ...
    ]
]

y_train=
[
    [P1 , T1] ,
    [P1 , T1] ,
    [P1 , T1] ,
    ...
    [P2 , T2] ,
    [P2 , T2] ,
    [P2 , T2] ,
    ...
]

Basically, train & predict over the entire [t] array together? or train & predict per each t value? or both of them are totally wrong?

Summary:

I guess in some form:

Am I correct?

Thanks!

Originally posted by @cfd-ai in https://github.com/lululxvi/deeponet/issues/9#issuecomment-1030532132

lululxvi commented 2 years ago

I am a little confused about the setup. Let us consider a simple: G(u)(t) = s(t), i.e., for any u(t), I want to predict the corresponding s(t). Then t is the input to trunk net, and u(t) is the input to branch net.

cfd-ai commented 2 years ago

Thanks @lululxvi. Then in G(u)(t) = s(t) form, for our problem:

So, if I understand correctly, we won't be able to feed this because in DeepONet, t (input to trunk net) has to be of the same size of u(t) (input to the branch net), am I correct? While here the input to the branch net has 5 elements but the input to the trunk net is only 1.

Am I missing something?

lululxvi commented 2 years ago

No. it works. Branch and trunk are two independent networks.