question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wave Equation Amplication Issue

See original GitHub issue

When I try to use the wave equation the amplitude of the wave is amplified by a lot over the duration of the simulation. Here is my code:

import numpy as np
from pde import FieldCollection
from pde import (DiffusionPDE, UnitGrid, ScalarField, MemoryStorage,
                 PlotTracker, PrintTracker, RealtimeIntervals, DataTracker)
from pde.visualization import movies
import math
import random
import pde
import pandas
import ffmpeg
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt


storage = MemoryStorage()

trackers = [
    'progress',                    # show progress bar during simulation
    'steady_state',                # abort when steady state is reached
    storage.tracker(interval=1),   # store data every simulation time unit
    PlotTracker(show=True),        # show images during simulation
]

grid = pde.UnitGrid([64, 64])
field1 = ScalarField.random_uniform(grid, 0, 0)  # generate initial condition
field2 = ScalarField(grid);
field1.add_interpolated([48, 48], 1)
field1.add_interpolated([48,16], 1)
state = FieldCollection([field1,field2]); #first slot is the density field, 

eq = pde.WavePDE(speed=1);
result = eq.solve(state, t_range=200, dt=1, tracker = trackers)
result.plot(colorbar = True, show = True)       # plot the resulting field
movies.movie_multiple(storage, filename = r'C:\Users\matth\URECA Simulation\testfile.mp4')

and here is the file of the movie. In the movie the colorbar is at 10^90 and the wave can only be seen at the end of the movie, which means that the amplitude is increasing throughout the simulation. I looked at the documentation and I am not sure why this is happening.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
david-zwickercommented, Jun 10, 2020

I’m not an expert on these methods but I would certainly welcome pull requests that implement more general solvers. A good starting point would probably be to look at the implementations of pde.solvers.implicit and pde.solvers.explicit. I just realized that the explicit solver already supports Runge-Kutta 4/5, which is an explicit stepper. It would be great to have more methods available, either as extensions to the present solver classes or as a separate RungeKuttaSolver class.

0reactions
MatthewBelzercommented, Jun 16, 2020

I just reduced dt to .0001. I don’t think using the implicit and explicit methods changed it that much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Applications of wave equations
This section presents a range of wave equation models for different physical phenomena. Although many wave motion problems in physics can be modeled...
Read more >
A CASE-STUDY ON WAVE EQUATION AND ITS APPLICATION
The main aim of the paper is to use partial differential equation in real life to solve world problems. Under partial differential equation,...
Read more >
Wave equation - Wikipedia
The (two-way) wave equation is a second-order linear partial differential equation for the description of waves or standing wave fields — as they...
Read more >
12.2: The Wave Equation - Mathematics LibreTexts
We motivate the study of the wave equation by considering its application to the vibrations of a string – such as a violin...
Read more >
Wave Equation Example Problem - YouTube
An example problem using the wave equation is explained and worked out.By James Dann, Ph.D. for ck12.org CC BY NC SA.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found