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

1D wave equation solver.[WIP] #16

Merged
merged 20 commits into from
Sep 18, 2017

Conversation

Balavarun5
Copy link
Contributor

@Balavarun5 Balavarun5 commented Sep 8, 2017

Code to simulate the time evolution of the 1D wave equation using discontinuous Galerkin and Euler forward methods. This code is not completely functional (Ref- Issue #6 for further details), as the amplitude increases with time and eventually blows up.

@Balavarun5 Balavarun5 changed the title Lax friedrichs flux 1D wave equation solver. Sep 8, 2017
@Balavarun5 Balavarun5 self-assigned this Sep 8, 2017
@amanabt amanabt added this to the 1D Wave equation solver. milestone Sep 9, 2017
Copy link
Member

@amanabt amanabt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review is mainly concerned with the code guidelines issues. I have not reviewed few changes related to writing mathematical equations in doc-strings because I had some confusion about it, which, I have discussed in issue #19. I will review them once this issue is resolved.

I did not review any of the test functions because on running pytest, the tests are failing.

README.md Outdated
@@ -27,4 +27,4 @@ python3 main.py
* **Mani Chandra** - [GitHub Profile](https://github.com/mchandra)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We updated the README a few days ago. You should have the updated README here. I am attaching the
link where you can find it.
hdf5_ImplementationForStoring_u

@@ -1,201 +1,72 @@
import numpy as np
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the Quazartech style guidelines, the imports should be grouped in the following order
Imports should be grouped in the following order:

  • standard library imports
  • related third party imports
  • local application/library specific imports

I would prefer if you give spacing between different groups.
I am adding this review only here but you should check for this issue in every python file.

dLp_xi = af.blas.matmul(differentiation_coeffs, nodes_power_tile)

return dLp_xi

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you still using global variables?
You mentioned in Issue #17 that this code is not using global variables. What's going on?

stored in stored in variable `time`.


Calculates and returns the LGL points for a given N, These are roots of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can write,

Calculates : math: `N` Legendre-Gauss-Lobatto (LGL) points.
LGL points are the roots of the polynomial 
:math: `(1 - \\xi ** 2) P_{n - 1}'(\\xi) = 0`
Where :math: `P_{n}(\\xi)` are the Legendre polynomials.
This function finds the roots of the above polynomial 

Calculates and returns the LGL points for a given N, These are roots of
the formula.
:math: `(1 - xi ** 2) P_{n - 1}'(xi) = 0`
Legendre polynomials satisfy the recurrence relation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point adding this recurrence relation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable legendre_N_minus_1 uses this recurrence relation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would have made sense to give the recurrence relation if you had explained the algorithm. But since you have not explained the algorithm, the reader won't know why you have written the recurrence relation.


Parameters
----------
u_t_n : arrayfire.Array [N_LGL N_Elements 1 1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the variable named u_t_n?
If I understand correctly, u_t_n is basically the wave amplitude at n^{th} time step.
Then why don't we name it just u_n.


def surface_term(u_t_n):
'''
A function which is used to calculate the surface term,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't start with A function ..., we know that it is a function. Remove unneeded words.

@@ -1,72 +1,41 @@
import numpy as np
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code guidelines violation for imports.

from utils import utils
import math
af.set_backend('opencl')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this function should be called right after importing arrayfire.

---------
Link to PDF describing the algorithm to obtain the surface term.

https://cocalc.com/projects/1b7f404c-87ba-40d0-816c-2eba17466aa8/files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See issue #18 and shorten the URL. Do this at all the places where such long URLs are written.

@amanabt amanabt changed the title 1D wave equation solver. 1D wave equation solver.[WIP] Sep 9, 2017
@amanabt
Copy link
Member

amanabt commented Sep 11, 2017

@Balavarun5 @mchandra
Changing the global variables will make the code very different and reviewing the PR might become more complicated. Should we remove the global variable in a PR following this one?

@Balavarun5 have you already removed the usage of global variables from the code?

@mchandra mchandra merged commit ba250f5 into QuazarTech:master Sep 18, 2017
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

Successfully merging this pull request may close these issues.

3 participants