benmoseley / FBPINNs

Solve forward and inverse problems related to partial differential equations using finite basis physics-informed neural networks (FBPINNs)
MIT License
293 stars 59 forks source link

some confusion about unormalization #2

Closed xuliang5115 closed 1 year ago

xuliang5115 commented 3 years ago

Your code is awesome! 👍 And i have some difficulties in understanding your code.

   #  codes from main.full_model_FBPINN
    y = y * c.Y_N[1] + c.Y_N[0]

I think this sentence is to achieve unnormalization and i found define c.Y_N in constants.py.

  # codes from constants.Constants
   w = 1e-10
   self.Y_N = (0,1/self.P.w**2)# mu, sd

This seems to multiply a large constant. I don't understand why this is necessary and why choose this value?

benmoseley commented 3 years ago

The defaults in the constants.Constants are currently set up to solve the following problem from the paper:

equation

The solution ranges between [-1/(w^2), +1/(w^2)] so the output of the network is multiplied by 1/(w^2) such that the network's linear layer output is in the range [-1,1]. The hope is that by ensuring the network's outputs (and inputs) are in the range [-1,1] this aids convergence. In the constants file w=1e-10 currently but you should hopefully find that using e.g. w=1 or even w=1e10 will have similar convergence when using this normalisation.