llnl / llnl/letop

UnboundLocalError & non-iterate problems

Open
#28 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
22
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Hello, I think your program is perfect, and the visualizing results are so great.
However, I encountered some problems when I implement your program.

Running the cantilever.py may cause an error just like this:

UnboundLocalError: local variable 'output_phi' referenced before assignment.
-------------------------------------------------------------------------------
which is in letop/optimization/interface.py according to the error above.
Well, if I set output_phi=0 (any value) at first. There won't occur this error.

But it won't iterate anymore. It just shows:

Warning, merit function did not decrease (merit=55.37948162421951, new_merit=55.37948162421951)-> Trial 1
Time stepping of Hamilton Jacobi failed. Reason: 0
Linear firedrake_1_ solve converged due to CONVERGED_ITS iteration 1
new_J=15.587277790787676, newC=[2.e-05]
merit=55.37948162421951, new_merit=55.37948162421951
Warning, merit function did not decrease (merit=55.37948162421951, new_merit=55.37948162421951)-> Trial 2
Time stepping of Hamilton Jacobi failed. Reason: 0
Linear firedrake_1_ solve converged due to CONVERGED_ITS iteration 1
new_J=15.587277790787676, newC=[2.e-05]
merit=55.37948162421951, new_merit=55.37948162421951
.........
Warning, merit function did not decrease (merit=55.37948162421951, new_merit=55.37948162421951)-> Trial 10
Time stepping of Hamilton Jacobi failed. Reason: 0
Linear firedrake_1_ solve converged due to CONVERGED_ITS iteration 1
new_J=15.587277790787676, newC=[2.e-05]
merit=55.37948162421951, new_merit=55.37948162421951

I don't know how to solve the problem of not iterating, maybe setting the output_phi=0 is wrong at the beginning.
I’d be grateful for your reply.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with cantilever.py and the output_phi control flow in letop/optimization/interface.py; reproduce the UnboundLocalError before changing initialization. Then investigate why the reported merit remains unchanged and Hamilton-Jacobi stepping fails, and verify that the example completes iterations without the warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.