Hi Raul,

The “input_data” argument to the evaluate_vector_field() function has a method 
that can be called to retrieve the cell that is currently being processed:
https://dealii.org/developer/doxygen/deal.II/structDataPostprocessorInputs_1_1CommonInputs.html#a2bc88342acd8e41314c8c1328bd98a67
 
<https://dealii.org/developer/doxygen/deal.II/structDataPostprocessorInputs_1_1CommonInputs.html#a2bc88342acd8e41314c8c1328bd98a67>

Since you are defining your own data post processor, you are in control over 
what information from your simulation it has access to. You could therefore 
pass it the necessary data (or data structures) from the calling class in order 
to map the cell (+ evaluation point?) to the constitutive law that could be 
used to evaluate the stress in terms of the strain.

I hope that this helps!

Best,
Jean-Paul

> On 12. Dec 2022, at 16:01, Raúl Aparicio Yuste <rapari...@unizar.es> wrote:
> 
> It is not clear to me how to access an object in the structure 
> “Postprocessor”. The idea is that I compute the solution, but I am also 
> computing secondary variables using the postprocessor structure in this way:
> 
> dealii::DataOut<dim> data_out;
> 
> data_out.attach_dof_handler(dof_handler);
> 
> Postprocessor postprocessor;
> 
> data_out.add_data_vector(solution, postprocessor);
> 
> data_out.build_patches();
> 
> When declaring the postprocessor class, I declare a function 
> evaluate_vector_field where I compute all the secondary variables that are 
> written on a vtk file later:
> 
> void evaluate_vector_field(const 
> dealii::DataPostprocessorInputs::Vector<dim>& input_data, 
> std::vector<dealii::Vector<double>>& computed_quantities) const override;
> 
>                 …..
> 
>     for (int q = 0; q < n_q_points; ++q) {
> 
>         // Displacements
> 
>         computed_quantities[q](0) = input_data.solution_values[q](0);
> 
>         computed_quantities[q](1) = input_data.solution_values[q](1);
> 
>         // Stress
> 
>         computed_quantities[q](2)  = sigma_x
> 
>         computed_quantities[q](3)  = sigma_y
> 
>     }
> 
> These variables are saved on the data_out object, so I use 
> “data_out.write_vtk(output);” and I get them on the vtk file. However, I do 
> not know how to access to these new variables (computed_quantities) from 
> another file different from the one where I declare the functions.
> 
> The function evaluate_vector_field is a virtual function, and it is declared 
> as const override. I do not know how to export the variables 
> computed_quantities or modify them, because it is only allowed to read them 
> since the function is declared as constant. Is there any way to access the 
> structure postprocessor? Something like:
> 
> postprocessor.getVariables(xxxxxxxx)
> 
> Or an example where I can see how to implement it. Thank you very much in 
> advance
> 
> Raul
> 
> 
> -- 
> The deal.II project is located at http://www.dealii.org/ 
> <http://www.dealii.org/>
> For mailing list/forum options, see 
> https://groups.google.com/d/forum/dealii?hl=en 
> <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 
> <mailto:dealii+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/dealii/d9a60280-0181-427b-a372-2eee29ab3257n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/dealii/d9a60280-0181-427b-a372-2eee29ab3257n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/6712C852-25C5-433C-95FF-2610E693B80E%40gmail.com.

Reply via email to