Skip to content

1D and 2D wave Equation with a Source Term #1

@ShaikhaTheGreen

Description

@ShaikhaTheGreen

Hello @lululxvi and @jeremyyu8 !!
Thanks for the great enhancement on PINN!

I am modifying burgers.py to run for the 1D wave equation.

du_tt - c**2 * du_xx - S

where,

S(0,t) = sin (pi *f *t) #Source function at point 0

I have a couple of questions to better understand the model.

So I changed the gPINN pde to be:


def pde(x, y):
    c = 1
    ###############################Source##################################
    Amp = 1
    frequency = 1
    sigma = 0.5  #width of source signal
    source_x_coord = 0
    Gaussian_impulse =  Amp * tf.exp(-(1/(sigma**2))*(x[:,0:1]-source_x_coord)**2)
    S = Gaussian_impulse *tf.sin( 1* np.pi  * frequency * x[:, 1:2] )
    ###############################PDE####################################
    #Using new DeepXDE Jacobians and Hessians
    du_xx = dde.grad.hessian(u, x, i=0, j=0)
    du_tt = dde.grad.hessian(u, x, i=1, j=1)

    du_ttx = dde.grad.jacobian(du_tt, x, j=0)
    du_xxx = dde.grad.jacobian(du_xx, x, j=0)
    dS_x = -4 * x[0:1] * tf.exp(-2*x[0:1]**2) * tf.sin(6.28318530717959*x[1:2])

    du_ttt = dde.grad.jacobian(du_tt, x, j=1)
    du_xxt = dde.grad.jacobian(du_xx, x, j=1)
    dS_t = 6.28318530717959 * tf.exp(-2*x[0:1]**2) * tf.cos(6.28318530717959*x[1:2])

    return [
        du_tt - (c**2) * du_xx - S,
        du_ttx - (c**2) * du_xxx - dS_x,
        du_ttt - (c**2) * du_xxt - dS_t,
    ]
  1. Please let me know if this change seems correct to you?
  2. Can you please elaborate more on how to use output_transform(x, y) ? And how can I change it to suit my 1D wave equation?
  3. Also, to expand to a 2D wave equation with a time-dependent source term what are the changes that I need to do? This will be a problem with 2D (x,y) +1D (t).

Thank you very much!
I'm looking forward to your reply.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions