50 if (
not name.starts_with(
"get_")) {
54 if (
name ==
"set_velocity_at_boundary") {
55 if (
is_none(params.at(
"value"))) {
56 m_lb_fluid->remove_node_from_boundary(m_index);
60 m_lb_fluid->set_node_velocity_at_boundary(m_index,
u);
62 m_lb_fluid->ghost_communication();
63 m_lb_fluid->reallocate_ubb_field();
66 if (
name ==
"get_velocity_at_boundary") {
67 auto const boundary_opt = m_lb_fluid->get_node_is_boundary(m_index);
69 auto const result = m_lb_fluid->get_node_velocity_at_boundary(m_index);
75 if (
name ==
"get_density") {
76 auto const result = m_lb_fluid->get_node_density(m_index);
80 if (
name ==
"set_density") {
82 m_lb_fluid->set_node_density(m_index,
dens * m_conv_dens);
83 m_lb_fluid->ghost_communication();
86 if (
name ==
"get_population") {
87 auto const result = m_lb_fluid->get_node_population(m_index);
90 if (
name ==
"set_population") {
93 if (
pop.size() != m_lb_fluid->stencil_size()) {
94 throw std::runtime_error(
"Population must have exactly " +
95 std::to_string(m_lb_fluid->stencil_size()) +
99 m_lb_fluid->set_node_population(m_index,
pop);
100 m_lb_fluid->ghost_communication();
103 if (
name ==
"get_velocity") {
104 auto const result = m_lb_fluid->get_node_velocity(m_index);
108 if (
name ==
"set_velocity") {
111 m_lb_fluid->set_node_velocity(m_index,
u);
112 m_lb_fluid->ghost_communication();
115 if (
name ==
"get_is_boundary") {
116 auto const result = m_lb_fluid->get_node_is_boundary(m_index);
119 if (
name ==
"get_boundary_force") {
120 auto const boundary_opt = m_lb_fluid->get_node_is_boundary(m_index);
122 auto result = m_lb_fluid->get_node_boundary_force(m_index);
128 if (
name ==
"get_pressure_tensor" or name ==
"get_pressure_tensor_neq") {
129 auto const result = m_lb_fluid->get_node_pressure_tensor(m_index);
130 auto value = std::optional<std::vector<double>>{};
132 value = (*result / m_conv_press).as_vector();
135 if (
context()->is_head_node()) {
136 if (
name ==
"get_pressure_tensor_neq") {
138 auto const density = m_lb_fluid->get_density();
145 std::ranges::copy(
vec,
tensor.m_data.begin());
146 return std::vector<Variant>{
tensor.row<0>().as_vector(),
147 tensor.row<1>().as_vector(),
148 tensor.row<2>().as_vector()};
152 if (
name ==
"get_last_applied_force") {
153 auto const result = m_lb_fluid->get_node_last_applied_force(m_index);
157 if (
name ==
"set_last_applied_force") {
159 m_lb_fluid->set_node_last_applied_force(m_index, f * m_conv_force);
160 m_lb_fluid->ghost_communication();
163 if (
name ==
"get_lattice_speed") {
164 return 1. / m_conv_velocity;
virtual void parallel_try_catch(std::function< void()> const &cb) const =0