Skip to content

Implementing the 1D wave equation #4

@ShaikhaTheGreen

Description

@ShaikhaTheGreen

Thank you for the great contribution. PINNs have been an amazing tool in scientific computing and this enhancement makes it better. I replicated the code of burger's equation and made changes to model the 1D wave equation with a source term:

@tf.function
def f_model(x,t):
    c = tf.constant(1, dtype = tf.float32)
    Amp = tf.constant(1, dtype = tf.float32)
    frequency = tf.constant(1, dtype = tf.float32)
    sigma = tf.constant(0.5, dtype = tf.float32)
    source_x_coord = tf.constant(0, dtype = tf.float32)
    
    Gaussian_impulse =  Amp * tf.exp(-(1/(sigma**2))*(x-source_x_coord)**2)
    S = Gaussian_impulse * tf.sin( 1 * tf.constant(math.pi)  * frequency * t )
    u = u_model(tf.concat([x,t], 1))
    u_x = tf.gradients(u,x)
    u_xx = tf.gradients(u_x, x)
    u_t = tf.gradients(u,t)
    u_tt = tf.gradients(u_t,t)
    f_u = u_tt + (c**2) * u_xx - S
    
    return f_u

However, the output is not quite what I expected.

Screen Shot 2022-02-25 at 12 09 51 PM

I tried a couple of network architectures and learning rates, but the result seems to be the same. What would you suggest to get more accurate results?
Also, I saw how you placed the boundary conditions but I'm not sure how to specify the initial condition? Is it extracted from the exact solution?

Thanks again! Awaiting your feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions