diff options
-rw-r--r-- | c++/converter.hpp | 9 | ||||
-rw-r--r-- | c++/lbm.hpp | 23 | ||||
-rw-r--r-- | examples/cavity_2d.cpp | 11 |
3 files changed, 42 insertions, 1 deletions
diff --git a/c++/converter.hpp b/c++/converter.hpp index 67058aa..2ad5185 100644 --- a/c++/converter.hpp +++ b/c++/converter.hpp @@ -20,6 +20,14 @@ public: second_conv_{second_conv__} {} + auto delta_x() const { + return meter_conv_*saw::data<sch::LbmMeter<T>>{1.0}; + } + + auto delta_t() const { + return second_conv_*saw::data<sch::LbmSecond<T>>{1.0}; + } + saw::data<sch::LbmMeter<T>> meter_si_to_lbm(const saw::data<sch::SiMeter<T>>& m_si) const { return m_si / meter_conv_; } @@ -40,5 +48,6 @@ public: return kin_si * second_conv_ / (meter_conv_ * meter_conv_); } }; + } } diff --git a/c++/lbm.hpp b/c++/lbm.hpp new file mode 100644 index 0000000..ddfa948 --- /dev/null +++ b/c++/lbm.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include "descriptor.hpp" +#include "converter.hpp" + +#include <forstio/codec/unit/unit_print.hpp> +#include <iostream> + +namespace kel { +namespace lbm { +template<typename T> +void print_lbm_meta(const converter<T>& conv){ + std::cout + <<"[LBM Meta]\n" + <<"==========\n" + <<"\n" + <<"Δx: "<<conv.delta_x()<<"\n" + <<"Δt: "<<conv.delta_t()<<"\n" + <<"" + ; +} +} +} diff --git a/examples/cavity_2d.cpp b/examples/cavity_2d.cpp index 55223a4..f1e2f51 100644 --- a/examples/cavity_2d.cpp +++ b/examples/cavity_2d.cpp @@ -1,5 +1,6 @@ #include "../c++/descriptor.hpp" #include "../c++/macroscopic.hpp" +#include "../c++/lbm.hpp" /** */ @@ -371,7 +372,14 @@ int main(){ saw::data<sch::CavityFieldD2Q9, saw::encode::Native> lattice{dim}; - // auto& df_field = lattices.at(0).template get<"dfs">(); + converter<sch::T> conv{ + {0.1}, + {0.1} + }; + + print_lbm_meta(conv); + + //auto& df_field = lattices.at(0).template get<"dfs">(); //for(uint64_t i = 0; i < df_field.get_dim_size<0u>(); ++i){ // lattices.at(i) = {dim_x, dim_y}; //} @@ -380,6 +388,7 @@ int main(){ * Set meta information describing what this cell is */ set_geometry(lattice); + /** * */ |