Skip to content

Commit

Permalink
WIP on_lees_edwards_change
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbbeyer committed Aug 12, 2024
1 parent 8c90c3d commit 185f05e
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core/lb/LBNone.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct LBNone {
void on_node_grid_change() const { throw NoLBActive{}; }
void on_timestep_change() const { throw NoLBActive{}; }
void on_temperature_change() const { throw NoLBActive{}; }
void on_lees_edwards_change() const { throw NoLBActive{}; }
};

} // namespace LB
9 changes: 9 additions & 0 deletions src/core/lb/LBWalberla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "system/System.hpp"
#include "thermostat.hpp"

#include "lees_edwards/lees_edwards.hpp"

#include <walberla_bridge/lattice_boltzmann/LBWalberlaBase.hpp>

#include <utils/Vector.hpp>
Expand Down Expand Up @@ -112,6 +114,13 @@ void LBWalberla::sanity_checks(System::System const &system) const {
system.get_time_step());
}

void LBWalberla::on_lees_edwards_change() {
std::cout << "Changed LEBC." << std::endl;
auto &system = System::get_system();
auto le_protocol = system.lees_edwards->get_protocol();
auto const &le_bc = system.box_geo->lees_edwards_bc();
}

} // namespace LB

#endif // WALBERLA
1 change: 1 addition & 0 deletions src/core/lb/LBWalberla.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct LBWalberla {
}
void on_timestep_change() const {}
void on_temperature_change() const {}
void on_lees_edwards_change();
};

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

void Solver::on_lees_edwards_change() {
if (impl->solver) {
std::visit([](auto &ptr) { ptr->on_lees_edwards_change(); }, *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 @@ -168,6 +168,7 @@ struct Solver : public System::Leaf<Solver> {
void on_cell_structure_change();
void on_timestep_change();
void on_temperature_change();
void on_lees_edwards_change();
void veto_boxl_change() const;

private:
Expand Down
4 changes: 4 additions & 0 deletions src/core/system/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ void System::on_observable_calc() {
clear_particle_node();
}

void System::on_lees_edwards_change() {
lb.on_lees_edwards_change();
}

void System::update_local_geo() {
*local_geo = LocalBox::make_regular_decomposition(
box_geo->length(), ::communicator.calc_node_index(),
Expand Down
1 change: 1 addition & 0 deletions src/core/system/System.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ class System : public std::enable_shared_from_this<System> {
* initialized immediately (P3M etc.).
*/
void on_observable_calc();
void on_lees_edwards_change();
void veto_boxl_change(bool skip_particle_checks = false) const;
/**@}*/

Expand Down
3 changes: 2 additions & 1 deletion src/script_interface/lees_edwards/LeesEdwards.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ class LeesEdwards : public AutoParameters<LeesEdwards, System::Leaf> {
throw std::invalid_argument("Parameters 'shear_direction' and "
"'shear_plane_normal' must differ");
}
auto const &system = get_system();
auto &system = get_system();
system.lb.lebc_sanity_checks(shear_direction, shear_plane_normal);
// update box geometry and cell structure
system.box_geo->set_lees_edwards_bc(
LeesEdwardsBC{0., 0., shear_direction, shear_plane_normal});
m_lees_edwards->set_protocol(m_protocol->protocol());
system.on_lees_edwards_change();
});
}
return {};
Expand Down

0 comments on commit 185f05e

Please sign in to comment.