Skip to content
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

Electric current source tilt #2

Open
alabaykazakh opened this issue Aug 17, 2022 · 5 comments
Open

Electric current source tilt #2

alabaykazakh opened this issue Aug 17, 2022 · 5 comments

Comments

@alabaykazakh
Copy link

alabaykazakh commented Aug 17, 2022

Dear Lu Lu,

Thank you for your nice work on hPINN. Recently I modified the code to solve only the forward problem, but I faced one issue. In your paper, you used a time-harmonic source to generate a plane wave in the y-direction. I am interested in illumination under 6-12°, so I tilted the source (see picture). I know that to excite the domain by a plane wave with a defined propagation direction, this source is necessary and we embed it in the imaginary part of the Helmholtz equation.

  1. However, I would like to know: is it possible somehow to get a "pure" imaginary part without this source finite-width strip (blue) inside?
    image

At the moment, the real part is predicted correctly, but due to this strip in the imaginary part, the total E-field, as a result, the intensity, and phase suffered. In the picture below, you see the predicted intensity for a 50/50 (air/dielectric) domain for different incidence angles.
image
2. Can the intersection of the tilted source strip with a perfectly matching layer (PML) on the top be a possible reason for that?

  1. After I tilted the source, do my periodicBC remain unchanged or I should modify period P depending on incidence angle?

Thank you

@lululxvi
Copy link
Owner

  • I don't fully understand your question, so I don't have a good suggestion.
  • Boundary condition and incidence angle are two independent things.

@alabaykazakh
Copy link
Author

Could you or anyone please suggest how could I implement the tilted illumination? How the source should be modified in such a case?

@lululxvi
Copy link
Owner

lululxvi commented Sep 4, 2022

You need to have a well-defined PDE problem.

@alabaykazakh
Copy link
Author

alabaykazakh commented Nov 1, 2022

Dear Lu Lu,

I managed to solve the oblique illumination problem by switching from Total Field formalism to Scattered Field one. In contrast to normal illumination, the periodicity should also be enforced in both the x and z directions. To do that, I modified your hard-constrained periodic BC in the following manner:

For oblique incidence ( $\theta$ != 0 $^\circ$ )

  def feature_transform(inputs):
    P = 1/np.sin(np.pi*theta/180) #period in x-direction
    OMEGA = 2*np.pi*np.cos(np.pi*theta/180) #period in z-direction
    w = 2 * np.pi / P
    x, y = w * inputs[:, :1], inputs[:, 1:]
    return tf.concat(
        (
            tf.math.cos(x),
            tf.math.sin(x),
            tf.math.cos(2 * x),
            tf.math.sin(2 * x),
            tf.math.cos(3 * x),
            tf.math.sin(3 * x),
            tf.math.cos(4 * x),
            tf.math.sin(4 * x),
            tf.math.cos(5 * x),
            tf.math.sin(5 * x),
            tf.math.cos(6 * x),
            tf.math.sin(6 * x),
            # tf.math.cos(7 * x),
            # tf.math.sin(7 * x),
            # tf.math.cos(8 * x),
            # tf.math.sin(8 * x),
            # tf.math.cos(9 * x),
            # tf.math.sin(9 * x),
            # tf.math.cos(10 * x),
            # tf.math.sin(10 * x),
            y,
            tf.math.cos(OMEGA * y),
            tf.math.sin(OMEGA * y),
        ),
        axis=1,
    )

For the problem described below, I managed to get the following results:
Real part of E-field

From the real field results it can be seen that the periodicity is fulfilled well. The predicted intensity also matches with the reference.
Incidence angle: $\theta$ = 15 $^\circ$
diff_intensity_15_high_res
Incidence angle: $\theta$ = 30 $^\circ$
diff_intensity_30_high_res
Incidence angle: $\theta$ = 45 $^\circ$
diff_intensity_45_high_res
Incidence angle: $\theta$ = 60 $^\circ$
diff_intensity_60_high_res

My questions are:

  1. The periodic BC I implemented work well for angles $\theta$ = 15...60 $^\circ$. However, for small angles (i.e. $\theta$ = 6), it is getting harder to keep periodicity.
    Incidence angle: $\theta$ = 6 $^\circ$

diff_intensity_6_high_res

Is this somehow related to the fact that plane waves incident at small angles is repeated after large periods exceeding the x-size of the domain??

  1. From the comparison of intensity images, the error looks also periodic. My opinion is that PFNN I used fails to learn high-frequency functions. Do you have any ideas on how this could be explained? Can Multi-scale Fourier feature networks or DeepONet learn the Fourier basis functions embedded in hard-constrained periodic BC better? Maybe other activation functions (i.e., sin)?

  2. I also tried the Fourier feature transform offered in #477 and #937 to tackle the problem of spectral biasing and hoped that network can better solve a wave equation. However, seems that a network is not learning in such a case:
    image
    Why are the losses frozen and not reduced?

@lululxvi
Copy link
Owner

lululxvi commented Nov 6, 2022

Is this somehow related to the fact that plane waves incident at small angles is repeated after large periods exceeding the x-size of the domain??

It looks periodic to me.

2. From the comparison of intensity images, the error looks also periodic. My opinion is that PFNN I used fails to learn high-frequency functions. Do you have any ideas on how this could be explained? Can Multi-scale Fourier feature networks or DeepONet learn the Fourier basis functions embedded in hard-constrained periodic BC better? Maybe other activation functions (i.e., sin)?

Try more Fourier modes.

3. I also tried the Fourier feature transform offered in [#477](https://github.com/lululxvi/deepxde/issues/477#issue-1095903192) and  [#937](https://github.com/lululxvi/deepxde/issues/937) to tackle the problem of spectral biasing and hoped that network can better solve a wave equation. However, seems that a network is not learning in such a case:
   ![image](https://user-images.githubusercontent.com/61251090/199224293-94bc9f51-6871-4082-bdbf-01ad64257d53.png)
   Why are the losses frozen and not reduced?

Some bug in your code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants