-
Notifications
You must be signed in to change notification settings - Fork 46
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
Changing mesh coordinate after defining problem #43
Comments
Unfortunately JAX-FEM does not support taking derivatives w.r.t. to mesh coordinates. But this type of problem has a very direct workaround. @xwpken Weipeng, could you share the paper that deals with this kind of problem? You need some trick in reformulating your problem (perhaps a smart definition for deformation gradient F in some alternative reference configuration). |
Thank you so much! Is JAX-FEM cannot take derivatives w.r.t. mesh coordinate because the mesh coordinate cannot be changed after the problem defined? Thank you so much again! |
Hi I tried this before. what I found is that the initial positions are not loaded by jax.numpy but numpy, so if you want to get the autodiff gradients you need to change the loading part to use jax.numpy. I got the gradients and compared with Finite difference method, which is correct. However, I can only confirm this is correct in terms of coding. not sure if this physically represents what you expected(for example if there is any discontinuous step in the solving pipeline). |
Hi @BBBBBbruce , I sincerely appreciate it again! |
Hi, my code is a very messy now... I dont remember which parts I adjusted for that. you can share the error you encountered. I will have a look. also, I think the way you implement set_param is not proper. only update the fe coordinates is not sufficient, for example, you need rerun the codes that computes the dirichlet BC(since your coodinates has been updated, need to see if the same sets of face/nodes have been selected). the way I did is recall the init function in problem. then it should update everything you need. |
Hi, JAX-FEM community,
I have a question about changing mesh coordinates to optimize geometry.
I tried to get a derivative with respect to the initial configuration.
It is my set_params:
Then I defined the problem which is almost similar to the inverse demo in JAX-FEM.
Here is how I set up my differentiation:
My derivative (d_coord) was just zeros, and I could observe that my original coordinate had not changed since the problem was defined. (by observing sol_list[0] in test function) How can I change the original mesh coordinate after defining the problem? If this method does not work, is there any other way to do it?
Thank you for reading!
The text was updated successfully, but these errors were encountered: