10 std::map<
unsigned int, Tensor<1, 3>> force_on_walls,
11 std::map<
unsigned int, Tensor<1, 3>> torque_on_walls)
15 for (
const auto &it : force_on_walls)
17 table.add_value(
"B_id", it.first);
18 table.add_value(
"Fx", force_on_walls[it.first][0]);
19 table.add_value(
"Fy", force_on_walls[it.first][1]);
20 table.add_value(
"Fz", force_on_walls[it.first][2]);
21 table.add_value(
"Tx", torque_on_walls[it.first][0]);
22 table.add_value(
"Ty", torque_on_walls[it.first][1]);
23 table.add_value(
"Tz", torque_on_walls[it.first][2]);
25 table.set_precision(
"Fx", 9);
26 table.set_precision(
"Fy", 9);
27 table.set_precision(
"Fz", 9);
28 table.set_precision(
"Tx", 9);
29 table.set_precision(
"Ty", 9);
30 table.set_precision(
"Tz", 9);
32 table.write_text(std::cout);
37 const std::string &filename,
38 const unsigned int output_frequency,
39 const std::vector<unsigned int> &boundary_index,
40 const double time_step,
44 unsigned int this_mpi_process =
45 Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
46 unsigned int n_mpi_processes =
47 Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
48 for (
unsigned int i = 0; i < boundary_index.size(); i++)
50 std::string filename_boundary_description =
51 std::to_string(boundary_index[i]);
52 std::string filename_output =
53 filename +
"_boundary_" + filename_boundary_description;
54 if (this_mpi_process == i || (i + 1) > n_mpi_processes)
58 for (
unsigned int j = 0; j < forces_boundary_information.size();
59 j += output_frequency)
61 table.add_value(
"Force x", forces_boundary_information[j][i][0]);
62 table.add_value(
"Force y", forces_boundary_information[j][i][1]);
63 table.add_value(
"Force z", forces_boundary_information[j][i][2]);
64 table.add_value(
"Torque x",
65 torques_boundary_information[j][i][0]);
66 table.add_value(
"Torque y",
67 torques_boundary_information[j][i][1]);
68 table.add_value(
"Torque z",
69 torques_boundary_information[j][i][2]);
70 table.add_value(
"Current time", j * time_step);
73 table.set_precision(
"Force x", 9);
74 table.set_precision(
"Force y", 9);
75 table.set_precision(
"Force z", 9);
76 table.set_precision(
"Torque x", 9);
77 table.set_precision(
"Torque y", 9);
78 table.set_precision(
"Torque z", 9);
79 table.set_precision(
"Current time", 9);
82 std::ofstream out_file(filename_output);
83 table.write_text(out_file);
void write_forces_torques_output_locally(std::map< unsigned int, Tensor< 1, 3 > > force_on_walls, std::map< unsigned int, Tensor< 1, 3 > > torque_on_walls)
write_forces_torques_output_locally Writes the results of force and torque calculations in the termin...
void write_forces_torques_output_results(const std::string &filename, const unsigned int output_frequency, const std::vector< unsigned int > &boundary_index, const double time_step, DEM::dem_data_structures< 3 >::vector_on_boundary &forces_boundary_information, DEM::dem_data_structures< 3 >::vector_on_boundary &torques_boundary_information)
write_forces_torques_output_results Writes the results of force and torque calculations in a file,...