Loading [MathJax]/extensions/TeX/AMSmath.js
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
CylindricalLBVelocityProfile.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
21
22#include "system/System.hpp"
23#include "utils_histogram.hpp"
24
25#include <utils/Histogram.hpp>
27
28#include <vector>
29
30namespace Observables {
31
33 boost::mpi::communicator const &comm) const {
34 using vel_type = Utils::Vector3d;
35
36 decltype(sampling_positions) local_positions{};
37 std::vector<vel_type> local_velocities{};
38
39 auto &lb = System::get_system().lb;
40 auto const vel_conv = lb.get_lattice_speed();
41 lb.ghost_communication_vel();
42
43 for (auto const &pos : sampling_positions) {
44 if (auto const vel = lb.get_interpolated_velocity(pos)) {
45 auto const pos_shifted = pos - transform_params->center();
47 pos_shifted, transform_params->axis(),
48 transform_params->orientation());
50 (*vel) * vel_conv, transform_params->axis(), pos_shifted);
51
52 local_positions.emplace_back(pos_cyl);
53 local_velocities.emplace_back(vel_cyl);
54 }
55 }
56
57 auto const [global_positions, global_velocities] =
58 detail::gather(comm, local_positions, local_velocities);
59
60 if (comm.rank() != 0) {
61 return {};
62 }
63
65 detail::accumulate(histogram, global_positions, global_velocities);
66 return detail::normalize_by_bin_size(histogram);
67}
68
69} // namespace Observables
std::vector< double > operator()(boost::mpi::communicator const &comm) const override
std::shared_ptr< Utils::CylindricalTransformationParameters > transform_params
Histogram in cylindrical coordinates.
Convert coordinates from the Cartesian system to the cylindrical system.
System & get_system()
VectorXd< 3 > Vector3d
Definition Vector.hpp:165
Vector3d transform_vector_cartesian_to_cylinder(Vector3d const &vec, Vector3d const &axis, Vector3d const &pos)
Vector transformation from Cartesian to cylindrical coordinates.
Vector3d transform_coordinate_cartesian_to_cylinder(Vector3d const &pos)
Coordinate transformation from Cartesian to cylindrical coordinates.
auto get_lattice_speed() const
Get the lattice speed (agrid/tau).