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));
history_strain_field[i][j].reinit(history_dof_handler.n_dofs());
local_history_strain_values_at_qpoints[i][j].reinit(quadrature_formula.size());
local_history_strain_fe_values[i][j].reinit(history_fe.dofs_per_cell);
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) =
local_quadrature_points_history[q].old_elastic_strain;
} }
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],
local_history_strain_values_at_qpoints[i][j]);
dg_cell->set_dof_values
(local_history_strain_fe_values[i][j],
history_strain_field[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],
"strain_xx");
data_out.add_data_vector (history_strain_field[1][1],
"strain_yy");
data_out.add_data_vector (history_strain_field[0][1],
"strain_xy");
data_out.build_patches ();
const std::string filename_base_strain = ("strain-" +
filename_base);
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());
data_out.write_vtu(output_vtu);
pcout << output_dir + filename_base_strain << ".pvtu" <<
std::endl;
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) +
".vtu");
std::ofstream
pvtu_master_output((output_dir + filename_base_strain + ".pvtu").c_str());
data_out.write_pvtu_record(pvtu_master_output, filenames);
std::ofstream
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 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/cafe2213-2782-4307-bdee-5554a17d17bcn%40googlegroups.com.