UFL with "vertex" scheme not working


264
views
0
7 months ago by
Hello there!

I am trying to use "vertex" scheme to uses nodes as integration point within UFL. I used this options with element and measure and ffc compiles it perfectly fine.

some lines like this within ufl file.

scheme = 'vertex'
element = FiniteElement("Lagrange", tetrahedron, 1, quad_scheme=scheme)
F = u*v*dx(degree=1,rule=scheme)

But when I compile my main code which uses generated header file, I get below error. Any idea what's going wrong here. It works well with "default" scheme without any problem.


-------------------------------------------------------------------------------------------------------------------------------
h-fenics/Poisson.h(5538): error: identifier "FE11_C0_Q4" is undefined
              TF0[iq] = fw0 * FE11_C0_Q4[0][iq][iq];
                              ^

In file included from /gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/main.cpp(24):
/gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/Poisson.h(5539): warning #823: reference is to variable "iq" (declared at line 5533) -- under old for-init scoping rules it would have been variable "iq" (declared at line 5537)
          BF0[iq][iq] += TF0[iq] * FE11_C0_Q4[0][iq][iq];
              ^

In file included from /gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/main.cpp(24):
/gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/Poisson.h(5539): warning #823: reference is to variable "iq" (declared at line 5533) -- under old for-init scoping rules it would have been variable "iq" (declared at line 5537)
          BF0[iq][iq] += TF0[iq] * FE11_C0_Q4[0][iq][iq];
                  ^
In file included from /gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/main.cpp(24):
/gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/Poisson.h(5539): warning #823: reference is to variable "iq" (declared at line 5533) -- under old for-init scoping rules it would have been variable "iq" (declared at line 5537)
          BF0[iq][iq] += TF0[iq] * FE11_C0_Q4[0][iq][iq];
                  ^

In file included from /gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/main.cpp(24):
/gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/Poisson.h(5539): warning #823: reference is to variable "iq" (declared at line 5533) -- under old for-init scoping rules it would have been variable "iq" (declared at line 5537)
          BF0[iq][iq] += TF0[iq] * FE11_C0_Q4[0][iq][iq];
                             ^

In file included from /gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/main.cpp(24):
/gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/Poisson.h(5539): error: identifier "FE11_C0_Q4" is undefined
          BF0[iq][iq] += TF0[iq] * FE11_C0_Q4[0][iq][iq];
                                   ^

In file included from /gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/main.cpp(24):
/gpfs/rr/rrprojects/rrindia/home/sshrivastava/fenics-practice/benchmarks-simple/HPC_benchmark3-3D-linear-thermomech-cube-transient-thetaRule/nxmesh-fenics/Poisson.h(5539): warning #823: reference is to variable "iq" (declared at line 5533) -- under old for-init scoping rules it would have been variable "iq" (declared at line 5537)
          BF0[iq][iq] += TF0[iq] * FE11_C0_Q4[0][iq][iq];
                                                 ^

--------------------------------------------------------------------------------------------------------------------
Community: FEniCS Project

1 Answer


0
7 months ago by
You didn't say what your FEniCS version is. But it could be this issue https://bitbucket.org/fenics-project/ffc/issues/145/uflacs-error-for-vertex-quadrature-scheme. Workaround is described there.
Thanks for your reply Jan. I am using dev version of FEniCS last update on October 2017.

Regarding your workaround suggestion, I tried metadata format (in python it's form_compiler_parameters) for dx measure instead of dx(degree=, scheme=) format with 'representation' option and element = FiniteElement('Lagrange', tetrahedron, 1, quad_scheme='vertex') in mass matrix form ufl file(other form ufl file has default quadrature scheme)

Good thing is that now the main code compiled successfully, but I get this error in runtime. Not sure why input element is different than expected element as per the error message below even though I gave exactly same way as expected.

Expected element: FiniteElement('Lagrange', tetrahedron, 1, quad_scheme='vertex')
Input element:    FiniteElement('Lagrange', tetrahedron, 1)
terminate called after throwing an instance of 'std::runtime_error'
  what():

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to assemble form.
*** Reason:  Wrong type of function space for argument 0.
*** Where:   This error was encountered inside Form.cpp.
*** Process: 0
***
*** DOLFIN version: 2017.2.0.dev0
*** Git changeset:  e9e6bb7e894070780d0d5f755c824fb106905428
*** -------------------------------------------------------------------------

along with below warning while compiling ufl file
"Ignoring precision in integral metadata compiled using quadrature representation. Not implemented."

Tried tensor representation also but I get below exception while compiling ufl file.
"Exception: Representation family tensor is not compatible with this form (try one of ['quadrature', 'tsfc', 'uflacs'])"

One more observation. When I don't use any option in element definition as below in my mass form ufl file, my main code compiles well without any runtime errors but gives strange results.
like this -> element = FiniteElement("Lagrange", tetrahedron, 1)
rather than this -> element = FiniteElement("Lagrange", tetrahedron, 1, quad_scheme=scheme)

I have two ufl files one for mass matrix one for other part of the form. I am not using any option in other ufl file as vertex scheme is not needed there.

The main objective of my trial is to make lumped mass matrix. I tried 'action' on a form and also matrix way of making scaled diagonal mass matrix, bot works well and gives same results. But wanted to verify this with integration level using nodes as integration point to make it diagonal automatically.
written 7 months ago by sandeep shrivastava  
e = FiniteElement("P", triangle, 1)
u = TrialFunction(e)
v = TestFunction(e)
a = u*v*dx(scheme='vertex', metadata={'representation': 'quadrature'})
written 6 months ago by Jan Blechta  
I am still getting the same error.

*** Error:   Unable to assemble form.
*** Reason:  Wrong type of function space for argument 0.
*** Where:   This error was encountered inside Form.cpp.
*** Process: 0
written 6 months ago by sandeep shrivastava  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »