Issue regarding higher order element

28 views
Skip to first unread message

Krishanu Sen

unread,
Jul 16, 2019, 3:08:42 PM7/16/19
to deal.II User Group
I am trying to run a code using higher order elements. The code runs fine when I am using linear [FE_Q<dim>(1)] or quadratic [FE_Q<dim>(2)] elements. But when I tried to use cubic elements [FE_Q<dim>(3)], the code stops with an error "ExcIndexRange", which says that the code is trying to access an index of a tensor that exceeds the limit of the tensor indices. I am not sure why would that happen just because of changing the polynomial degree of the element. I would appreciate any help or insight regarding the issue.

Thanks,
Krishanu

Bruno Turcksin

unread,
Jul 16, 2019, 3:22:13 PM7/16/19
to deal.II User Group
Krishanu,

It's impossible to help you with so little information. Somewhere you set something to the wrong size. Can you give us a backtrace? We need to see the error message and the code that produces it.

Best,

Bruno

Krishanu Sen

unread,
Jul 16, 2019, 4:00:26 PM7/16/19
to deal.II User Group
Hello Bruno,

Here is the error message that I am getting:

--------------------------------------------------------
An error occurred in line <388> of file </g/a-relliott/COMMON/senxx051/dealii_source/dealii_library/include/deal.II/base/tensor.h> in function
    dealii::Tensor<rank, dim, Number>::value_type& dealii::Tensor<rank, dim, Number>::operator[](unsigned int) [with int rank_ = 2; int dim = 3; Number = double; dealii::Tensor<rank, dim, Number>::value_type = dealii::Tensor<1, 3, double>]
The violated condition was:
    i<dim
The name and call sequence of the exception was:
    ExcIndexRange(i, 0, dim)
Additional Information:
Index 3 is not in the half-open range [0,3).

Stacktrace:
-----------
#0  ./nodal_growth_dyn_full: Step8::ElasticProblem<1>::assemble_system_matrix()
#1  ./nodal_growth_dyn_full: Step8::ElasticProblem<1>::run()
#2  ./nodal_growth_dyn_full: main
--------------------------------------------------------

CMakeFiles/run.dir/build.make:57: recipe for target 'CMakeFiles/run' failed
make[3]: *** [CMakeFiles/run] Aborted
CMakeFiles/Makefile2:232: recipe for target 'CMakeFiles/run.dir/all' failed
make[2]: *** [CMakeFiles/run.dir/all] Error 2
CMakeFiles/Makefile2:239: recipe for target 'CMakeFiles/run.dir/rule' failed
make[1]: *** [CMakeFiles/run.dir/rule] Error 2
Makefile:183: recipe for target 'run' failed
make: *** [run] Error 2


I am using deal.ii for a nonlinear elasticity problem. And the change in the code that is causing this error message is:


 template <int dim>
  ElasticProblem<dim>::ElasticProblem ()
    :
    dof_handler (triangulation),
    fe (FE_Q<dim>(3), dim)
  {}


The code runs fine when I am using FE_Q<dim>(2) or FE_Q<dim>(1) instead.

Thanks,
Krishanu

Bruno Turcksin

unread,
Jul 16, 2019, 4:10:40 PM7/16/19
to dea...@googlegroups.com
Krishanu

Le mar. 16 juil. 2019 à 16:00, Krishanu Sen <krishan...@gmail.com> a écrit :
>
> I am using deal.ii for a nonlinear elasticity problem. And the change in the code that is causing this error message is:
>
>
> template <int dim>
> ElasticProblem<dim>::ElasticProblem ()
> :
> dof_handler (triangulation),
> fe (FE_Q<dim>(3), dim)
> {}
No it's not where the error comes from. It is from somewhere in
Step8::ElasticProblem<1>::assemble_system_matrix() You need to find
which line produces the error.

Best,

Bruno

Wolfgang Bangerth

unread,
Jul 18, 2019, 4:42:54 AM7/18/19
to dea...@googlegroups.com
On 7/16/19 2:10 PM, Bruno Turcksin wrote:
> No it's not where the error comes from. It is from somewhere in
> Step8::ElasticProblem<1>::assemble_system_matrix() You need to find
> which line produces the error.

Krishanu,
indeed, Bruno knows this because he is looking at the backtrace shown in the
error message you posted:

#0 ./nodal_growth_dyn_full: Step8::ElasticProblem<1>::assemble_system_matrix()
#1 ./nodal_growth_dyn_full: Step8::ElasticProblem<1>::run()
#2 ./nodal_growth_dyn_full: main

The easiest way to find these errors is to run the program in a debugger. It
will stop in exactly the place where the problem is, and allow you to inspect
all local variables. It's a tool so worth learning how to use! (There are also
video lectures showing how to do that in eclipse.)

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Krishanu Sen

unread,
Jul 18, 2019, 11:10:08 AM7/18/19
to deal.II User Group
Thanks Prof. Bangerth for the suggestion. I will definitely learn about the debugger as it seems like a great tool.

Thanks,
Krishanu

Krishanu Sen

unread,
Jul 18, 2019, 11:11:14 AM7/18/19
to deal.II User Group
Thanks a lot Bruno. I did find the issue following your suggestion!


On Tuesday, 16 July 2019 15:10:40 UTC-5, Bruno Turcksin wrote:
Krishanu
Reply all
Reply to author
Forward
0 new messages