Skip to content

Defining BCs #673

Answered by lululxvi
akapet00 asked this question in Q&A
Mar 5, 2020 · 15 comments · 2 replies
Discussion options

You must be logged in to vote

@antelk I checked your code. Here are some modifications:

  1. Define left and right boundary locations.
def boundary_l(x, on_boundary):
    return on_boundary and np.isclose(x[0], 0)

def boundary_r(x, on_boundary):
    return on_boundary and np.isclose(x[0], L)

Note: bc_r = dde.DirichletBC(geom, lambda x: np.full_like(x, T_c), boundary_r)

  1. Use more training points, e.g., 100.
data = dde.data.PDE(geom, 1, pde, [bc_l, bc_r], 100, 2, func=analyticSol, num_test=100)
  1. Because the solution is of order 10, then let's multiply the network output by 10.
net = dde.maps.FNN(...)
net.outputs_modify(lambda x, y: y * 10)
  1. The three loss terms are of different scales when step = 0. Use loss_weights

Replies: 15 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@engsbk
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jprince58
Comment options

Answer selected by lululxvi
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants
Converted from issue

This discussion was converted from issue #673 on May 13, 2022 22:40.