diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-04-16 16:49:14 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-04-16 16:49:14 +0200 |
commit | 2e6ae2ef9bb230930f5213c256e624080b08faca (patch) | |
tree | 57487c10ea5787798ad707be8e7a274a87eace43 /c++/examples/cavity_2d.cpp | |
parent | 24827b7753fcdc6c837301064afe60e3d1df3145 (diff) |
Trying to make a cleaner vtk writer
Diffstat (limited to 'c++/examples/cavity_2d.cpp')
-rw-r--r-- | c++/examples/cavity_2d.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/c++/examples/cavity_2d.cpp b/c++/examples/cavity_2d.cpp index 88a7702..0a8e9b1 100644 --- a/c++/examples/cavity_2d.cpp +++ b/c++/examples/cavity_2d.cpp @@ -71,6 +71,9 @@ void compute_rho_u ( vel[1] /= rho; } +/** + * Unsure if feasible. I would have a rho normalization on the dfs and then I would use the const rho_computation + */ template<typename Desc> void compute_const_rho_u ( saw::data<sch::DfCell<Desc>>& dfs, @@ -80,15 +83,20 @@ void compute_const_rho_u ( { using dfi = df_info<sch::T, Desc>; + saw::native_data_type<sch::T>::type real_rho = 0; std::fill(vel.begin(), vel.end(), 0); for(size_t i = 0; i < Desc::Q; ++i){ + real_rho += dfs(i).get(); vel[0] += dfi::directions[i][0] * dfs(i).get(); vel[1] += dfi::directions[i][1] * dfs(i).get(); } + for(size_t i = 0; i < Desc::Q; ++i){ + dfs(i).set(dfs(i).get() * (rho/real_rho)); + } - vel[0] /= rho; - vel[1] /= rho; + vel[0] *= real_rho / (rho*rho) + vel[1] *= real_rho / (rho*rho) } /** |