22#ifdef ESPRESSO_WALBERLA
38 if (
name ==
"get_slice_size") {
41 if (
name ==
"get_slice_ranges") {
44 if (
name ==
"get_lb_sip") {
47 if (
name ==
"get_value_shape") {
49 if (
not m_shape_val.contains(
name)) {
51 throw std::runtime_error(
"Unknown fluid property '" +
name +
"'");
54 return m_shape_val.at(
name);
56 if (
name ==
"get_lattice_speed") {
57 return 1. / m_conv_velocity;
64 auto &
obj = *m_lb_fluid;
75 if (
name ==
"get_population") {
76 auto const pop_size = m_shape_val.at(
"population");
79 if (
name ==
"set_population") {
80 auto const pop_size = m_shape_val.at(
"population");
83 if (
name ==
"get_density") {
86 if (
name ==
"set_density") {
89 if (
name ==
"get_velocity") {
92 if (
name ==
"set_velocity") {
95 if (
name ==
"get_is_boundary") {
98 if (
name ==
"get_velocity_at_boundary") {
100 1. / m_conv_velocity);
102 if (
name ==
"set_velocity_at_boundary") {
105 m_lb_fluid->reallocate_ubb_field();
108 if (
name ==
"get_pressure_tensor") {
112 if (
name ==
"get_pressure_tensor_neq") {
114 if (
context()->is_head_node()) {
116 auto const density = m_lb_fluid->get_density();
119 auto &
vec = *(std::get_if<std::vector<double>>(
120 &(std::get_if<std::vector<Variant>>(&
variant)->at(0))));
129 if (
name ==
"get_last_applied_force") {
133 if (
name ==
"set_last_applied_force") {
Interface of a lattice-based fluid model.
virtual std::vector< double > get_slice_velocity(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Get slice velocity.
virtual void set_slice_velocity_at_boundary(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner, std::vector< std::optional< Utils::Vector3d > > const &velocity)=0
Set slice velocity boundary conditions.
virtual std::vector< double > get_slice_density(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Get slice density.
virtual std::vector< double > get_slice_population(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Get slice population.
virtual std::vector< std::optional< Utils::Vector3d > > get_slice_velocity_at_boundary(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Get slice velocity boundary conditions.
virtual void set_slice_population(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner, std::vector< double > const &population)=0
Set slice population.
virtual std::vector< double > get_slice_pressure_tensor(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Get slice pressure tensor.
virtual void set_slice_density(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner, std::vector< double > const &density)=0
Set slice density.
virtual void set_slice_velocity(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner, std::vector< double > const &velocity)=0
Set slice velocity.
virtual std::vector< bool > get_slice_is_boundary(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Check if slice has velocity boundary conditions.
virtual void set_slice_last_applied_force(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner, std::vector< double > const &force)=0
Set stored force that was applied on slice in the last time step.
virtual std::vector< double > get_slice_last_applied_force(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const =0
Get stored force that was applied on slice in the last time step.
virtual void parallel_try_catch(std::function< void()> const &cb) const =0
Context * context() const
Responsible context.
std::string_view name() const
Variant do_call_method(std::string const &name, VariantMap const ¶ms) override
Variant gather_3d(std::vector< int > const &data_dims, LatticeModel const &lattice_model, std::vector< T >(LatticeModel::*getter)(Utils::Vector3i const &, Utils::Vector3i const &) const, double units_conversion=1.) const
Utils::Vector3i m_slice_upper_corner
void scatter_3d(Variant const &grid_values, std::vector< int > const &data_dims, LatticeModel &lattice_model, void(LatticeModel::*setter)(Utils::Vector3i const &, Utils::Vector3i const &, std::vector< T > const &), double units_conversion=1.)
Utils::Vector3i m_slice_lower_corner
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
std::unordered_map< std::string, Variant > VariantMap
static SteepestDescentParameters params
Currently active steepest descent instance.
Recursive variant implementation.