Re: [deal.II] Error while writing material-wise-post-processed quantities using higher order QEulerian Mapping

2020-02-03 Thread Paras Kumar
Dear Wolfgang, 

Thank you so much for your help. The function DataOut::set_cell_selection() 
seems to be quite useful.

Best regards, 
Paras

On Monday, February 3, 2020 at 12:01:39 AM UTC+1, Wolfgang Bangerth wrote:
>
>
> Finally the fix: https://github.com/dealii/dealii/pull/9466 
>
> Paras: Thanks a lot for the excellent testcase! I managed to make it 
> substantially smaller still, but it was a very good starting point to find 
> what is actually happening! I co-credited you with the fix. 
>
> Best 
>   W. 
>
> -- 
>  
> Wolfgang Bangerth  email: bang...@colostate.edu 
>  
> www: http://www.math.colostate.edu/~bangerth/ 
>
>

-- 
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/3826418e-0759-4afd-afed-208a774f4862%40googlegroups.com.


Re: [deal.II] Error while writing material-wise-post-processed quantities using higher order QEulerian Mapping

2020-02-02 Thread Wolfgang Bangerth



Finally the fix: https://github.com/dealii/dealii/pull/9466

Paras: Thanks a lot for the excellent testcase! I managed to make it 
substantially smaller still, but it was a very good starting point to find 
what is actually happening! I co-credited you with the fix.


Best
 W.

--

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

--
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/919566c1-19b8-b942-71ae-ae8e425d55c8%40colostate.edu.


Re: [deal.II] Error while writing material-wise-post-processed quantities using higher order QEulerian Mapping

2020-02-01 Thread Wolfgang Bangerth


> Could someone please help me understand where I go wrong. The error can be 
> easily reproduced by setting /fePolyDegree >1 in the attached MWE.

Paras -- it's a bug in deal.II: The assertion you run into is a bit 
overzealous and flags something that is perfectly legitimate.

I'll fix the actual problem later this weekend, but here is a workaround for 
you: Where you call the build_patches() function, replace
dataOutPrimary.build_patches(qMapping, nSubdivisions);
by
dataOutPrimary.build_patches(qMapping, nSubdivisions,
 DataOut::curved_inner_cells);
and your code should work (doing essentially the same as before -- maybe even 
in a more correct way).

Best
  W.


-- 

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

-- 
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/09d9297d-fc3d-14a6-5978-135b2e1ba3b6%40colostate.edu.


Re: [deal.II] Error while writing material-wise-post-processed quantities using higher order QEulerian Mapping

2020-01-31 Thread Wolfgang Bangerth

Paras,

> In order to write the post-processed stresses contained partially in several 
> vectors, to a single file, the class DataOutMaterialWise has been derived 
> from 
> DataOut. Furthermore, for visualizing the stresses on the deformed contour, 
> dealii::MappingQEulerian based on the displacement vector is employed. 
> Referring to the attached MWE and the three material example mesh file, the 
> code works fine for /fePolyDegree= 1, i.e. /if first order Lagrange finite 
> elements are used for the primary problem. However, the code throws an error 
> when the /merge_patches()/ function is called if higher order elements are 
> employed.

I haven't gotten around to debugging the underlying problem (it looks like a 
bug in deal.II to me), but I managed to get it down to around 50 lines of code 
(see attached). I hope to get around to debugging the actual problem in the 
next few days.

(If you look at the minimal example I attach, you'll see that you will really 
like the DataOut::set_cell_selection() function that was recently introduced. 
It will make the DataOutMaterialWise class unnecessary.)

Best
  W.

-- 

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

-- 
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/c0962767-d42b-d309-e10d-a82b8a76d190%40colostate.edu.

#include 
#include 
#include 

#include 
#include 

#include 

#include 

#include 
#include 

using namespace dealii;



int main()
{
  const unsigned int  dim = 2;
  const std::string inputFile = "mesh-RVE-3Mats.inp";

  Triangulation triangulation_(Triangulation::maximum_smoothing);

  GridIn gridIn;
  gridIn.attach_triangulation(triangulation_);
  std::ifstream gridInputStream(inputFile);
  gridIn.read(gridInputStream, GridIn::abaqus);

  FE_Q ppFE_(1);
  DoFHandler ppDoFHandler_(triangulation_);
  ppDoFHandler_.distribute_dofs(ppFE_);
  
  Vector materialIDs_(ppDoFHandler_.get_triangulation().n_active_cells());


  const std::string fileNameBase = "mwe-stresses";
  const DataOutBase::OutputFormat dataOutputFormat = DataOutBase::vtk;

  MappingQ1 qMapping;

  DataOut dataOutPrimary, dataOutSecondary;
  dataOutPrimary.attach_dof_handler(ppDoFHandler_);
  dataOutSecondary.attach_dof_handler(ppDoFHandler_);

  dataOutPrimary.set_cell_selection([](const typename Triangulation::cell_iterator ) {
  return (cell->is_active() && cell->material_id() == 1);
});
  dataOutSecondary.set_cell_selection([](const typename Triangulation::cell_iterator ) {
  return (cell->is_active() && cell->material_id() == 2);
});
  
  {
// first add the material-ID data
dataOutPrimary.add_data_vector(materialIDs_, "abc");
dataOutPrimary.build_patches(qMapping, 2);
  }
  {
// first add the material-ID data
dataOutSecondary.add_data_vector(materialIDs_, "abc");
dataOutSecondary.build_patches(qMapping, 2);
  }

  // error here:
  dataOutPrimary.merge_patches(dataOutSecondary);

  // now write to file
  std::ofstream dataOutStream(
fileNameBase + DataOutBase::default_suffix(dataOutputFormat));
  dataOutPrimary.write(dataOutStream, dataOutputFormat);
}