gridap / GridapODEs.jl

Time stepping for Gridap
MIT License
33 stars 7 forks source link

Newmark #51

Closed oriolcg closed 3 years ago

oriolcg commented 3 years ago

This is a first implementation of second-order ODEs with the Newmark-beta solver. I followed the approach of defining new structures to handle the needs for 2nd-order operators, instead of trying to extend what we had for first order ODEs.

The basic idea is that we need to store additional temporary variables for the first and second time derivative (denoted as v and a as in velocity and acceleration).

@santiagobadia @fverdugo , please take a look at this PR and let me know if this approach looks good to you.

santiagobadia commented 3 years ago

Thanks @oriolcg for your PR! Great job!

I have proposed some changes. We can discuss it. My main concern is whether we need to replicate code or we could just re-define the objects such that order is a template parameter and we have tuples of N+1 arrays, vectors, trial spaces, etc. It seems quite easy at least conceptually.

Anyway, if you consider it is too much work, we can keep this implementation. We probably agree that if we want higher-order ODEs, this approach is not appropriate, but we won't need them anyway.

There are some other minor comments.

oriolcg commented 3 years ago

Hi @santiagobadia @fverdugo, I modified the approach and refactored the code in such a way that it can handle N-th order ODEs. Basically, I added tuples where needed and generalized as much as possible without compromising too much the current APIs.

The only thing that would need to be modified at the driver level is the way of defining the residuals and jacobians. Instead of res(t,u,ut,v) now is res(t,(u,ut),v). This is needed to generalize the calls for an arbitrary number of time derivatives. This also opens the door to the API that Francesc proposed: res(t,u,v) = m(∂tt(u),v) + c(∂t(u),v) + a(u,v) - b(v,t).

Please, take a look at the latest commit https://github.com/gridap/GridapODEs.jl/pull/51/commits/ea237001a439de07b30e697ab31bd9b218cd8ab0 and let me know if there are further changes that need to be done.

santiagobadia commented 3 years ago

Hi @oriolcg a couple of very minor comments. We could also add an issue for creating the API @fverdugo suggested.

oriolcg commented 3 years ago

Thanks for the comments @santiagobadia. The suggested modifications have been added to https://github.com/gridap/GridapODEs.jl/commit/8e371a3e8be38ed1b2875c75e873e2c0db7c62de.

I'll create a new issue for the API the @fverdugo suggested. Do you want to include it in this PR?

santiagobadia commented 3 years ago

No, we can keep it for later. I accept the PR. Thanks!