Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CGLinearSolver does not converge anymore #539

Closed
jnbrunet opened this issue Dec 7, 2017 · 5 comments
Closed

CGLinearSolver does not converge anymore #539

jnbrunet opened this issue Dec 7, 2017 · 5 comments
Labels
issue: bug (major) Critical bug affecting everyone: not working, performances or accuracy degraded
Milestone

Comments

@jnbrunet
Copy link
Contributor

jnbrunet commented Dec 7, 2017

This bug seems to have been introduced by 0ae8f64

To reproduce the bug, the following scene should normally converge.

<?xml version="1.0"?>
<Node dt="1">
    <StaticSolver />
	<CGLinearSolver name="CGLinearSolver"  printLog="1"  iterations="250"  tolerance="1e-08"  threshold="1e-08" />
	<RegularGridTopology name="grid"  n="3 3 25"  min="0 0 0"  max="15 15 180"  p0="0 0 0" />
	<MechanicalObject template="Vec3d" name="dof" src="@grid" showObject="1"  showObjectScale="5" />
	<HexahedronSetTopologyContainer  src="@grid" />
	<HexahedronSetGeometryAlgorithms />
	<HexahedronFEMForceField template="Vec3d" method="small"  poissonRatio="0.45"  youngModulus="1.51665" />
	<BoxROI name="fixedROI"  box="0 0 -3.75 15 15 3.75" drawBoxes="1" />
	<FixedConstraint indices="@fixedROI.indices" />
	<BoxROI name="forceROI"  box="0 0 176.25 15 15 183.75" drawBoxes="1" />
	<LinearForceField points="@forceROI.indices"  times="0 1"  forces="0 0 0 0 -0.00166667 0" />
</Node>

Suggested labels:

@jnbrunet jnbrunet added the issue: bug (major) Critical bug affecting everyone: not working, performances or accuracy degraded label Dec 7, 2017
@hugtalbot
Copy link
Contributor

hugtalbot commented Dec 13, 2017

Hi @jnbrunet
The scene looks really bad constructed:

  • the gravity is set implicitely to 9.81 in y direction
  • no mass (therefore nan in output)
  • and physically a very low stiffness of your material

I wrote this instead:

<?xml version="1.0"?>
<Node dt="1">
    <StaticSolver />
    <CGLinearSolver name="CGLinearSolver"  printLog="1"  iterations="2500"  tolerance="1e-08"  threshold="1e-08" />
    <RegularGridTopology name="grid"  n="3 3 25"  min="0 0 0"  max="15 15 180"  p0="0 0 0" />
    <MechanicalObject template="Vec3d" name="dof" src="@grid" showObject="1"  showObjectScale="5" />
    <HexahedronSetTopologyContainer  src="@grid" />
    <HexahedronSetGeometryAlgorithms />
    <HexahedronFEMForceField template="Vec3d" method="small"  poissonRatio="0.45"  youngModulus="1.5e5" />
    <BoxROI name="fixedROI"  box="0 0 -3.75 15 15 3.75" drawBoxes="1" />
    <FixedConstraint indices="@fixedROI.indices" />
    <BoxROI name="forceROI"  box="0 0 176.25 15 15 183.75" drawBoxes="1" />
    <LinearForceField points="@forceROI.indices"  times="0 1"  forces="0 0 0 0 -0.00166667 0" />
    <UniformMass mass="1" />
</Node>

I just added a mass and modified the stiffness value.
Can you give it a try ?

@damienmarchal
Copy link
Contributor

Is there any progress here ?

@damienmarchal damienmarchal added this to the v17.12 milestone Dec 20, 2017
@damienmarchal
Copy link
Contributor

damienmarchal commented Dec 27, 2017

Hi all, it appears that PR #521 breaks several scenes.
I'm fixing that in PR: #548

In some of the problematic scenes the mechanical object does not have a mass so it was simply fixed by adding one.

For examples/Components/forcefield/TetrahedronDiffusionFEMForceField.scn I'm not sure the zero mass is the cause of the problem.

@hugtalbot any idea ?

Now more fundamentally I'm puzzled by the

if( fabs(den)<f_smallDenominatorThreshold.getValue() && nb_iter > 1 )

As there is a division by 'den' just after the condition so if den == 0 (which seems to happens in several cases) and first iteration then the scene explode with nan-nan everywhere.

A more robust & user friendly approach should be implemented.

@hugtalbot
Copy link
Contributor

I made a specific PR on this #556
Do not hesitate to give it a try.
It should fix the issue but do not hesitate to check the implement twice ;)

@damienmarchal
Copy link
Contributor

This is now fixed & merged. So we can merge the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug (major) Critical bug affecting everyone: not working, performances or accuracy degraded
Projects
None yet
Development

No branches or pull requests

3 participants