Comment 6 for bug 1083720

Revision history for this message
Johan Hake (johan-hake) wrote : Re: [Bug 1083720] [NEW] replace() fails if the new function spaces have a different mesh

On 11/27/2012 09:04 PM, Martin Sandve Alnæs wrote:
> The form data is not carried over to the new form returned by replace, so
> no...

:)

It actually looks like it is replace or compute_form_data that is not
doing its job. If you add the following lines:

form_data = F_fine.compute_form_data()

print [V_fine == func.function_space() for func in
form_data.original_arguments]
print [V == func.function_space() for func in form_data.original_arguments]

after:
F_fine = replace(F, {u:u_fine, v:v_fine})

you see that it is still the original functionspace that is used.

Johan

> Den 27. nov. 2012 20:00 skrev "Johan Hake" <email address hidden>
> følgende:
>
>> On 11/27/2012 07:31 PM, Martin Sandve Alnæs wrote:
>>> Probably a caching issue somewhere in the PyDolfin layer.
>>
>> Isn't it always somewhere in the PyDolfin layer :)
>>
>>> The form sigature is unaffected by the mesh.
>>
>> Could it be that it is the formdata that need to be recomputed?
>>
>> Johan
>>
>>> Den 27. nov. 2012 19:15 skrev "Simon Funke" <email address hidden>
>>> følgende:
>>>
>>>> Public bug reported:
>>>>
>>>> I submit this bug report following Marie's suggestions on the related
>>>> DOLFIN question (https://answers.launchpad.net/dolfin/+question/215120)
>>>>
>>>> DOLFIN crashes in the solve() routine after using replace() to replace
>>>> the function spaces of a form.
>>>>
>>>> While the solve succeeds if replaced function spaces have:
>>>> - a different polynomial degree or
>>>> - a different polynomial degree and a different mesh,
>>>> it does not work if the new function spaces is based on a new mesh only.
>>>>
>>>> This is the error message I get:
>>>> ***
>>>>
>> -------------------------------------------------------------------------
>>>> *** Error: Unable to define linear variational problem a(u, v) = L(v)
>> for
>>>> all v.
>>>> *** Reason: Expecting the solution variable u to be a member of the
>> trial
>>>> space.
>>>> *** Where: This error was encountered inside
>> LinearVariationalProblem.cpp.
>>>> ***
>>>> ------------------------------------------------------------------------
>>>>
>>>> The attached file demonstrates the problem.
>>>>
>>>> ** Affects: dolfin
>>>> Importance: Undecided
>>>> Status: New
>>>>
>>>> ** Attachment added: "poisson.py"
>>>>
>>>>
>> https://bugs.launchpad.net/bugs/1083720/+attachment/3445290/+files/poisson.py
>>>>
>>>> --
>>>> You received this bug notification because you are a member of DOLFIN
>>>> Core Team, which is subscribed to DOLFIN.
>>>> https://bugs.launchpad.net/bugs/1083720
>>>>
>>>> Title:
>>>> replace() fails if the new function spaces have a different mesh
>>>>
>>>> Status in DOLFIN:
>>>> New
>>>>
>>>> Bug description:
>>>> I submit this bug report following Marie's suggestions on the related
>>>> DOLFIN question
>>>> (https://answers.launchpad.net/dolfin/+question/215120)
>>>>
>>>> DOLFIN crashes in the solve() routine after using replace() to replace
>>>> the function spaces of a form.
>>>>
>>>> While the solve succeeds if replaced function spaces have:
>>>> - a different polynomial degree or
>>>> - a different polynomial degree and a different mesh,
>>>> it does not work if the new function spaces is based on a new mesh
>> only.
>>>>
>>>> This is the error message I get:
>>>> ***
>>>>
>> -------------------------------------------------------------------------
>>>> *** Error: Unable to define linear variational problem a(u, v) = L(v)
>>>> for all v.
>>>> *** Reason: Expecting the solution variable u to be a member of the
>>>> trial space.
>>>> *** Where: This error was encountered inside
>>>> LinearVariationalProblem.cpp.
>>>> ***
>>>> ------------------------------------------------------------------------
>>>>
>>>> The attached file demonstrates the problem.
>>>>
>>>> To manage notifications about this bug go to:
>>>> https://bugs.launchpad.net/dolfin/+bug/1083720/+subscriptions
>>>>
>>>
>>
>> --
>> You received this bug notification because you are a member of DOLFIN
>> Core Team, which is subscribed to DOLFIN.
>> https://bugs.launchpad.net/bugs/1083720
>>
>> Title:
>> replace() fails if the new function spaces have a different mesh
>>
>> Status in DOLFIN:
>> New
>>
>> Bug description:
>> I submit this bug report following Marie's suggestions on the related
>> DOLFIN question
>> (https://answers.launchpad.net/dolfin/+question/215120)
>>
>> DOLFIN crashes in the solve() routine after using replace() to replace
>> the function spaces of a form.
>>
>> While the solve succeeds if replaced function spaces have:
>> - a different polynomial degree or
>> - a different polynomial degree and a different mesh,
>> it does not work if the new function spaces is based on a new mesh only.
>>
>> This is the error message I get:
>> ***
>> -------------------------------------------------------------------------
>> *** Error: Unable to define linear variational problem a(u, v) = L(v)
>> for all v.
>> *** Reason: Expecting the solution variable u to be a member of the
>> trial space.
>> *** Where: This error was encountered inside
>> LinearVariationalProblem.cpp.
>> ***
>> ------------------------------------------------------------------------
>>
>> The attached file demonstrates the problem.
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/dolfin/+bug/1083720/+subscriptions
>>
>