Skip to content

Commit

Permalink
Add update_collision_model to script interface (not working yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbbeyer committed Aug 22, 2024
1 parent b5c033e commit 0236343
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/lb/LBNone.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct LBNone {
void on_timestep_change() const { throw NoLBActive{}; }
void on_temperature_change() const { throw NoLBActive{}; }
void on_lees_edwards_change() const { throw NoLBActive{}; }
void update_collision_model() const { throw NoLBActive{}; }
};

} // namespace LB
6 changes: 6 additions & 0 deletions src/core/lb/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ void Solver::on_lees_edwards_change() {
}
}

void Solver::update_collision_model() {
if (impl->solver) {
std::visit([](auto &ptr) { ptr->update_collision_model(); }, *impl->solver);
}
}

bool Solver::is_gpu() const {
check_solver(impl);
return std::visit([](auto &ptr) { return ptr->is_gpu(); }, *impl->solver);
Expand Down
1 change: 1 addition & 0 deletions src/core/lb/Solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ struct Solver : public System::Leaf<Solver> {
void on_timestep_change();
void on_temperature_change();
void on_lees_edwards_change();
void update_collision_model();
void veto_boxl_change() const;

private:
Expand Down
3 changes: 3 additions & 0 deletions src/script_interface/walberla/LBFluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ void LBFluid::do_construct(VariantMap const &params) {
throw std::domain_error("Parameter 'kinematic_viscosity' must be >= 0");
}
make_instance(params);
::System::get_system().lb.update_collision_model();
/*
auto const &system = ::System::get_system();
if (auto le_protocol = system.lees_edwards->get_protocol()) {
if (lb_kT != 0.) {
Expand All @@ -210,6 +212,7 @@ void LBFluid::do_construct(VariantMap const &params) {
m_instance->set_collision_model(lb_kT, m_seed);
}
m_instance->ghost_communication(); // synchronize ghost layers
*/
m_instance->set_external_force(lb_ext_f);
for (auto &vtk : m_vtk_writers) {
vtk->attach_to_lattice(m_instance, get_latice_to_md_units_conversion());
Expand Down

0 comments on commit 0236343

Please sign in to comment.