OpenCMISS / iron

Source code repository for OpenCMISS-Iron
9 stars 62 forks source link

problem.solve() error for linear fitting #182

Open aliikhsanul opened 5 years ago

aliikhsanul commented 5 years ago

I try to modify the linear fitting example from: https://github.com/OpenCMISS-Examples/examples/tree/v1.0/Fitting/CubeToSphere

So, in short, I am now able to fit the cube to the surface data. The script also allow for multiple fitting iteration but works only with “generatedMesh” and fixed “tau” and “kappa” parameter.

However, the error emerge when I try to do fitting from the previous data (exelem and exnode file). So far, the error is only during execution of “problem.Solve()” (line 588) command.

Here are the steps I have done:

  1. For 1st iteration, I run the python script within python virtual environment: python test.py
  2. For the 2nd iteration, I modify some lines in the code: a. Line 127. Change “iteration” from 1 to 2. b. Line 137. Change “tau” parameter to 0.1

Right after that steps, I got the following error message:

(oclibs_venv_py27_release) cml@CML-LINUX:~/Documents/Code/Github-repo/OpenCMISS/opencmiss/examples_Ali/CubeToSphere2/Python$ python test.py Number of data points: 2000 Projecting data points onto geometric field Projection complete Solving fitting problem, iteration: 1 Solver: Solver index = 1 Solver pre-solve: Solver equations solve:

WARNING: Zero Determinant for matrix A.

I have been searching problem to the source code, but I couldn’t find it yet. Anybody understand how to solve this?

Here I attach the test.py script file.

test.py.zip

sgenie68 commented 5 years ago

Hi,

In line 132 should it read:

exelem = exfile.Exelem("DeformedGeometry" + str(iteration-1) + ".part0.exelem")

??

Cheers, Gene

aliikhsanul commented 5 years ago

Yes, I thought it should be that way. I tried line 130:

exelem = exfile.Exelem("DeformedGeometry" + str(iteration-1) + ".part0.exelem")

but unfortunately, the error warning stays the same, "zero determinant for matrix A".

However, if I try this one, by the end of the calculation, it converges. I don't know whether or not the warning ("zero determinant matrix") has some implications to the result.

aliikhsanul commented 5 years ago

I have just tried the DIRECT solver instead, and the warning ("zero determinant matrix) is not there anymore. I think that warning happens only for ITERATIVE solver.

sgenie68 commented 5 years ago

Copy that, I will check the code and see what might be affected there