47 if (
name ==
"set_velocity_at_boundary") {
49 m_lb_fluid->remove_node_from_boundary(m_index);
52 get_value<Utils::Vector3d>(
params,
"value") * m_conv_velocity;
53 m_lb_fluid->set_node_velocity_at_boundary(m_index, u);
55 m_lb_fluid->ghost_communication();
56 m_lb_fluid->reallocate_ubb_field();
59 if (
name ==
"get_velocity_at_boundary") {
60 auto const boundary_opt = m_lb_fluid->get_node_is_boundary(m_index);
62 auto const result = m_lb_fluid->get_node_velocity_at_boundary(m_index);
68 if (
name ==
"get_density") {
69 auto const result = m_lb_fluid->get_node_density(m_index);
73 if (
name ==
"set_density") {
74 auto const dens = get_value<double>(
params,
"value");
75 m_lb_fluid->set_node_density(m_index, dens * m_conv_dens);
76 m_lb_fluid->ghost_communication();
79 if (
name ==
"get_population") {
80 auto const result = m_lb_fluid->get_node_population(m_index);
83 if (
name ==
"set_population") {
84 auto const pop = get_value<std::vector<double>>(
params,
"value");
85 m_lb_fluid->set_node_population(m_index, pop);
86 m_lb_fluid->ghost_communication();
89 if (
name ==
"get_velocity") {
90 auto const result = m_lb_fluid->get_node_velocity(m_index);
94 if (
name ==
"set_velocity") {
96 get_value<Utils::Vector3d>(
params,
"value") * m_conv_velocity;
97 m_lb_fluid->set_node_velocity(m_index, u);
98 m_lb_fluid->ghost_communication();
101 if (
name ==
"get_is_boundary") {
102 auto const result = m_lb_fluid->get_node_is_boundary(m_index);
105 if (
name ==
"get_boundary_force") {
106 auto const boundary_opt = m_lb_fluid->get_node_is_boundary(m_index);
108 auto result = m_lb_fluid->get_node_boundary_force(m_index);
114 if (
name ==
"get_pressure_tensor" or
name ==
"get_pressure_tensor_neq") {
115 auto const result = m_lb_fluid->get_node_pressure_tensor(m_index);
116 auto value = std::optional<std::vector<double>>{};
118 value = (*result / m_conv_press).as_vector();
121 if (
context()->is_head_node()) {
122 if (
name ==
"get_pressure_tensor_neq") {
123 auto constexpr c_sound_sq = 1. / 3.;
124 auto const density = m_lb_fluid->get_density();
125 auto const diagonal_term =
density * c_sound_sq / m_conv_press;
126 vec[0] -= diagonal_term;
127 vec[4] -= diagonal_term;
128 vec[8] -= diagonal_term;
131 std::copy(vec.begin(), vec.end(), tensor.m_data.begin());
132 return std::vector<Variant>{tensor.row<0>().as_vector(),
133 tensor.row<1>().as_vector(),
134 tensor.row<2>().as_vector()};
138 if (
name ==
"get_last_applied_force") {
139 auto const result = m_lb_fluid->get_node_last_applied_force(m_index);
143 if (
name ==
"set_last_applied_force") {
144 auto const f = get_value<Utils::Vector3d>(
params,
"value");
145 m_lb_fluid->set_node_last_applied_force(m_index, f * m_conv_force);
146 m_lb_fluid->ghost_communication();
149 if (
name ==
"get_lattice_speed") {
150 return 1. / m_conv_velocity;
boost::make_recursive_variant< None, bool, int, std::size_t, double, std::string, ObjectRef, Utils::Vector3b, Utils::Vector3i, Utils::Vector2d, Utils::Vector3d, Utils::Vector4d, std::vector< int >, std::vector< double >, std::vector< boost::recursive_variant_ >, std::unordered_map< int, boost::recursive_variant_ >, std::unordered_map< std::string, boost::recursive_variant_ > >::type Variant
Possible types for parameters.