deepxde icon indicating copy to clipboard operation
deepxde copied to clipboard

Interface Conditions with DeepXDE

Open PhilippBrendel opened this issue 2 years ago • 4 comments

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):

interfaces

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

PhilippBrendel avatar Jul 12 '22 09:07 PhilippBrendel

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.

lululxvi avatar Jul 15 '22 06:07 lululxvi

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?

PhilippBrendel avatar Jul 15 '22 12:07 PhilippBrendel

Not sure what the easy solution is. You may need to implement it by yourself.

lululxvi avatar Jul 19 '22 19:07 lululxvi

@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?

w-venton avatar Apr 21 '23 03:04 w-venton