I have a FEniCSx code that solves coupled PDEs. The result of some postprocessing computations depend on the geometry of the mesh, which is 2D by the way. I plan to modify the mesh to study its impact on the solution.

I know about optimizers such as Optuna. What I do not know about is what are common approaches to this problem?

I am thinking to use Gmsh. I can fix 4 points that will not be changed (think of a square), I want to link 2 of those together via straight lines, and similarly with the remaining 2. I am left with a square or rectangle with 2 missing sides, and this is where I plan to modify the mesh. I thought about using Bsplines and possible patched BĂ©zier curves to complete the limits of the mesh. But I am not quite sure what parameters, other than the control points, I should pass to the optimizer. Maybe some score that comes out of an evaluation of the meshing? The less parameters or points, the higher the score.

Ideally I would like the mesh to be smooth (I need to compute a second spatial derivative).

Thanks for sharing any ideas.

This is a pretty open ended question as there are a lot of different optimization approaches. My answer is focused on the gradient based optimization case. Implementation is often a bit simpler for the gradient-free approach, but at the expense of significantly more expensive optimizations for large number of design variables.:

I would suggest looking at the legacy dolfin work done on dolfin-adjoint and itâ€™s associated publications, although this software unfortunately hasnâ€™t been updated to work with dolfinx (yet?).

Remeshing using gmsh between steps is likely going to introduce challenges for computing derivatives between steps (in a gradient based framework). A good place to start with the FEniCSx specific implementation might be this thread. I would also suggest looking at some of the work my colleagues Luca Scotzniovsky and @Ru_Xiang have done with a motor shape optimization problem where they solve a hyper-elasticity subproblem. The paper preprint is here and their work is up on github here.

A resource on Airfoil Shape Optimization. The authors spend a bit of time discussing some of the challenges of differentiable mesh deformation although they donâ€™t solve a specific variational problem to deform the mesh.

2 Likes

Thanks and sorry for my low quality reply (on phone, in a rush). I didnâ€™t know this was an active researxh domain, but I can understand because in general the solution to the PDE can drastically change for minor mesh adjustments. I donâ€™t think my PDEs would be problematic in that regard but I am not 100 percent sure.

I am not worried about gradient method problems as I plan to use a random sampling and.then TPE (tree parzen estimator) of optuna. I would remesh from scratch every meshes rather than remeshing not from scratch. My geometry is 2D and doesnâ€™t contain that many elements, so this part is fast compared to solving the PDE which takes several minutes (I have to use at least a degree 3 FE space).

This is definitely the benefit of gradient-free methods (easier implementation). Broadly speaking gradient based methods require something like 2-3 orders of magnitude less function evaluations, so if the cost of repeated function evaluations is preventing convergence, keep these approaches in the back of your mind.

A diagram might be helpful here, but I think the usage of b-splines or similar is the right approach. At the moment, I canâ€™t think of other parameters that might be important here.

1 Like