Dear Deal.ii users,
                                Hi! I am working on the deal.ii code. I 
have data of stress and strain tensors at quadrature points. Currently 
using the results_output function, I am transferring the data at nodal 
points of my triangulation using " qpoint_to_dof_matrix.vmult " function 
and mapping "local_history_strain_values_at_qpoints[i][j]" Gauss point 
values on the "history_strain_field[i][j]" tensor with 
"dg_cell->set_dof_values" function. After this I write this nodal values 
data "history_strain_field[i][j]" as .pvtu and .vtu files for Paraview.

My question is that along with this, can I also export the stress and 
strain tensors data of quadrature points i.e. 
"local_history_strain_values_at_qpoints[i][j]" directly to the output file 
(.pvtu or .vtu etc.) i.e. without mapping or averaging etc. on the node. In 
this way I want to directly visualize the quadrature point values of stress 
and strain in Paraview.

*My current simplified code is following:*

FE_DGQ<dim> history_fe (1);
    DoFHandler<dim> history_dof_handler (triangulation);
    history_dof_handler.distribute_dofs (history_fe);

std::vector< std::vector< Vector<double> > >
    history_strain_field (dim, std::vector< Vector<double> >(dim)),
                         local_history_strain_values_at_qpoints (dim, 
std::vector< Vector<double> >(dim)),
                         local_history_strain_fe_values (dim, std::vector< 
Vector<double> >(dim));


for (unsigned int q=0; q<quadrature_formula.size(); ++q)
for (unsigned int i=0; i<dim; i++)
                for (unsigned int j=i; j<dim; j++)
local_history_strain_values_at_qpoints[i][j](q) = 

} }

for (unsigned int i=0; i<dim; i++)
            for (unsigned int j=i; j<dim; j++)

qpoint_to_dof_matrix.vmult (local_history_strain_fe_values[i][j],


DataOut<dim>  data_out;
              data_out.attach_dof_handler (history_dof_handler);

              //for strain
              data_out.add_data_vector (history_strain_field[0][0], 
              data_out.add_data_vector (history_strain_field[1][1], 
              data_out.add_data_vector (history_strain_field[0][1], 

data_out.build_patches ();

              const std::string filename_base_strain = ("strain-" + 

              const std::string filename =
                          (output_dir + filename_base_strain + "-"
Utilities::int_to_string(triangulation.locally_owned_subdomain(), 4));

              std::ofstream output_vtu((filename + ".vtu").c_str());

              pcout << output_dir + filename_base_strain << ".pvtu" << 

              if (this_mpi_process == 0)
                  std::vector<std::string> filenames;
                                for (unsigned int i = 0; i < 
n_mpi_processes; ++i)
filenames.push_back(filename_base_strain + "-" +
Utilities::int_to_string(i, 4) +

pvtu_master_output((output_dir + filename_base_strain + ".pvtu").c_str());
data_out.write_pvtu_record(pvtu_master_output, filenames);

visit_master_output((output_dir + filename_base_strain + ".visit").c_str());
data_out.write_pvtu_record(visit_master_output, filenames);


The deal.II project is located at
For mailing list/forum options, see
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 view this discussion on the web visit

Reply via email to