-
Notifications
You must be signed in to change notification settings - Fork 2
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
Added two embedded methods #3
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 14 14
Lines 899 955 +56
=========================================
+ Hits 899 955 +56
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This looks quite fine on the technical side ... however looking at your changes I do wonder from the conceptual side : from your implementation of If my interpretation is true, then it would be more generic to add this on the QGenerator level, rather than the RK one. Quick thinking on how to do that :
class QGenerator(object):
// ...
@property
def weightsEmbedded(self):
raise NotImplementedError(f"no embedded weights implemented for {self.__class__.__name__}") but don't impose its overriding in the
if embedded:
out[1] = np.vstack(out[1], self.weightsEmbedded) => no need to check if embedded weights are implemented, we let the default parent method raise the
Then, the embedded order would simply be obtained as And for testing (in test_base or test_convergence), run the tests on all Of course : works only if my first interpretation is true 😅 ... But if yes, then this would not modify a lot your approach, just make it way more generic and avoid differentiating in |
That's a good idea, actually! |
Then there is maybe also a way to add your work on embedded SDC methods in an advanced tutorial 😉 ... |
Of course, idea of later 😅 ! |
Once this is finalized and all RK schemes from pySDC are added, then I'll create the first beta release 0.1.0, cf #6 |
We need the property I followed the steps you suggested, but for some reason the order is only 1 with b = [0, ..., 0, 1]. Don't know why and I don't really have bandwidth for figuring this out right now. Maybe you have an idea how to fix this? |
There is probably not need to implement the embedded Q yet : that was just a hunch on my side, and probably need to be more analyzed before implementing it ... I think it make sense for SDC, but probably not for direct collocation, since the collocation with or without the quadrature update provide the same solution for Lobatto and Radau-Right. So you can probably leave the default non-implemented embedding for Collocation, and juste use if for RK methods for now. PS : there is probably more to it, actually ... see embedded coefficients for Lobatto I to III. In fact, I would even see it as a student project proposal, taking some of the content from this project (generic discontinuous collocation methods), and combining this with generic embedding (and SDC eventually ...) |
Finally, about the |
you may wanna merge main into your branch to avoid the tutorial test error ... the PR will be squashed anyway |
Hum, that's the weirdest error I've ever seen ... nvm, I'll merge to main anyway and we'll solve that after. What about |
Looks fine enough, I'll correct in additional commit later ... Thanks a lot for the work ! |
I added the first two embedded methods to give you a chance to complain before copy-pasting all the others.
The implementation has
b.shape = (2, len(weights))
. Theweights
property will give the first entry, which is the higher order method and the newweightsSecondary
(notice the camel case...) will giveb[1]
.This means you can use embedded methods just like any other, totally ignoring the secondary method.
I test the secondary method by constructing a new RK scheme in the test with the b and order from the secondary method and the rest the same as the primary one.
Any more wishes before I add the rest of the methods?