Dear Deal.II community, 

currently I am trying to solve a nonlinear problem  with Newtons Method 
using MeshWorker.

However during this, I encounter an error while using the public attribute 
value of
MeshWorker::IntegrationInfo.
I get a segmentation fault, whenever I call it. (A concrete example will be 
given)

My current code is heavily based on Step-12( Version 9.1.1).  To exclude as 
many errors as possible, as an experiment I decided to modify Step-12 and 
see, wether I could reprodue the error. It turns out I can. 

The modification of Step-12 is just three lines of code added in 
integrate_cell_term, where values is called analogously to Step-39 (version 
9.1.1). 

template <int dim>
void AdvectionProblem<dim>::integrate_cell_term(DoFInfo & dinfo,
                                                  CellInfo &info)
  {
    const FEValuesBase<dim> &  fe_values    = info.fe_values();
    FullMatrix<double> &       local_matrix = dinfo.matrix(0).matrix;
    const std::vector<double> &JxW          = fe_values.get_JxW_values();

    std::cout << "Checkpoint1" << std::endl;
    const std::vector<double> &uh           = info.values[0][0];
    std::cout << "Checkpoint2" << std::endl;

    for (unsigned int point = 0; point < fe_values.n_quadrature_points; 
++point)
      {
        const Tensor<1, dim> beta_at_q_point =
          beta(fe_values.quadrature_point(point));

        for (unsigned int i = 0; i < fe_values.dofs_per_cell; ++i)
          for (unsigned int j = 0; j < fe_values.dofs_per_cell; ++j)
            local_matrix(i, j) += -beta_at_q_point *                //
                                  fe_values.shape_grad(i, point) *  //
                                  fe_values.shape_value(j, point) * //
                                  JxW[point];
      }
  }



Usually the compiler just shuld give me a warning, that uh is an unused 
variable, but the program itself should run smoothly.
However when I run the program, I get the following message:

Checkpoint1Checkpoint1
Checkpoint1
CMakeFiles/run.dir/build.make:57: recipe for target 'CMakeFiles/run' failed
make[3]: *** [CMakeFiles/run] Segmentation fault (core dumped)
CMakeFiles/Makefile2:131: recipe for target 'CMakeFiles/run.dir/all' failed
make[2]: *** [CMakeFiles/run.dir/all] Error 2
CMakeFiles/Makefile2:138: recipe for target 'CMakeFiles/run.dir/rule' failed
make[1]: *** [CMakeFiles/run.dir/rule] Error 2
Makefile:144: recipe for target 'run' failed
make: *** [run] Error 2

Double checking this with gdb I get the following: 

Thread 3 "step-12" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe0553700 (LWP 2417)]
0x00005555556864d2 in std::vector<std::vector<double, 
std::allocator<double> >, std::allocator<std::vector<double, 
std::allocator<double> > > >::operator[] (
    this=0x0, __n=0) at /usr/include/c++/7/bits/stl_vector.h:798
798        return *(this->_M_impl._M_start + __n);

when trying to run the program beyond 
const std::vector<double> &uh           = info.values[0][0]

In both cases the program was run in debug-mode.

I feel it helps with identifying the problem, that Step-39 runs perfectly 
smooth on my computer.

I hope this is enough information to find the error in my approach. 

Thank you very much. 

Best regards, 
Gregor 

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/74a514ed-87de-4df1-a639-4b93b54c100cn%40googlegroups.com.

Reply via email to