Form fails to compile after bzr pull on trunk
I pulled an update today and I am no longer able to compile my forms. A simple example that was working before the update:
element = FiniteElement(
#Q : Value
q = Coefficient(
u = TrialFunction(
w = TestFunction(
# X-dimension
x = interval.x
a = u*w*x*x*dx
L = grad(q)*w*x*x*dx
The output:
Product can only represent products of scalars.
Traceback (most recent call last):
File "/usr/local/
sys.
File "/usr/local/
ufd = load_ufl_
File "/usr/local/
namespace = execute_
File "/usr/local/
m = __import_
File "/media/
a = u*w*x*x*dx
File "/usr/local/
return _mult(self, o)
File "/usr/local/
p = Product(a, b[ii])
File "/usr/local/
error("Product can only represent products of scalars.")
File "/usr/local/
raise self._exception
ufl.log.
If I remove the coordinate terms:
element = FiniteElement(
#Q : Value
q = Coefficient(
u = TrialFunction(
w = TestFunction(
# X-dimension
x = interval.x
a = u*w*dx
L = grad(q)*w*dx
I get:
Trying to integrate expression of rank 1 with free indices ().
Traceback (most recent call last):
File "/usr/local/
sys.
File "/usr/local/
ufd = load_ufl_
File "/usr/local/
namespace = execute_
File "/usr/local/
m = __import_
File "/media/
L = grad(q)*w*dx
File "/usr/local/
% (integrand.rank(), integrand.
File "/usr/local/
raise self._exception
ufl.log.
How should I massage the form(s)?
Thank you
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Charles
- Solved:
- 2013-02-14
- Last query:
- 2013-02-14
- Last reply:
Charles (rodbourn) said : | #1 |
Adding indices to terms does not appear to work either.
Invalid number of indices (1) for tensor expression of rank 0:
Argument(
Charles (rodbourn) said : | #2 |
And a bit of guessing/checking with hints from errors I found a working solution.
vector = VectorElement(
scalar = FiniteElement(
q = Coefficient(scalar)
u = TrialFunction(
w = TestFunction(
a = inner(u,
L = inner(grad(
Pretty slick that its now checking ranks :)
Martin Sandve Alnæs (martinal) said : | #3 |
I changed 1D vector quantities to have vector shape (1,) instead of being
scalar. This allows more forms to be written dimension independently. This
affects at least grad, vector elements, interval.x, interval.n. You can use
x = interval.x[0] and f.dx(0) to work with scalar quantities.
Martin
Den 14. feb. 2013 23:11 skrev "Charles" <
<email address hidden>> følgende:
> Question #221907 on DOLFIN changed:
> https:/
>
> Status: Open => Solved
>
> Charles confirmed that the question is solved:
> And a bit of guessing/checking with hints from errors I found a working
> solution.
>
>
>
> vector = VectorElement(
> scalar = FiniteElement(
>
> q = Coefficient(scalar)
>
>
> u = TrialFunction(
> w = TestFunction(
>
>
> a = inner(u,
> L = inner(grad(
>
>
> Pretty slick that its now checking ranks :)
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>
Charles (rodbourn) said : | #4 |
Martin,
This is actually something that I needed to do in a few months (support 2,3D), so this is just helping me support that earlier.
Thank you
Charles