Skip to content

Ritz-Method #1086

Answered by JordiManyer
jon21as asked this question in Q&A
Mar 6, 2025 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hi @jon21as ,

I don't have a code example in mind, but you can just use any julia optimiser + gridap's automatic differentiation to do this.

Code your energy as a function of your variable, using Gridap's API. You can then take the gradient of it like we do in most non-linear tutorials.

If you work with regular optimiser libraries, you may need to wrap these such that your energy and gradient functions take in vectors instead of FEFunctions. You can use uh = FEFunction(V,x) and x = get_free_dof_values(uh) to map between vector and FEFunction representations of your unknowns.

There are more complex things being done in the context of Topology Optimisation in one of the tutorials.

Good luck!

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jon21as
Comment options

@JordiManyer
Comment options

Answer selected by jon21as
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants