phaseflow
FEM solver for the Navier-Stokes-Boussinesq equations coupled with enthalpy-based phase change
 All Classes Namespaces Files Functions Variables Macros Pages
output.h
Go to the documentation of this file.
1 #include <deal.II/dofs/dof_handler.h>
2 #include <deal.II/lac/vector.h>
3 #include <deal.II/grid/grid_out.h>
4 #include <deal.II/numerics/data_out.h>
5 #include <deal.II/lac/sparse_matrix.h>
6 
7 #include <iostream>
8 #include <fstream>
9 
10 
11 namespace Output
12 {
13  using namespace dealii;
14 
15  template<int dim>
17  const std::string filename,
18  DoFHandler<dim> &dof_handler,
19  Vector<double> &solution
20  )
21  {
23  std::vector<std::string> solution_names(dim, "velocity");
24 
25  solution_names.push_back("pressure");
26 
27  solution_names.push_back("temperature");
28 
29  std::vector<DataComponentInterpretation::DataComponentInterpretation>
30  data_component_interpretation(dim, DataComponentInterpretation::component_is_part_of_vector);
31 
32  data_component_interpretation.push_back(DataComponentInterpretation::component_is_scalar);
33 
34  data_component_interpretation.push_back(DataComponentInterpretation::component_is_scalar);
35 
36  DataOut<dim> data_out;
37 
38  data_out.attach_dof_handler(dof_handler);
39 
40  data_out.add_data_vector(
41  solution,
42  solution_names,
43  DataOut<dim>::type_dof_data,
44  data_component_interpretation);
45 
46  data_out.build_patches ();
47 
49  std::ofstream output(filename.c_str());
50  data_out.write_vtk(output);
51  }
52 
53  void write_linear_system(SparseMatrix<double> &A, Vector<double> &b)
54  {
55 
56  {
57  std::ofstream output("A.txt");
58 
59  A.print(output);
60  }
61 
62  {
63  std::ofstream output("b.txt");
64 
65  b.print(output);
66  }
67 
68 
69  }
70 
71 }
void write_solution_to_vtk(const std::string filename, DoFHandler< dim > &dof_handler, Vector< double > &solution)
Definition: output.h:16
void write_linear_system(SparseMatrix< double > &A, Vector< double > &b)
Definition: output.h:53