New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1D Helmholtz equation with NBC and RBC #33
Comments
Could you try:
|
Hi Lu, thank you very much for your quick answer, I edited the file but it does not seem to work correctly. Step Train loss Test loss Test metric
0 [1.10e+01, 1.42e+00, 4.58e-04] [1.10e+01, 0.00e+00, 0.00e+00] [1.00e+00]
1000 [8.77e-02, 7.06e-01, 8.00e-05] [8.66e-02, 0.00e+00, 0.00e+00] [1.00e+00]
2000 [2.34e-01, 1.66e-01, 4.52e-03] [2.34e-01, 0.00e+00, 0.00e+00] [1.00e+00]
3000 [2.08e-01, 1.23e-01, 6.97e-04] [2.03e-01, 0.00e+00, 0.00e+00] [1.00e+00]
4000 [1.89e-01, 9.48e-02, 4.93e-04] [1.86e-01, 0.00e+00, 0.00e+00] [1.00e+00]
5000 [1.75e-01, 6.23e-02, 5.99e-03] [1.74e-01, 0.00e+00, 0.00e+00] [1.00e+00]
6000 [1.69e-01, 5.28e-02, 6.46e-03] [1.68e-01, 0.00e+00, 0.00e+00] [1.00e+00]
7000 [1.64e-01, 4.90e-02, 4.97e-03] [1.62e-01, 0.00e+00, 0.00e+00] [1.00e+00]
8000 [1.54e-01, 4.41e-02, 3.20e-03] [1.51e-01, 0.00e+00, 0.00e+00] [1.00e+00]
9000 [1.41e-01, 3.64e-02, 5.05e-04] [1.41e-01, 0.00e+00, 0.00e+00] [1.00e+00]
10000 [1.29e-01, 2.94e-02, 4.79e-04] [1.29e-01, 0.00e+00, 0.00e+00] [1.00e+00]
Best model at step 10000:
train loss: 1.59e-01
test loss: 1.29e-01
test metric: [1.00e+00] Thank you very much for your help, if you can provide me any tips I would be very thankful. |
Actually your train loss is too large. There are 3 columns in train loss: the first column is PDE loss, the second column is left BC loss, and the third column is right BC loss. So the main issue is that the PDE loss doesn't go down. The possible reason is that your PDE solution is not of scale O(1), which makes the training hard. There are two solutions:
|
Thank you for your help! layer_size = [1] + [50] * 3 + [1]
activation = "tanh"
initializer = "Glorot uniform"
net = dde.maps.FNN(layer_size, activation, initializer)
net.outputs_modify(lambda x, y: 10 * y) and I did not change any other parameter, but the loss for the PDE is still too high: Step Train loss Test loss Test metric
0 [2.62e+02, 4.45e+00, 2.97e-02] [2.77e+02, 0.00e+00, 0.00e+00] [1.00e+00]
1000 [2.08e-01, 2.38e-01, 8.59e-04] [1.86e-01, 0.00e+00, 0.00e+00] [1.00e+00]
2000 [1.85e-01, 1.04e-01, 5.35e-03] [1.86e-01, 0.00e+00, 0.00e+00] [1.00e+00]
3000 [1.82e-01, 7.54e-02, 8.64e-03] [1.92e-01, 0.00e+00, 0.00e+00] [1.00e+00]
4000 [1.82e-01, 7.53e-02, 7.41e-03] [1.91e-01, 0.00e+00, 0.00e+00] [1.00e+00]
5000 [8.35e-01, 4.25e-02, 4.77e-03] [8.98e-01, 0.00e+00, 0.00e+00] [1.00e+00]
6000 [1.80e-01, 7.23e-02, 6.70e-03] [1.90e-01, 0.00e+00, 0.00e+00] [1.00e+00]
7000 [1.80e-01, 6.88e-02, 6.79e-03] [1.90e-01, 0.00e+00, 0.00e+00] [1.00e+00]
8000 [3.66e-01, 8.63e-02, 5.91e-03] [3.78e-01, 0.00e+00, 0.00e+00] [1.00e+00]
9000 [1.71e-01, 6.24e-02, 4.21e-03] [1.80e-01, 0.00e+00, 0.00e+00] [1.00e+00]
10000 [1.56e-01, 5.24e-02, 1.32e-03] [1.64e-01, 0.00e+00, 0.00e+00] [1.00e+00]
11000 [1.80e-01, 3.73e-02, 2.93e-04] [1.93e-01, 0.00e+00, 0.00e+00] [1.00e+00]
12000 [1.18e+00, 4.68e-02, 8.33e-03] [1.25e+00, 0.00e+00, 0.00e+00] [1.00e+00]
13000 [1.64e-01, 1.72e-02, 7.67e-03] [1.72e-01, 0.00e+00, 0.00e+00] [1.00e+00]
14000 [9.79e-02, 1.72e-02, 1.30e-02] [1.05e-01, 0.00e+00, 0.00e+00] [1.00e+00]
15000 [1.45e-01, 1.33e-02, 1.40e-02] [1.52e-01, 0.00e+00, 0.00e+00] [1.00e+00] |
There is some problem in the reference solution you provided. |
I'm just wondering
|
For example, see https://machinelearningmastery.com/how-to-improve-neural-network-stability-and-modeling-performance-with-data-scaling/ If you do exp on log-uniform, then is uniform. |
Thanks, Lu. I've read that article.
|
Hello,
I am currently trying to implement the Helmholtz equation in 1D (evaluating an acoustical problem) given as:
with a NBC at the left end and a RBC at the right end of the interval.
The value of the NBC equals and the value of the RBC equals
.
In general, the solution given the mentioned BCs is stated as .
Since only the real part is considered, the solution is given as .
The code I used is shown below, but it is not working correctly and I don't know what I did wrong.
Thank you very much for your help!
The text was updated successfully, but these errors were encountered: