ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
LBVelocityProfile.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-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#include "LBVelocityProfile.hpp"
20
21#include "system/System.hpp"
22#include "utils_histogram.hpp"
23
24#include <utils/Histogram.hpp>
25#include <utils/Vector.hpp>
26
27#include <stdexcept>
28#include <vector>
29
30namespace Observables {
31
32std::vector<double>
33LBVelocityProfile::operator()(boost::mpi::communicator const &comm) const {
34 auto &system = System::get_system();
35 auto &lb = system.lb;
36 lb.ghost_communication_vel();
37
38 if (lb_sanity_checks.mismatch(*system.box_geo, lb)) {
40 }
41 auto velocities = lb.get_coupling_interpolated_velocities(sampling_positions);
42
44 detail::gather(comm, sampling_positions, velocities);
45
46 if (comm.rank() != 0) {
47 return {};
48 }
49
51 detail::accumulate(histogram, global_positions, global_velocities);
52 try {
53 return detail::normalize_by_bin_size(histogram, allow_empty_bins);
54 } catch (detail::empty_bin_exception const &) {
55 throw std::runtime_error(
56 "Decrease sampling delta(s), some bins have no hit");
57 }
58}
59
60} // namespace Observables
Vector implementation and trait types for boost qvm interoperability.
void calculate_sampling_positions(auto const &box_geo, auto const &lb) const
std::vector< double > operator()(boost::mpi::communicator const &comm) const override
bool mismatch(BoxGeometry const &box_geo, LB::Solver const &solver) const
Histogram in Cartesian coordinates.
Definition Histogram.hpp:46
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
System & get_system()