diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-04-20 19:13:16 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-04-20 19:13:16 +0200 |
commit | f50bf98a4a39dfcfb5ad2690d0adaa851d3dc69a (patch) | |
tree | 133a8233a83228b783b1a1d12955aa22e722cc1a /c++ | |
parent | 15a0453cf45066f3d88db783b08ce266af59230f (diff) |
Build conversion for basic types
Diffstat (limited to 'c++')
-rw-r--r-- | c++/converter.hpp | 16 | ||||
-rw-r--r-- | c++/lbm.hpp | 11 | ||||
-rw-r--r-- | c++/lbm_unit.hpp | 5 |
3 files changed, 25 insertions, 7 deletions
diff --git a/c++/converter.hpp b/c++/converter.hpp index 2ad5185..6e0a7a6 100644 --- a/c++/converter.hpp +++ b/c++/converter.hpp @@ -20,6 +20,20 @@ public: second_conv_{second_conv__} {} + /** + * Get the conversion parameter with the conversion type + */ + auto conversion_x() const { + return meter_conv_; + } + + /** + * Get the conversion parameter with the conversion type + */ + auto conversion_t() const { + return second_conv_; + } + auto delta_x() const { return meter_conv_*saw::data<sch::LbmMeter<T>>{1.0}; } @@ -45,7 +59,7 @@ public: } saw::data<sch::LbmKinematicViscosity<T>> kinematic_viscosity_si_to_lbm (const saw::data<sch::SiKinematicViscosity<T>>& kin_si) const { - return kin_si * second_conv_ / (meter_conv_ * meter_conv_); + return kin_si / (meter_conv_ * meter_conv_) * second_conv_; } }; diff --git a/c++/lbm.hpp b/c++/lbm.hpp index ddfa948..9cd7296 100644 --- a/c++/lbm.hpp +++ b/c++/lbm.hpp @@ -8,15 +8,16 @@ namespace kel { namespace lbm { -template<typename T> -void print_lbm_meta(const converter<T>& conv){ +template<typename T, typename Desc> +void print_lbm_meta(const converter<T>& conv, const saw::data<sch::SiKinematicViscosity<T>>& kin_vis_si){ std::cout <<"[LBM Meta]\n" <<"==========\n" <<"\n" - <<"Δx: "<<conv.delta_x()<<"\n" - <<"Δt: "<<conv.delta_t()<<"\n" - <<"" + <<"Δx: "<<conv.delta_x()<<"\n" + <<"Δt: "<<conv.delta_t()<<"\n" + <<"KinVis: "<<kin_vis_si<<"\n" + <<"τ: "<<(saw::data<typename saw::unit_division<sch::Scalar<T>, sch::LbmKinematicViscosity<T>>::Schema >{df_info<T,Desc>::inv_cs2} * conv.kinematic_viscosity_si_to_lbm(kin_vis_si) + saw::data<sch::Scalar<T>>{0.5})<<"\n" ; } } diff --git a/c++/lbm_unit.hpp b/c++/lbm_unit.hpp index e69323f..2d90652 100644 --- a/c++/lbm_unit.hpp +++ b/c++/lbm_unit.hpp @@ -1,4 +1,7 @@ #pragma once + /** + * Get the conversion parameter with the conversion type + */ #include <forstio/codec/unit/unit.hpp> @@ -39,7 +42,7 @@ template<typename S> using LbmMeter = Unit<S, UnitElement<lbm_type::meter, 1>>; template<typename S> -using SiSecond = Unit<S, UnitElement<si_type::meter, 1>>; +using SiSecond = Unit<S, UnitElement<si_type::second, 1>>; template<typename S> using LbmSecond = Unit<S, UnitElement<lbm_type::second, 1>>; |