diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-02-05 18:05:18 +0100 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-02-05 18:05:18 +0100 |
| commit | b79e5cf1a3c07cad4edcad2c909318a5a5b6115e (patch) | |
| tree | f24cb550eb395131ab1e89b175e802490f46dbd3 /lib/core | |
| parent | f51a1e9bac0e815f4c6567f80831172e26e5f836 (diff) | |
| download | libs-lbm-b79e5cf1a3c07cad4edcad2c909318a5a5b6115e.tar.gz | |
Fixing boundary conditions
Diffstat (limited to 'lib/core')
| -rw-r--r-- | lib/core/c++/boundary.hpp | 2 | ||||
| -rw-r--r-- | lib/core/c++/write_vtk.hpp | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/core/c++/boundary.hpp b/lib/core/c++/boundary.hpp index ec16edf..6d83c79 100644 --- a/lib/core/c++/boundary.hpp +++ b/lib/core/c++/boundary.hpp @@ -117,7 +117,7 @@ public: for(saw::data<sch::UInt64> k{0u}; k < saw::data<sch::UInt64>{Descriptor::Q}; ++k){ auto c_k = dfi::directions[k.get()]; - if(c_k[0u]*known_dir > 0){ + if(c_k[0u]*known_dir < 0){ sum_unknown_dfs += dfs_old.at({k}) * c_k[0u]; } } diff --git a/lib/core/c++/write_vtk.hpp b/lib/core/c++/write_vtk.hpp index 3c60a66..751ec50 100644 --- a/lib/core/c++/write_vtk.hpp +++ b/lib/core/c++/write_vtk.hpp @@ -67,12 +67,14 @@ struct lbm_vtk_writer<sch::FixedArray<T,D>> { template<typename T, uint64_t Ghost, uint64_t... D> struct lbm_vtk_writer<sch::Chunk<T,Ghost,D...>> { + template<uint64_t d> static saw::error_or<void> apply_d(std::ostream& vtk_file, const saw::data<sch::Chunk<T,Ghost,D...>>& field, saw::data<sch::FixedArray<sch::UInt64,sizeof...(D)>>& index){ - - if constexpr ( d < sizeof...(D)){ - for(index.at({d}) = 0u; index.at({d}) < field.get_dims().at({d}); ++index.at({d})){ - auto eov = apply_d<d+1u>(vtk_file, field, index); + // VTK wants to iterate over z,y,x instead of x,y,z + // We could reorder the dimensions, but eh + if constexpr ( d > 0u){ + for(index.at({d-1u}) = 0u; index.at({d-1u}) < field.get_dims().at({d-1u}); ++index.at({d-1u})){ + auto eov = apply_d<d-1u>(vtk_file, field, index); } }else{ auto eov = lbm_vtk_writer<T>::apply(vtk_file, field.at(index)); @@ -94,7 +96,7 @@ struct lbm_vtk_writer<sch::Chunk<T,Ghost,D...>> { } { - auto eov = apply_d<0u>(vtk_file, field, index); + auto eov = apply_d<sizeof...(D)>(vtk_file, field, index); if(eov.is_error()){ return eov; } |
