Post-processing: how can the method compute_derived_quantities_vector be informed about cell->user_pointer() ?

75 views
Skip to first unread message

Alberto Salvadori

unread,
Aug 18, 2017, 5:16:40 AM8/18/17
to deal.II User Group
Dear all,

I have been studying step-32 and I have found the class Postprocessor nice and effective. 
It is my understanding that the method compute_derived_quantities_vector within the class operates at a call level, i.e. that beyond the hood the class Postprocessor
implements loops over the triangulation. 

I wonder if there is a way to use the cell->user_pointer in the method compute_derived_quantities_vector, i.e. if there is a way to access a reference to the cell itself.

This would be very useful in case of post-processing of data that depend on the history at each Gauss point, which is indeed my case of interest.

Thanks!
Alberto

Jean-Paul Pelteret

unread,
Aug 18, 2017, 6:38:44 AM8/18/17
to deal.II User Group
Dear Alberto,

It looks like one can already do this, although its somewhat obscurely documented. Here's a link to the documentation of the CommonInputs class, wherein you can find a documented example of computing some solution and cell dependent data. It seems to be a relatively new feature (circa 2016) and I didn't know about it, so I'm happy to have found out about it as well!

Regards,
Jean-Paul

Alberto Salvadori

unread,
Aug 18, 2017, 8:30:12 AM8/18/17
to dea...@googlegroups.com
Thank you Jean-Paul.

From the CommonInputs class, I understand that I can retrieve a pointer to the current cell by using this instruction, provided that the right DoFHandler is passed:

current_cell = input_data.template get_cell<hp::DoFHandler<dim> >();

which is indeed what I am looking for. However, I have no clue about the input_data  variable, which is passed to the evaluate_vector_field function in the example that computes the fluid norm of the stress, and how it connects to the Post-process class that is described in step-33, i.e.

template <int dim>
class BoussinesqFlowProblem<dim>::Postprocessor : public DataPostprocessor<dim>
{
public:
Postprocessor (const unsigned int partition,
const double minimal_pressure);
virtual
void
const std::vector<std::vector<Tensor<1,dim> > > &duh,
const std::vector<std::vector<Tensor<2,dim> > > &dduh,
const std::vector<Point<dim> > &normals,
const std::vector<Point<dim> > &evaluation_points,
std::vector<Vector<double> > &computed_quantities) const;
virtual std::vector<std::string> get_names () const;
virtual
std::vector<DataComponentInterpretation::DataComponentInterpretation>
private:
const unsigned int partition;
const double minimal_pressure;
};

Can you perhaps provide some further information, to fill the gap?
Thank you,

Alberto

Alberto Salvadori
 Dipartimento di Ingegneria Civile, Architettura, Territorio, Ambiente e di Matematica (DICATAM)
 Universita` di Brescia, via Branze 43, 25123 Brescia
 Italy
 tel 030 3711239
 fax 030 3711312

e-mail:
 alberto....@unibs.it
web-pages:
 http://m4lab.unibs.it/faculty.html
 http://dicata.ing.unibs.it/salvadori

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Informativa sulla Privacy: http://www.unibs.it/node/8155

Jean-Paul Pelteret

unread,
Aug 18, 2017, 9:08:24 AM8/18/17
to deal.II User Group
Dear Alberto,

From the link in your previous post I presume that you're working with deal.II 8.4.1? The feature that I've referred to was introduced in version 8.5.0. In fact, I see now that the latest version of step-33 has been updated to demonstrate this new functionality. Does that help?

Regards,
Jean-Paul
On Fri, Aug 18, 2017 at 12:38 PM, Jean-Paul Pelteret <> wrote:
Dear Alberto,

It looks like one can already do this, although its somewhat obscurely documented. Here's a link to the documentation of the CommonInputs class, wherein you can find a documented example of computing some solution and cell dependent data. It seems to be a relatively new feature (circa 2016) and I didn't know about it, so I'm happy to have found out about it as well!

Regards,
Jean-Paul

On Friday, August 18, 2017 at 11:16:40 AM UTC+2, Alberto Salvadori wrote:
Dear all,

I have been studying step-32 and I have found the class Postprocessor nice and effective. 
It is my understanding that the method compute_derived_quantities_vector within the class operates at a call level, i.e. that beyond the hood the class Postprocessor
implements loops over the triangulation. 

I wonder if there is a way to use the cell->user_pointer in the method compute_derived_quantities_vector, i.e. if there is a way to access a reference to the cell itself.

This would be very useful in case of post-processing of data that depend on the history at each Gauss point, which is indeed my case of interest.

Thanks!
Alberto

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alberto Salvadori

unread,
Aug 21, 2017, 12:10:15 PM8/21/17
to dea...@googlegroups.com
Thank you Jean-Paul,

this works now pretty well. In fact, I had some problems in installing version 8.5.0 that have been now overcame with Timo's 8.5.1 (see Getting error during cmake configuration step and later during make run. ). I dare to ask another question on exporting tensors for vtk. I understand there is no data component interpretation for tensors (I mean anything like DataComponentInterpretation::component_is_part_of_tensor) and I read that in aspect 1.3 ASPECT 1.3 released. there are "New visualization postprocessors that can output the shear stress and full stress tensors". Is it a dedicated procedure for vtk? 

Of course I can manage by projecting tensors on three orthogonal directions and visualize as vectors, but I find this inelegant. 

Thanks

Alberto



Alberto Salvadori
 Dipartimento di Ingegneria Civile, Architettura, Territorio, Ambiente e di Matematica (DICATAM)
 Universita` di Brescia, via Branze 43, 25123 Brescia
 Italy
 tel 030 3711239
 fax 030 3711312

e-mail:
 alberto....@unibs.it
web-pages:
 http://m4lab.unibs.it/faculty.html
 http://dicata.ing.unibs.it/salvadori

Wolfgang Bangerth

unread,
Aug 21, 2017, 12:12:31 PM8/21/17
to dea...@googlegroups.com
On 08/21/2017 10:10 AM, Alberto Salvadori wrote:
> I understand there is no data component interpretation for tensors (I
> mean anything like
> DataComponentInterpretation::component_is_part_of_tensor) and I read
> that in aspect 1.3 ASPECT 1.3 released.
> <https://groups.google.com/forum/#%21searchin/dealii/output$20tensors%7Csort:relevance/dealii/qoJwnOgg_zE/bKjbgzY66dQJ> there
> are "New visualization postprocessors that can output the shear stress
> and full stress tensors". Is it a dedicated procedure for vtk?

No. The tensors are output as individual scalar components.


> Of course I can manage by projecting tensors on three orthogonal
> directions and visualize as vectors, but I find this inelegant.

That's the way to go, unless you want to implement the
DataComponentInterpretation part as well as support in DataOutBase for
tensor-valued quantities.

Best
W.


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

Jean-Paul Pelteret

unread,
Aug 21, 2017, 12:18:32 PM8/21/17
to deal.II User Group, bang...@colostate.edu

That's the way to go, unless you want to implement the
DataComponentInterpretation part as well as support in DataOutBase for
tensor-valued quantities.

This would be a nice feature to have, and I would definitely support having it included! The only problem is that, last time I checked, Tensor support on Paraview was only possible through one of two plugins. Paraview needs to be built by hand to enable these plugins, which is not so nice :-/ Also when I last tested these plugins they did work but were very computationally intensive, so in my experience it may be better to simply output scalar / vector data.

J-P

Alberto Salvadori

unread,
Aug 21, 2017, 12:25:30 PM8/21/17
to dea...@googlegroups.com, Wolfgang Bangerth
Great, thank you all.I'll think about it and see what I can come up with.

Alberto 

Alberto Salvadori
 Dipartimento di Ingegneria Civile, Architettura, Territorio, Ambiente e di Matematica (DICATAM)
 Universita` di Brescia, via Branze 43, 25123 Brescia
 Italy
 tel 030 3711239
 fax 030 3711312

e-mail:
 alberto....@unibs.it
web-pages:
 http://m4lab.unibs.it/faculty.html
 http://dicata.ing.unibs.it/salvadori

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages