deepxde
deepxde copied to clipboard
Interface Conditions with DeepXDE
Hi @lululxvi,
I am trying to solve a similar Problem as in #649 (quasi-static Maxwell) including the following conditions at interfaces with different material properties (mu and sigma):
You previously linked to your publication here, but I am still unsure about the best way of implementing it.
My current approach is as follows: I have two outputs of the PINN: "A_1" and "A_2" for the respective materials. On the interfaces (more precisely: on an epsilon-surrounding of the interfaces) I enforce e.g. A_1 = A_2 for the first line and afterwards use the "apply_output_transform" function to recombine A_1 and A_2 into a single Output A, e.g. for visualization
It seems to work technically, but is this the "correct" way to do it in DeepXDE or is there a way to enforce conditions like these with only one output variable A?
I plan to consider more than 2 materials in the future so it might get really cumbersome with the output variables and also less performant in terms of runtime/accuracy.
Best Regards and thanks for the nice framework! Philipp
Yes, it is correct to use two outputs, but there is no need to use apply_output_transform
to combine. After training, you can do a post-processing to combine.
Thanks for the confirmation! My idea was to use apply_output_transform in order to use a metric on a reference solution during training, but I think I get your point.
I have another Question: I need to calculate the normal components (x and y) of the interfaces also for non-orthogonal interfaces going forward....I see in the documentation of deepxde.geometry that this is basically implemented already. However, I struggle to get it to work because it requires numpy-arrays and I am trying to determine these normal vectors live during training where I only have tf-tensors.
Basically looking for a function get_interface_and_normal_components() as follows:
def pde(x, y):
is_interface, nx, ny = get_interface_and_normal_components(x)
interface_loss = tf.where(is_interface, a * nx + b * ny, 0)
...
return [..., interface_loss]
Is there an easy solution or existing example for this problem?
Not sure what the easy solution is. You may need to implement it by yourself.
@PhilippBrendel I am also interested in the continue contidions of two or more materials, I want to know if I use one geom to define two materials, and how can I write the conditions at interface? Can you tell me some key points that how you deal with it? I probably use OperatorBC to write the condition, and maybe I should use anchors to add some point at interface. Then I am confused about how can I represent a condition like a1dy/dx[left] = a2dy/dx[right]. Can anyone help me?