XNS Elastic Mesh Update
XNS is primarily used for fluid flow simulations which involve deforming domains. In such cases, the computational mesh needs to adapt to the varying shape of the area or volume taken up by the fluid. For rotating components, such as rotors or impellers, we are using XNS mesh mutation, which involves rather simple deformation followed by regeneration of element connectivity in a small subset of the mesh. For free-surface and other problems, the interior nodes are moved according to a fictitious linear elasticity equations, in order to provide smoothly varying deformation field in the entire domain, and to maintain the quality of the initial mesh.
The newx.F module is responsible for the mesh update; it calls in turn blksldlin.F to compute and assemble the elasticity equation system. More description of the governing equations can be found in the Mesh Update Based on Linear Elasticity (PDF) technote.
Main parameters for the elasticity system is the Poisson ratio λ/μ, controlled with mesh_ratio material property, and the fraction of the Jacobian remaining in the formulation f, controlled with mesh_fraction material property. The smaller the f, the smaller contribution the Jacobian makes to the equation system, and so the small elements become stiffer relative to the large ones. When f = 0, the integral form is in effect divided by the element Jacobians. The smaller the Poisson ratio, the more resistance to shear the material has. The effect of these two parameters are illustrated in the image below. A higher-resolution PDF version is also available.
In this experiment, an initially rectangular mesh is undergoing a given deformation at two boundaries. The preferred combinations of the parameters are circled in red.
Debugging
The first step in mesh deformation usually involves looking at the mxyz.tangled and data.tangled files that are automatically generated whenever any mesh element becomes inverted, i.e., its Jacobian changes sign. This is tested at element corners (iquadck keyword can be used to change the test location to other sets of integration points) at each iteration and reported on standard error; if the inverted element persists until the final iteration, the mesh is assumed to be irreparably messed up, the said files are generated, and XNS stops.
The mxyz.tangled is simply a coordinate file like mxyz, but with the latest known node positions (in this case, mxyz.all and mxyz.out files are not written to). Use moveup off in Pager and other postprocessors to see the elements just before they tangled, and moveup on to see them after tangling. The data.tangled file contains a single floating-point value per element, which is either +1 or -1 according to the Jacobian sign. A typical Pager input snippet that might show the tangled element in red is:
... mxyz mxyz.tangled edata data.tangled moveup off ndf 1 idf 1 dext -1.0 2.0 shade on color on element plot
Note the use of moveup off (or comment out the mxyz line to use the undeformed mesh); when tangled, the element is typically a sliver which is hard to see in the plot.
In order to dig a bit deeper, one can use two XNS debug keywords:
debug mesh bc
The first one (debug mesh, dbmesh internal flag) causes eff0.mesh file to be generated, holding Jacobians of each element. The second one (debug bc, dbbc internal flag) causes mxyz.bc file to be generated (among others), which stores nsd3 degrees of freedom per node. When plotted as nsd vectors, these show which directions of node motion are constrained (arrow) and which are not (no arrow). The local coordinate system rotation is taken here into account. For example, in 2D, the following Pager snippet can be used:
... data mxyz.bc clip off moveup off color on vect_scale 0.02 vect_size 0.02 ndf 4 vector udf 1 vdf 2 plot udf 3 vdf 4 plot
The moveup off is important, since all the nodes at the upper level are constrained (mesh motion does not use space-time discretization). One needs to painfully adjust vect_scale (length of the arrow) and vect_size (size of the arrow head) before anything can be seen. EnSight can also be used to view this kind of data.




