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

shallow water 1 layer, issues with gradient #5

Open
apatlpo opened this issue Jan 10, 2018 · 2 comments
Open

shallow water 1 layer, issues with gradient #5

apatlpo opened this issue Jan 10, 2018 · 2 comments

Comments

@apatlpo
Copy link
Contributor

apatlpo commented Jan 10, 2018

Hi,

I am trying to build upon KleinGordon in order to setup a 1 layer shallow water model:
https://github.com/apatlpo/shenfun_trial/blob/master/swater_1L/swater_1L.py

Unfortunately, the time rate of change of variables is very small at the moment and I suspect I am not normalizing correctly terms corresponding to g\partial_x h.
In other terms, I am missing the A term in the KleinGordon example.

If anybody has an idea, I would be most grateful.

@mikaem
Copy link
Member

mikaem commented Jan 10, 2018

Hi
I had a quick look and I see two issues. One is as you mention, you are missing division by A in rhs terms that are not using forward, i.e., du_hat[:] = Cu*h_hat and dv_hat[:] = Cv*h_hat and dh_hat[:] = Chu*u_hat + Chv*v_hat. Note that forward here, with only Fourier bases, is just short for inner product divided by diagonal mass matrix, i.e., A. You can get A as A=inner(hh,hh_test) or simply A=(2*np.pi)**2. Second, you should expect min(du_hat) and min(dh_hat) to be zero, since these are in spectral space. What you ought to use is norms, like np.linalg.norm(u_hat).
Hope this helps.

@apatlpo
Copy link
Contributor Author

apatlpo commented Jan 10, 2018

Thanks a lot for this.
The principal bug was actually quite trivial (once spotted of course): line 174 was missing and messed up plotting.

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