Hi,
I was wondering if there's a way in Fluent to dynamically change the shape of a body throughout the calculation; my final goal is to optimize the shape from an aerodynamic point of view (for instance, minimize the drag). I read something about the "Dynamic Mesh" tool (deforming mesh, in particular), but I'm not sure that's the right way. My idea is to set a number of geometrical constraints (e.g. the width of the body varies from X1 to X2, the length from Y1 to Y2, etc.) via UDFs, and then Fluent automatically identifies the best configuration, without having to remesh everytime.

Use of a deforming mesh is a bad idea especially if you are after something like a drag calculation, since the deformed mesh will not be very good with regards to mesh quality.

What you can do is to write a code that externally calls your meshing software something like ICEM-CFD modifies the geometry and then meshes it and then imports the msh file into FLUENT and then solves it, notes the Cd and then moves to the next configuration in ICEM-CFD.

You can do this by using the internal commands used by ICEM and FLUENT in your code.

Also if you are after shape optimization with drag as the criterion I would recommend the use of structured meshing in ICEM since it adapts well when the geometry is changed with just a click.

Deforming the mesh is an option; for certain classes of problems the unique option (if you have an huge CFD model composed of hundreds millions of cells for instance).
A powerful solution for Fluent users is RBF Morph (www.rbf-morph.com): it allows to set-up a shape modifier directly within the Fluent GUI, and then superimpose as many shape modifiers as desired during the calculation stage without the need of storing new meshes: this means that the baseline mesh is unique but it's enriched with shape deformation information that makes it parametric.

The new upcoming version (1.3) will provide a full control of shape deformation even for transient analyses, with a minimum computation overhead. This means that even FSI on very large models will be possible thanks to the advanced modal approach.

As correctly observed, mesh distortion could be an issue. However keeping the same mesh topology allows to easily compare new results with baseline one. In any case the mesh quality can be checked to define the range of validity of morphed meshes and Radial Basis Functions technology of RBF Morph allows to preserve an high quality even for severe deformations.