You will need to tell the MeshWorker to compute the values with something like

info.cell_selector.add("solution", true, ..., ...);

On Mon, Oct 12, 2020 at 8:18 AM Gregor Pfau <gregor2....@gmail.com> wrote:
>
> Dear Timo,
>
> first of all thank you for your reply and advice.
>
> As you suspected,  info.values[0][0] and info.values[0] are both of size 
> zero. I have tried this with the example given in my previous question, as 
> well as with the original code.
>
> Since the original problem is time dependent, the goal was to get the 
> solution values of the previous timestep at the quadrature points.
> Could it be, that I need to use a different approach, at least for the first 
> time step ?
>
> I have tried get_function_values, but even with the workaround proposed here: 
> https://groups.google.com/g/dealii/c/pjUBPbaZgxg/m/lSPLgiTtAgAJ , I still get 
> the same error.
>
> To be honest, I am not shure how to tackle either apporach.
>
> Thank you very much.
>
> Best regards,
> Gregor
>
>
>
>
>
>
>
>
> Timo Heister schrieb am Samstag, 26. September 2020 um 21:44:05 UTC+2:
>>
>> Hi Gregor,
>>
>> I would suggest that you grab a debugger (inside an IDE like
>> QtCreator, VS Code, etc.) or gdb directly and inspect the types and
>> content of "info", "info.values", and "info.values[0]" in that order
>> to see if they are all valid objects and have a non-zero size. From
>> the error message, it sounds like that this is not the case.
>>
>> Best,
>> Timo
>>
>> On Sat, Sep 26, 2020 at 8:25 AM Gregor Pfau <grego...@gmail.com> wrote:
>> >
>> > 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 dealii+un...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/dealii/74a514ed-87de-4df1-a639-4b93b54c100cn%40googlegroups.com.
>>
>>
>>
>> --
>> Timo Heister
>> http://www.math.clemson.edu/~heister/
>
> --
> 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 dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/dealii/3ca827b3-395d-410f-9730-a21375ab4074n%40googlegroups.com.



-- 
Timo Heister
http://www.math.clemson.edu/~heister/

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAMRj59FmUR65HoFv5EoyHAuch4fTm4ckynP7H4pHW6vheSK%2Bxg%40mail.gmail.com.

Reply via email to