Вы находитесь на странице: 1из 9

How should I decide which mesh to use in ansys?

Vikrant Srivastava

Vikrant Srivastava, M.Sc.;FEM, CFD and CAD; RWTH Aachen University

Updated Nov 24 2017 · Upvoted by Sparsh Ganju, Ph. D. Mechanical Engineering, University of
Kentucky (2022) and Pericles Farmakis, M.Sc. Computational Fluid Dynamics & Mechanical
Engineering, Cranfield University (2018) · Author has 398 answers and 5.2m answer views

Answer:

As a mentor once told me — proper meshing is 75% of the simulation. The rest is boundary
conditions.

So, to first answer your question — No. You cannot depend on automatic meshing. Not in Ansys,
not in Abaqus, not in Hypermesh, and not in any other software. To understand which mesh to
use, you need to first understand meshing itself. (The OP of the question might know much of it
already, but others might not, so bear with me. It might even act as a useful reminder.)

TL;DR

The purpose of automatic meshing is to give you the simplest possible solutions to the simplest
possible geometries.

Hence, you need to depend on actual experimentation values and perform mesh studies. If the
results don’t vary a lot upon decreasing the size of the mesh, the mesh is good enough.

The Story of the Mesh


Let’s start with the most basic of questions — what is a mesh?

In layman speak, meshing is simply a way to show a big body as the sum of smaller bodies.

That is it.

You take many small bodies (elements), and join them together to form a bigger one (hence
creating a mesh).

Image (source): A CAD model with overlaying mesh.

Then you apply some loads (thermal, structural, etc.) on one (or more) of these elements, fix
these bodies in certain ways (boundary conditions), settle on some predefined temperature/pre-
stressing if necessary (initial conditions), and then see the results of these applied loads pass on
from one body (element) to the next.

Sounds simple enough, yes?

The problem was not the idea of it. The problem was the mathematics of it all — understanding
how the loads are passed on. A body in real life shows continuous behavior (at a macroscopic
level), and needs the use of integration (continuum mechanics). Though we (humanity, not I
personally) know and understand these equations to a decent level, the problem with solving
them is the time it needs to solve it — the computers of old were way too slow to be able to
solve such integration in a reasonable amount of time (and computers now — millions of times
faster — are no match for these equations), and hence approximations needed to be developed.

And that is what all of FEM is — an approximation. An approximation used to get good enough
results without having to wait weeks/months/decades (depending on the complexity of the
question and the speed of the computer) for an exact answer to be found. An approximation
where a weak form of an equation (the integral form) is changed into the strong form (the
differential form) making the use of some boundary conditions.

Meshing is the essence of how that approximation is achieved.

Great mathematicians worked for decades on figuring out the mathematics behind a simple
question (the cornerstone of FEM) — how to accurately model the loads being transmitted
through a body. The base equation was simple enough:

[F]=[K][X]

where [F] is the applied force (the force matrix), [X] is the result of the force (the unknown), and
[K] is the constant (the stiffness matrix) that relates the applied force to the result it creates
when acting on another body.

Finding the [F] matrix is simple enough — you just need to input the load that you intend to
provide. But making a good enough approximation for [K] to find [X] is where things get tricky.
The simplest way to do this (used by direct solvers) would be to invert the matrix K and multiply
it with F:

[K−1][F]=[X]

As anyone who has tried to invert a 3x3 matrix can tell you, it is not the best part of life. And
then you might have to actually scale it up for accuracy and hence invert a matrix many
thousands or millions of elements long, which is mildly irritating, to say the least. But I wish that
scaling was our only problem. A bigger issue is that the [K] matrix — more often than not —
hates to be inverted. (I mean, I understand. No one wants to be taken off their team and hung
around inverted on the other side. But still, goddammit, you’re a matrix! Behave like one!) This
happens mostly when:

The matrix has a lot of zeros. Why waste time inverting a million zeros after multiplying them by
— you guessed it — zeros?
The matrix is huuuge. Imagine a matrix of order n. To invert it, you need to perform n x n x n
operations (using Gaussian elimination method). Ever heard of memory issues?

Non-linearity. Yes, that’s the most dreaded of all words ever used in mechanical simulations. As
long as the matrix is linear, we know that Newton-Raphson is going to ultimately bail you out.
But in case of non-linearity, not anymore. Be it hyperelasticity, viscoelasticity or just simple
plasticity: if the matrix says no, it means no.

Another way to find this [K] matrix is to use what is called an iterative solver. These solvers work
by first assuming a result ([K][X1]), and then improving upon them ([K][X1],[K][X2],[K][X3]……[K]
[Xn]) till once reaches till a more “accurate” predefined criteria. This is done simply by setting a
criteria for how accurate the results should be, and then subtracting the [K][X1]matrix from the
[F] matrix till the difference is essentially very close to 0.

Regardless of which way is chosen to find a solution, the creation of these equations — the
creation of a mesh — is one of the most essential steps in all of FEM.

Which brings us to the next part in this story:

The Compromise

Mathematicians were ultimately able to find many different approximations (mathematical


models) to get closer to the most accurate result in the shortest amount of time possible. Each
model was suitable for a small subset of problems, but none was good enough for everything at
once. This suitability is defined in many ways, but there are two simple needs that define it all:

Accuracy — Is the answer accurate enough? Does it cover all points of stress generation suitably,
making sure that the product does not fail in real life? Is the shape change/force generation
representative of reality? Does it give results which can be used to make engineering decisions?

Speed — How long do I need to wait for the results? Do I have enough time for reiteration?

Both speed and accuracy are inversely linked to each-other. The higher the speed that you want
the results at, the more you shall need to give up on accuracy. In the initial stages of the field,
the speed of computers was a big problem — you needed excessively long time frames to get
simple answers. As Moore’s law has made simulation faster and faster, this balance between
accuracy and speed has definitely improved. But we are still nowhere close to the ideal situation
— excessively accurate answers in a moment.

Improving Accuracy

As I mentioned above, the accuracy of a FEM solution is inversely proportional to the speed.
Why is that? Simply because of the way a surface is mapped for meshing.

For having the most accurate answer, we must have a continuous flow of the forces from one
point of the system to other. But instead, as said before, the flow of forces happen from element
to element (essentially, node to node) rather than in a continuous flow. The values at the points
between these nodes is then interpolated using some functions (shape functions). This creates
the thumb of rule — the more the number of elements, the more accurate is the result.

Note that this is not always the case, as many factors can stop the solution from being more
accurate — the element shape, the element size, the location of the element, the development
of singularities, or quite simply an ill defined load/boundary condition. Usually, with increasing
number of elements, the results tend to become more precise rather than more accurate. (This
fact gives another simple rule-of-thumb check for the simulation by itself. If the results do not
seem to tend to a common point after increasing the number of elements, you need to either
increase the number of elements even further, or there is usually something wrong with your
setup.)

Look at the image (source) below:

That’s a circular pipe meshed with hex elements. Cool, eh?

As you know, there is no way to capture all the (2D) boundaries of a circle with a square. Same
way, you can not capture the 3D curves of a cylinder with a hexagonal element. The straight
edges of a hex — regardless of how fine you mesh it — can never perfectly fill a circular area.
What is the way out?

A simple way would be to use cylindrical elements. Another way is to use tet-elements, which
would cover the exact geometry better than a hex would. Not all circular boundaries shall be
covered, but it could still provide a better estimate. After all, as I said already, FEM is an
approximation! Also, if you take a bigger number of elements, the chance of getting element
stiffness or locking [which occurs when an element is unable to interpolate a field property
correctly with the nodal values and the element’s shape functions, especially near high values of
incompressibility (i.e. Poisson’s ratio 0.5)] related issues lowers itself, as does the chance of
obtaining singularities.

Image: The more the number of elements (tet elements here), the better the shape is captured.

Of course, using more elements would come at the cost of speed.

So how to increase speed of solving?

Improving Speed

Let me give you the simplest formula again:

Lesser elements=More speed

The increase in the time needed for obtaining a solution is not linear, but exponential. So the
finer the mesh is, the (exponentially) more the time you need to get a good result.

Higher Order Elements: One way to obtain better results with lesser number of elements, is to
simply use elements with higher order. For e.g., second order elements have a middle node in
each area, and hence they deform much more smoothly.

Image: Second order elements deform more smoothly

A second order element has lesser total number of nodes than having multiple first order
elements in the same area, and it would give results of a similar accuracy to what can be
achieved with higher number of nodes in a smaller amount of time.

Image: The same mesh, but with different orders of elements.

The figure above (from Comsol) perfectly describes how higher order elements capture the
shapes much better than lower order, just because they have an additional middle node,
allowing the element deformation in a much more realistic way (the interpolation of values at
the middle point is better.) (Also, notice that the area under high stress keeps getting smaller,
which mimics reality better.).

Remember that this is not always true — e.g., in cases related to contact, a first order element
can perform much better than second order elements would. Also, it is not always better to go
for higher order elements, as it can cause issues with oscillation. But for certain types of analysis
— e.g., bending analysis — a second order element can work wonders!

Mesh refinement: Another way is to have a bigger mesh in most areas where it is already known
that the stress result won’t be too high, and refine the mesh in only a few other locations of
interest. This can drastically reduce the total number of elements in the body, but still give
results usable to make engineering decisions.

Symmetry: Using geometrical symmetry is nearly always a good idea — the results normally are
the same over a geometrically mirrored part, but the number of nodes required can do down by
half, one-fourth, or even more (e.g.; in the case of a circular pipe, even simulation over a couple
of degrees can give the same results as the whole.).

Force Symmetry of Matrix: This is not making use of the geometrical symmetry of the CAD, but
rather forcing the symmetry in a matrix. An advanced option, to be used carefully, but it can
reduce the total matrix size by half.

Mesh Aspect Ratio: Bad aspect ratio combined with high deformation makes for bad results. Try
and obtain a good mesh in areas of non-linearity. Many solvers can also provide a check for such
ratios.

Sparse matrix : This is a more advanced solver option, but a sparse matrix can come in handy
when there are a lot of zeros in the stiffness matrix. This is especially effective in case of a
symmetric matrix!

Reduced Convergence Criteria: Once again, this is a more advanced option, and can lead to
inaccurate results (Dr. Ajay B. Harish has covered this brilliantly in this article on convergence in
FEM.). If your convergence criteria is too strict (and therefore the relative error is too small to be
noticeable) (specially in dynamic analysis) and hence the solver requires a lot of iterations to
reach the convergence threshold, the results can take too long to obtain. You can cut down on
the time required for convergence by eliminating the number of digits carried after decimal, and
hence obtain a faster solution.

Eliminating singularities: Sharp corners always tend to have higher stress concentrations than
round ones. Find such high points and eliminating them before the start of the simulation can
speed up the process substantially. But note that the displacement results at these points can
still be used, if not the stress values (the stress values can be taken from the nodes near the
singularity).

Summary

The purpose of automatic meshing is to give you the simplest possible solutions to the simplest
possible geometries. That means a square plate with a no holes or other surface features. (This,
ideally, should be done with hex meshing. And then too, the results always depend on the mesh
size!) But as soon as any surface irregularities/features are introduced, there is essentially no
way for you to use a hex element (a square peg in a round hole!).

Hence, you need to depend on actual experimentation and perform mesh studies. Ideally, you
should be making a test after every couple of iterations, and after any design change. Practically,
you might need to make more or less. But understand, simulation is not good enough (yet) to
expel all need for actual testing (and humans make assumptions which may be plain wrong). It
just makes the iterative design process much faster.

Parallel to this, the easiest way to know if a mesh is good enough is to perform mesh studies.
Start with as coarse a mesh as possible, and then iteratively refine it. If the results don’t vary a
lot upon decreasing the size of the mesh, and the results match the experimental values, the
mesh is good enough!