Expression member variable automatic zero default value feature missing

Bug #826678 reported by Gordon Klaus
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
CBC.Solve
Confirmed
Critical
Harish Narayanan

Bug Description

In CBC.Twist: fishy.py and flap.py, I get "RuntimeError: expected a default value to all member variables in the Expression." for the force and magnitude Expressions, respectively. The automatic-zero-default-value feature was a nice one, so I suspect it went away by accident and the bug actually lies in Expression; but I don't really know.

Revision history for this message
Gordon Klaus (gordon-klaus) wrote :

Forgot to mention, I'm using the development versions of FEniCS and CBC.Solve.

Anders Logg (logg)
Changed in cbc.solve:
status: New → Confirmed
importance: Undecided → Critical
assignee: nobody → Harish Narayanan (hnarayanan)
milestone: none → 0.1.0
milestone: 0.1.0 → 1.0
Revision history for this message
Harish Narayanan (hnarayanan) wrote :

There are two problems with changing API here. First is with the Expression class, and that is easily fixed.

The second is, without the VariationalProblem class, how do I specify solver parameters to solve(a == L)? e.g., what does the following translate to?

equation = VariationalProblem(L, a, bcu)
equation.parameters["solver"]["newton_solver"]["absolute_tolerance"] = 1e-12
equation.parameters["solver"]["newton_solver"]["relative_tolerance"] = 1e-16
equation.parameters["solver"]["newton_solver"]["maximum_iterations"] = 100

Revision history for this message
Anders Logg (logg) wrote : Re: [Bug 826678] Re: Expression member variable automatic zero default value feature missing

On Mon, Aug 15, 2011 at 12:32:17PM -0000, Harish Narayanan wrote:
> There are two problems with changing API here. First is with the
> Expression class, and that is easily fixed.
>
> The second is, without the VariationalProblem class, how do I specify
> solver parameters to solve(a == L)? e.g., what does the following
> translate to?
>
> equation = VariationalProblem(L, a, bcu)
> equation.parameters["solver"]["newton_solver"]["absolute_tolerance"] = 1e-12
> equation.parameters["solver"]["newton_solver"]["relative_tolerance"] = 1e-16
> equation.parameters["solver"]["newton_solver"]["maximum_iterations"] = 100

solve(a == L) does not take any parameters.

So we need to use the more "advanced interface" which is

problem = NonlinearVariationalProblem(F, u, bcs)
solver = NonlinearVariationalSolver(problem)
solver.parameters["..."] = ...
solver.parameters["..."] = ...
solver.solve()

--
Anders

Revision history for this message
Harish Narayanan (hnarayanan) wrote :

On 8/15/11 2:45 PM, Anders Logg wrote:
> On Mon, Aug 15, 2011 at 12:32:17PM -0000, Harish Narayanan wrote:
>> There are two problems with changing API here. First is with the
>> Expression class, and that is easily fixed.
>>
>> The second is, without the VariationalProblem class, how do I specify
>> solver parameters to solve(a == L)? e.g., what does the following
>> translate to?
>>
>> equation = VariationalProblem(L, a, bcu)
>> equation.parameters["solver"]["newton_solver"]["absolute_tolerance"] = 1e-12
>> equation.parameters["solver"]["newton_solver"]["relative_tolerance"] = 1e-16
>> equation.parameters["solver"]["newton_solver"]["maximum_iterations"] = 100
>
> solve(a == L) does not take any parameters.
>
> So we need to use the more "advanced interface" which is
>
> problem = NonlinearVariationalProblem(F, u, bcs)
> solver = NonlinearVariationalSolver(problem)
> solver.parameters["..."] = ...
> solver.parameters["..."] = ...
> solver.solve()

Will use this instead then. Thanks!

Harish

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.