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

simplified interface #20

Open
rveltz opened this issue Sep 30, 2021 · 5 comments
Open

simplified interface #20

rveltz opened this issue Sep 30, 2021 · 5 comments

Comments

@rveltz
Copy link

rveltz commented Sep 30, 2021

Hi,

I am really interested in using your package for solving McKean-Vlasov equations describing the distribution of mean field of particles. All examples I have in mind are like (say in 2d), x=(x1, x2)

$$\partial_tp = \partial_{x1}(F_1(x,p)p) + \partial_{x2}(F_2(x,p)p) + \Delta p$$

For example F_1(x,p) = x1^2 + sum(lambda(x), p)

Let us skip the p dependency on the vector field for now.

However, I find there is quite some boilerplate to implement in order to use your package.

  1. Would it be possible to borrow the definition of the problem like in Gridap? I understand if this is aking for too much ;)

Most, if not all, your examples are nonlinear reaction diffusion equations like

du/dt = ∇(c(x,u) + d(x,u) ∇ NL(x,u)) + f(x, u)

  1. Could you not define a struct asking for the functions c,d,NL,f, the discretization (like upwind or other), the boundary conditions and return a problem that implement the discretization. Even if this is a subset of what your package can handle, I'd say it would be helpful.

That you for your valuable tool

@j-fu
Copy link
Owner

j-fu commented Sep 30, 2021

Hi,

thanks for asking. Indeed for a Gridap like interface, besides the effort needed I see a difference in approaches - weak formulation based vs. interaction between REVs.

However concerning your second point, your request comes in handy - I plan to have a discussion at our institute in the next weeks to define such an API (which might alternatively also have GradientRobustMultiphysics.jl as a backend @chmerdon ). So I am interested in your view regarding this. The difficulty lies in proper upwinding/stabilization, however I think it is worth to find at least some heuristics for this.

In addition I think that all constitutive functions could be like c(x,u,lambda) where lambda is a vector of parameters,
and I intend to provide AD based \partial u /\partial \lambda as input to path-following, e.g. to be able to interface with BifurcationKit :-)

@rveltz
Copy link
Author

rveltz commented Oct 14, 2021

In addition I think that all constitutive functions could be like c(x,u,lambda) where lambda is a vector of parameters,
and I intend to provide AD based \partial u /\partial \lambda as input to path-following, e.g. to be able to interface with BifurcationKit :-)

Exact, I had forgotten this! Thanks

@rveltz
Copy link
Author

rveltz commented Nov 6, 2021

Hi,

Did you progress on this by any chance?

@j-fu
Copy link
Owner

j-fu commented Nov 6, 2021

Not really, was just adsorbed by graphics stuff...

But I took a couple of hours now to figure out some possibilities.

How would you find something like this?

    X=0:1.0/n:1
    grid=VoronoiFVM.Grid(X,X)

    flux(u,edge)= u[1,1]-u[1,2]
    reaction(u,node)=  u[1,1]^3-10

    bc=[
        DirichletBC(species=1,boundary=1,value=0),
        DirichletBC(species=1,boundary=3,value=1),
    ]
    
    sys=system(grid; num_species=1,flux=flux,reaction=reaction,bc=bc)
    solution=solve(sys; verbose=true, damp_initial=0.01)

This can be implemented entirely on top of what's existing now, and seemingly without a performance hit.
It also fits better to the functional logic of Pluto reactivity.
This however would have to mature, be tested on a number of realistic applications and discussed with colleagues.

And yeah, would be nice to get this BifurcationKit compatible at once. Really would love to try to deliver automatic differentiation with respect to the bifurcation parameter if you have use for this & time permits.

@rveltz
Copy link
Author

rveltz commented Nov 7, 2021

But I took a couple of hours now to figure out some possibilities.

Wow, thank you!

How would you find something like this?

You "improved" the specification of BC et solve?

This however would have to mature, be tested on a number of realistic applications and discussed with colleagues.

Yeah, the way I do it is just try and improve. Basically make it work, make it fast enough and improve the API.

And yeah, would be nice to get this BifurcationKit compatible at once. Really would love to try to deliver automatic differentiation with respect to the bifurcation parameter if you have use for this & time permits.

Me too. Should not be too hard one the jacobian is exposed. We could make a little package for it like I did for Gridap

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