> I calculated the eigenvalues and the condition number. It seems that
> it is ok to collapse one vertex and transform the quad into a
> triangle.
>
> Interestingly, applying the constraints with AffineConstraint does not
> change the condition number. Even if I fix all the dofs with
> add_line() the condition number doesn't change.
Yes. Adding constraints is the same as adding information, which can only make
the condition number better. (Not a scientific answer, but intuitively true
anyway.)
> I collapsed one vertex in a 3D simulation with NedelecSZ and the
> solution and the condition number are ok. I have to do more tests with
> NelelecSZ.
>
> In the simple simulation from step-6. I collapse one vertex and then
> if I move another vertex and transform the quad into a line the
> surface becomes very small and the condition number becomes very
> large. Note that I didn't completely squeeze the quad into a line. If
> the surface is zero, then as expected the simulation breaks.
That's correct too -- if you just squeeze an element but not completely
collapse + add constraints, then that's equivalent to a mesh with a poorly
shaped cell. Since the condition number of the matrix involves the ratio of
the largest to the smallest eigenvalue of the Jacobian of the mapping on each
cell, you end up with a large condition number if you have poorly shaped
cells. This happens here:
> -Collapse vertex a, almost collapse vertex b
> * surface_ratio = 1e-8
> * eigenvalues = [ 6.66667000e-01 6.66667000e-01 6.66667000e-01
> 6.66667000e-01
> 1.21307648e+00 1.33333000e+00 1.33333000e+00 1.33333000e+00
> 1.33333000e+00 1.33333000e+00 1.33333000e+00 1.33333000e+00
> 1.33333000e+00 1.33333000e+00 1.35897000e+00 1.66666000e+00
> 1.69231000e+00 8.83186491e+00 1.10689839e+01 1.37682911e+01
> 1.98164659e+01 2.84090528e+01 4.79480606e+01 2.92923117e+05
> 1.70718688e+06]
> * condition_number = 3e+06
For this poorly shaped cell, you can compute the eigenvalues of the Jacobian
of the mapping, if you want. You'll find that they behave roughly like Delta x
and Delta y, respectively, and for your mesh, these are very different.