diff options
author | Adrian Kummerlaender | 2021-09-19 21:02:52 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2021-09-19 21:02:52 +0200 |
commit | 186bfae321f9d34b702a7c31b420eed4d10e7a50 (patch) | |
tree | 4e8e6a691193dd0ce9555d2e29f4414336d17cda /tangle | |
parent | 32dd41a728ce10113032e20955ba08f8de449857 (diff) | |
download | LiterateLB-186bfae321f9d34b702a7c31b420eed4d10e7a50.tar LiterateLB-186bfae321f9d34b702a7c31b420eed4d10e7a50.tar.gz LiterateLB-186bfae321f9d34b702a7c31b420eed4d10e7a50.tar.bz2 LiterateLB-186bfae321f9d34b702a7c31b420eed4d10e7a50.tar.lz LiterateLB-186bfae321f9d34b702a7c31b420eed4d10e7a50.tar.xz LiterateLB-186bfae321f9d34b702a7c31b420eed4d10e7a50.tar.zst LiterateLB-186bfae321f9d34b702a7c31b420eed4d10e7a50.zip |
Small changes to channel example
Diffstat (limited to 'tangle')
-rw-r--r-- | tangle/LLBM/sdf.h | 9 | ||||
-rw-r--r-- | tangle/channel.cu (renamed from tangle/channel-with-sphere.cu) | 17 |
2 files changed, 19 insertions, 7 deletions
diff --git a/tangle/LLBM/sdf.h b/tangle/LLBM/sdf.h index 656c109..52db8cf 100644 --- a/tangle/LLBM/sdf.h +++ b/tangle/LLBM/sdf.h @@ -63,6 +63,15 @@ __device__ __host__ float sintersect(float a, float b, float k) { return lerp(b, a, h) + k*h*(1.f-h); } +__device__ __host__ float3 twisted(float3 p, float k) { + float c = cos(k*p.y); + float s = sin(k*p.y); + float3 q = make_float3(0,0,p.y); + q.x = p.x*c + p.z*-s; + q.y = p.x*s + p.z* c; + return q; +} + } template <typename SDF> diff --git a/tangle/channel-with-sphere.cu b/tangle/channel.cu index 280a142..6a0f072 100644 --- a/tangle/channel-with-sphere.cu +++ b/tangle/channel.cu @@ -21,7 +21,7 @@ if (cuda::device::count() == 0) { } auto current = cuda::device::current::get(); -const descriptor::Cuboid<DESCRIPTOR> cuboid(448, 64, 64); +const descriptor::Cuboid<DESCRIPTOR> cuboid(500, 100, 100); Lattice<DESCRIPTOR,T> lattice(cuboid); CellMaterials<DESCRIPTOR> materials(cuboid, [&cuboid](uint3 p) -> int { @@ -46,9 +46,11 @@ for (std::size_t iX=0; iX < cuboid.nX; ++iX) { } auto obstacle = [cuboid] __host__ __device__ (float3 p) -> float { - float3 q = p - make_float3(cuboid.nX/6, cuboid.nY/2, cuboid.nZ/2); - return sdf::sphere(q, cuboid.nY/T{5}); - }; + p -= make_float3(cuboid.nX/5, cuboid.nY/2, cuboid.nZ/2); + float3 q = sdf::twisted(p, 0.01); + return sdf::sphere(p, cuboid.nY/3.5) + sin(0.2*q.x)*sin(0.2*q.y)*sin(0.2*q.z); +}; + materials.sdf(obstacle, 0); SignedDistanceBoundary bouzidi(lattice, materials, obstacle, 1, 0); @@ -66,10 +68,11 @@ renderer.add<QCriterionS>(lattice, bulk_mask, obstacle); renderer.add<CurlNormS>(lattice, bulk_mask, obstacle); renderer.add<VelocityNormS>(lattice, bulk_mask, obstacle); renderer.run([&](std::size_t iStep) { - const float tau = 0.51; - const float inflow = 0.05; + const float tau = 0.501; + const float smagorinsky = 0.1; + const float inflow = 0.04; - lattice.apply(Operator(BgkCollideO(), bulk_mask, tau), + lattice.apply(Operator(SmagorinskyBgkCollideO(), bulk_mask, tau, smagorinsky), Operator(BounceBackFreeSlipO(), wall_mask_z, WallNormal<0,0,1>()), Operator(BounceBackFreeSlipO(), wall_mask_y, WallNormal<0,1,0>()), Operator(EquilibriumVelocityWallO(), inflow_mask, std::min(iStep*1e-4, 1.0)*inflow, WallNormal<1,0,0>()), |