Skip to content

Commit

Permalink
added get_seed function
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbbeyer committed Aug 20, 2024
1 parent b812fc1 commit b5c033e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/script_interface/walberla/LBFluid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class LBFluid : public LatticeModel<::LBWalberlaBase, LBVTKHandle> {
[this]() { return m_instance->get_lattice().get_grid_dimensions(); }},
{"kT", AutoParameter::read_only,
[this]() { return m_instance->get_kT() / m_conv_energy; }},
{"seed", AutoParameter::read_only, [this]() { return m_seed; }},
{"seed", AutoParameter::read_only, [this]() { return m_instance->get_seed(); }},
{"rng_state",
[this](Variant const &v) {
auto const rng_state = get_value<int>(v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ class LBWalberlaBase : public LatticeModel {
/** @brief Get the fluid temperature (if thermalized). */
virtual double get_kT() const noexcept = 0;

/** @brief Get the fluid thermostat (if thermalized). */
virtual int get_seed() const noexcept = 0;

/** @brief Set the RNG counter (if thermalized). */
[[nodiscard]] virtual std::optional<uint64_t> get_rng_state() const = 0;

Expand Down
5 changes: 5 additions & 0 deletions src/walberla_bridge/src/lattice_boltzmann/LBWalberlaImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ class LBWalberlaImpl : public LBWalberlaBase {
FloatType m_viscosity; /// kinematic viscosity
FloatType m_density;
FloatType m_kT;
int m_seed;

// Block data access handles
BlockDataID m_pdf_field_id;
Expand Down Expand Up @@ -1366,6 +1367,10 @@ class LBWalberlaImpl : public LBWalberlaBase {
return numeric_cast<double>(m_kT);
}

[[nodiscard]] int get_seed() const noexcept override {
return m_seed;
}

[[nodiscard]] std::optional<uint64_t> get_rng_state() const override {
auto const cm = std::get_if<CollisionModelThermalized>(&*m_collision_model);
if (!cm or m_kT == 0.) {
Expand Down

0 comments on commit b5c033e

Please sign in to comment.