ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
LBFluidPressureTensor.hpp
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
#ifndef OBSERVABLES_LB_FLUID_STRESS_HPP
20
#define OBSERVABLES_LB_FLUID_STRESS_HPP
21
22
#include "
Observable.hpp
"
23
#include "system/System.hpp"
24
25
#include <
utils/math/sqr.hpp
>
26
#include <
utils/serialization/array.hpp
>
27
28
#include <boost/mpi/collectives/reduce.hpp>
29
30
#include <cstddef>
31
#include <functional>
32
#include <vector>
33
34
namespace
Observables
{
35
class
LBFluidPressureTensor
:
public
Observable
{
36
public
:
37
std::vector<std::size_t>
shape
()
const override
{
return
{3, 3}; }
38
std::vector<double>
39
operator()
(boost::mpi::communicator
const
&comm)
const override
{
40
auto
const
&lb =
System::get_system
().
lb
;
41
auto
const
pressure_conv = 1. / (lb.get_agrid() *
Utils::sqr
(lb.get_tau()));
42
auto
const
local_tensor = lb.
get_pressure_tensor
() * pressure_conv;
43
std::remove_const_t<
decltype
(local_tensor)> tensor;
44
boost::mpi::reduce(comm, local_tensor, tensor, std::plus<>(), 0);
45
return
tensor.as_vector();
46
}
47
};
48
49
}
// Namespace Observables
50
51
#endif
array.hpp
Observables::LBFluidPressureTensor
Definition
LBFluidPressureTensor.hpp:35
Observables::LBFluidPressureTensor::operator()
std::vector< double > operator()(boost::mpi::communicator const &comm) const override
Definition
LBFluidPressureTensor.hpp:39
Observables::LBFluidPressureTensor::shape
std::vector< std::size_t > shape() const override
Definition
LBFluidPressureTensor.hpp:37
Observables::Observable
Base class for observables.
Definition
core/observables/Observable.hpp:42
System::System::lb
LB::Solver lb
Definition
core/system/System.hpp:276
Observables
Definition
BondAngles.hpp:36
System::get_system
System & get_system()
Definition
core/system/System.cpp:122
Utils::sqr
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.
Definition
sqr.hpp:28
Observable.hpp
sqr.hpp
LB::Solver::get_pressure_tensor
Utils::VectorXd< 9 > get_pressure_tensor() const
Definition
lb/Solver.cpp:190
src
core
observables
LBFluidPressureTensor.hpp
Generated on Fri Nov 8 2024 02:12:53 for ESPResSo by
1.9.8