-
Notifications
You must be signed in to change notification settings - Fork 330
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
Incorporate make_constraints into trapping_sr3.py #436
Comments
As an addition, the constraints made by example 8's |
@Jacob-Stevens-Haas there is a small error in the constraints -- but I think we fixed this on @MPeng5 's trapping branch of the pysindy code and have been meaning to start a pull request to get that and some new stuff added. However, we think this was for dimension > 3 systems and it left the trapping example 8 virtually unchanged (and working a bit better fortunately!). For the example above, there is no error I believe. It looks incorrect because you are not using the custom ordered polynomial that we use in the trapping method. This was a stupid thing that I implemented the constraints in this way, but basically it is expecting a Polynomial Library (a custom library of polynomial terms) that looks like [x, y, xy, x^2, y^2]. Then the constraints are correct: For instance, the first row is saying the x^2 term should vanish in the 1st equation for x_dot (assuming I'm reading that off correctly), second constraint says the y^2 term should vanish in the equation for y_dot, third constraint says xy term in y_dot must match the y^2 term in x_dot, and fourth constraint says xy term in x_dot must match the x^2 term in y_dot. These are all correct with the reordered library! For the energy, it is just E = 0.5 * u^2 and plug in Equation (2) and use the orthogonality of the spatial modes and integrate over the volume to get K = 0.5 a^2 as the total time dependent part of the energy in the fluid. Now we are interested dK/dt = a * a_dot and we do not assume dK/dt = 0. We assume a-priori that the dynamics have vanishing cubic contributions to dK/dt, i.e. dK/dt = C_ia_i + L_{ij}a_ia_j + Q_{ijk}a_ia_ja_k, and only the last term that is cubic vanishes. |
Ohhh, that makes sense if the terms are flattened in fortran order/interspersed, like if
I can follow that derivation, but I guess I'm unsure why for PDEs we use I obviously have been trying to use trapping recently, and I made a PR to clean up the code and reduce the number of lines so it was clearer what was the methods did. I don't think there are significant conflicts in functionality with @MPeng5's branch, but there are some cases where I refactored a function to be clearer while y'all expanded the functionality in a way that's algorithmically compatible but would show up as a git conflict. Example: yous, mine, master. It's tricky to tell because the "compare branches" doesn't show the git conflicts, and because there might be more issues if @MPeng5 or you have commits more recent than the August 17 one on git. For instance, it doesn't show that the I'm not at all wedded to my code, but I would like to be able to develop and work on trapping asynchronously. My spidey sense is that this will be a difficult PR and we should start working through any structural changes sooner rather than later. Could you guys at least push your most recent commits so that I can see what you're working on? |
Sorry it took me a while to get to this. Remember that "u" here is the fluid velocity, not the fluid position, so there is no need to have u_dot there. The kinetic energy in the fluid is just |
@Jacob-Stevens-Haas I did push my latest version a few days ago but I did not make structural change at all -- just played with those examples you have already seen a bit more for paper revisions. But can you share some of the major conflicts you have now? We can actually meet on campus if you are available this or next week to talk about this so that you can show me directly. |
🤦♂️ Of course. That makes sense. Hey @MPeng5 , thanks for following up! I'd love to talk about this but I'm not on campus (in London until April). We'll have to Zoom, if that's OK? What's your email?
Yeah, it seems simple enough. New tensor, PT, that appears to use the same checks as PQ.
Firstly, my edits to Broadly, the conflicts between
It might also help to merge |
@MPeng5 why don't you also open a PR for |
@Jacob-Stevens-Haas Of course! Totally forgot Nathan brought a bunch of people to London and you are one of them. Let's try to meet next week on zoom and my email is maipeng@uw.edu. |
Problem
TrappingSR3
requires the user to provide the constraints on quadratic terms in order to work according to the results in the paper, "Promoting Global Stability in Data-Driven Models of Quadratic Nonlinear Dynamics". The constraints are equation 4/5 in the paper. The example notebook 8 has the functionmake_constraints()
, but It looks like it lines up the constraints wronglyExample:
I took the code from cell 2 of here and adapted it here, but I'm working to simplify the indexing variables involved so it's easier to read. I don't quite get how the indexes of$Q_{ijk}$ line up with the constraint matrix indexes for a
PolynomialLibrary
. Since example 8 isn't tested, I want to make sure that this is working before I bring it into the package. To wit:produces:
Additional context
I also don't quite understand how equation 4 is derived in the paper. @akaptano , it looks like equation 4 represents$$1/2\frac{d( a^2)}{dt} = a\dot a =0.$$ Since the section discusses conservation of energy, I was thought it would be $$1/2\frac{d(\dot a^2)}{dt} = \dot a \ddot a = 0$$ ?
The text was updated successfully, but these errors were encountered: