Comments (5)
What have you tried? You should be able to just define each body with is open map and then add them together...
from waterlily.jl.
Firstly, thank you for your time.
Actually, I was experimenting with one of the examples given (TwoD_cylinderVIV.jl).
I tried to define two bars (sdf_1 and sdf_2) but I am unable to figure out how to give two separate map functions to them.
Here is the modified code:
required to keep things global
let
# parameters
amp=π/4
ϵ=0.5
thk=2ϵ+√2
Re = 250; U = 1
p = 5; L = 2^p
radius = L/2
T = 4*radius # VIV period
# initial condition FSI
p0=radius/3; v0=0.1*L; a0=0; t0=0
# motion function uses global var to adjust
posx(t) = p0 + (t-t0)*v0
function sdf_1(x,t)
√sum(abs2,(2*L >= x[1] .> L) ? ((1.0*x[2] - L)) : x ) - thk/2
end
function sdf_2(x,t)
√sum(abs2,(2*L <= x[1] .< 3*L) ? (x[1] .- (2.0*x[2])) : x ) - thk/2
end
sdf_list = [sdf_1,sdf_2]
function map(x,t)
α = amp*cos(t*U/L); R = SA[cos(α) sin(α); -sin(α) cos(α)]
R * (x - SA[3L-L*sin(0*t*U/L),4L])
end
body = AutoBody(map) do x,t # signed distance function
minimum(sdf_list) do SDF
SDF(x,t)
end
end
# generate sim
sim = Simulation((10L,10L), (U,0), radius; ν=U*radius/Re, body=body)
# get start time
duration=10; step=0.1; t₀=round(sim_time(sim))
@time @gif for tᵢ in range(t₀,t₀+duration;step)
# update until time tᵢ in the background
t = sum(sim.flow.Δt[1:end-1])
while t < tᵢ*sim.L/sim.U
# measure body
measure!(sim,t)
# update flow
mom_step!(sim.flow,sim.pois)
Δt = sim.flow.Δt[end]
p0 += Δt*v0
t0 = t; t += Δt
end
# plot vorticity
@inside sim.flow.σ[I] = WaterLily.curl(3,I,sim.flow.u)*sim.L/sim.U
flood(sim.flow.σ; shift=(-0.5,-0.5),clims=(-5,5))
body_plot!(sim); plot!(title="tU/L $tᵢ")
# print time step
println("tU/L=",round(tᵢ,digits=4),", Δt=",round(sim.flow.Δt[end],digits=3))
end
end
from waterlily.jl.
That's not a good example for applying two simple mappings. Take a look at #35. You just need to do something like:
using WaterLily,StaticArrays
function two_circles(n,m;Re=250,U=1)
body1 = AutoBody((x,t)->√(x'*x) - m/8, map=(x,t)->x .- m/3 - SA_F32[t,0])
body2 = AutoBody((x,t)->√(x'*x) - m/6, map=(x,t)->x .- 2m/3 + SA_F32[t,0])
Simulation((n,m), (U,0), radius; ν=U*radius/Re, body=body1+body2)
end
I've created two maps with two different SDFs and maps. Then the body
is just the sum of the two.
from waterlily.jl.
I assume you figured it out...
from waterlily.jl.
Respected sir,
Yes, sir, I had figured it out. Thank you for the help.
Thank you for your time and consideration.
Yours sincerely,
Kunal Ghosh
from waterlily.jl.
Related Issues (20)
- Test fail on MacOS in testing enviroment HOT 2
- Courant number (CFL) HOT 2
- Change default time in force integration HOT 3
- Circle example not working HOT 3
- Taylor Vortex file HOT 2
- Write VTK size/shape of field in writer HOT 2
- Can WaterLily.jl be used for 2D hydrodynamic modeling of real watersheds, similar to lisflood-fp, mike21, and anuga? HOT 2
- Sorry, my ignoramus questions about the Waterlily again HOT 1
- Simulating a tank for VIV HOT 1
- AD on GPU backend
- Noisy dependence of the body position HOT 10
- docs badge on `README.md` a broken link HOT 1
- Change CI to pass both CPU and GPU tests
- Internals flows in arbitrary shapes HOT 3
- questions about waterlily HOT 11
- Using DifferentiationInterface HOT 2
- AMDGPU downgrades Waterlily HOT 17
- Questions about STL files for simulation HOT 1
- Julia 1.10.4 vs 1.11.0 performance test
- Force Differences in WaterLily Version HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from waterlily.jl.