Mpirun performs mesh generation

We do not have a specific ALE module in FEniCSx. As you can observe, moving the mesh given a function can be done as above.

If you want to make a smoothen function, for instance by a Laplace smoothing, this is covered in:

NOTE: In the post above it doesn’t use the perturb_mesh, but assumes a 1-1 relationship between the mesh nodes and dofs. I would recommend adapting the code such that it looks like

def deform_mesh(V, bcs: List[dolfinx.fem.DirichletBCMetaClass]):
    mesh = V.mesh
    uh = dolfinx.fem.Function(V)
    dolfinx.fem.petsc.set_bc(uh.vector, bcs)
    u = ufl.TrialFunction(V)
    v = ufl.TestFunction(V)
    a = ufl.inner(ufl.grad(u), ufl.grad(v))*ufl.dx
    L = ufl.inner(dolfinx.fem.Constant(mesh, (0., 0.)), v)*ufl.dx
    problem = dolfinx.fem.petsc.LinearProblem(a, L, bcs, uh)
    problem.solve()
    perturb_mesh(uh) 
1 Like