Function.fine() method works unexpectedly

Bug #811131 reported by Sergey Alyaev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DOLFIN
Fix Released
High
Marie Rognes

Bug Description

I have slightly modified auto-adaptive Navier-Stokes example.
I wanted to get the desired quantity out and i was advised to use something like:

assemble(w_h.fine()[0]*dss(0))

which does not work with the error message:

print "goal eval fine", assemble(w_h.fine()[0]*dss(0))
TypeError: 'Function' object does not support indexing

while the indexing works well with the original "w_h" which also is an object of the Function class.

I attach the code where the error pops up.

Revision history for this message
Sergey Alyaev (cobxo3bot) wrote :
Revision history for this message
Marie Rognes (meg-simula) wrote : Re: [Bug 811131] [NEW] Function.fine() method works unexpectedly

On 07/15/11 18:24, Sergey Alyaev wrote:
> Public bug reported:
>
> I have slightly modified auto-adaptive Navier-Stokes example.
> I wanted to get the desired quantity out and i was advised to use something like:
>
> assemble(w_h.fine()[0]*dss(0))
>
> which does not work with the error message:
>
> print "goal eval fine", assemble(w_h.fine()[0]*dss(0))
> TypeError: 'Function' object does not support indexing
>
> while the indexing works well with the original "w_h" which also is an
> object of the Function class.
>
> I attach the code where the error pops up.
>
> ** Affects: dolfin
> Importance: Undecided
> Status: New
>

Thanks!

Could you also please attach the mesh and subdomains .xml files used, or
modify the example so that it does not require additional files?

--
Marie

Revision history for this message
Sergey Alyaev (cobxo3bot) wrote :

Sorry,

There was no option to add to files.
Here it is.

Changed in dolfin:
assignee: nobody → Marie Rognes (meg-simula)
importance: Undecided → High
milestone: none → 1.0-rc1
status: New → Confirmed
Changed in dolfin:
status: Confirmed → In Progress
Revision history for this message
Garth Wells (garth-wells) wrote : Re: [Bug 811131] Re: Function.fine() method works unexpectedly

The name of the function Hierarchical::fine should be changed. My first
reaction was that

  u.fine()

should mean 'Hello, are you OK?'

The description of the class Hierarchical doesn't make any reference to
'fineness'. It just describes a straight tree. A 'finest function' is
ambiguous, How can I define this on different meshes or with different
bases?

If Hierarchical is a tree, then an allowable operation would be to
return a vector of leaves (just one leaf for a straight tree). Likewise,
'Hierarchical::coarse' should be 'Hierarchical::root'.

Garth

On 01/09/11 05:10, Marie Rognes wrote:
> ** Changed in: dolfin
> Status: Confirmed => In Progress
>

Revision history for this message
Marie Rognes (meg-simula) wrote :

The original request has now been fixed, try for instance (at the end of demo/auto-adaptive-navier-stokes/python):

# Extract solutions on coarsest and finest mesh:
(u0, p0) = w.coarse().split()
(u1, p1) = w.fine().split()

# Operate on most refined objects:
ds = Measure("ds")[outflow_markers.fine()]
M = assemble(u1[0]*ds(0))

# Examine and extract data from solver
for data in solver.adaptive_data():
    info(data, True)
print data["functional_value"]

Note that the names coarse() and fine() may change at some point soon.

Changed in dolfin:
status: In Progress → Fix Committed
Anders Logg (logg)
Changed in dolfin:
milestone: 1.0-rc1 → 1.0-beta2
Changed in dolfin:
status: Fix Committed → Fix Released
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.