9 ms·
Show HN: Sail boat simulation – try to sail into the wind
- dylanrw 12y agoNovel way to approach this problem. On projects in the past I just kept a table of optimal angles (given the boat's performance characteristics) and when there is significant overlap I adjusted the velocity. This approach does a better job approximating wind though.
- jacquesm 12y agoNice one, I love little programs like this that teach visitors something.
- imakesnowflakes 12y agoThanks :)
- drblast 12y agoCool, but it's odd that the sail rotates around its own center point. Probably would be more realistic to have it rotate around a mast at the leading edge. I'd also love to see centerboard or keel forces since that's what makes the boat go forward.
- deleted 12y ago[deleted]
- alephnil 12y agoThis makes it a square rigged boat, which is the traditional rig used by old sailships, and most traditional sailboats. That rigtype makes it hard (impossible really) to go up against the wind with a small angle, and this simulation is quite realistic in that respect.
- guiomie 12y agoMaybe it is a rigid sail/wing like the latest americas cup boats.
- onion2k 12y agoFun stuff. Could you add a numeric value for the green line? That way we could see which setting get the best forward motion.
- gus_massa 12y agoI need some time to figure it out, but the little blue dots are the "air molecules". They bounce against the sail! I first thought that they were the sea waves, of a nice visual effect, but they are a part of the simulation.
- imakesnowflakes 12y agoYes, every time one of those hit the 'sail' the direction and magnitude of the force it imparts on the sail is calculated. It is not really needed, as one could just calculate it from the strength and direction of wind in relation to the sail, and setting that they hit the sail at some constant rate. I decided to render it so that it gives some intuition regarding the forces that are acting on the sail.
- alistairjcbrown 12y agoI like that it shows the air which has hit the sail and then spilled off, or "dirty" air. It's a good indication of why you don't want to be sailing behind a boat you are trying to catch!
- Stately 12y agoMore info here: http://en.wikipedia.org/wiki/Point_of_sail#Close_hauled http://en.wikipedia.org/wiki/Point_of_sail#Close_hauled Thanks for making this. As a teenager I used to sail competitively and this brings good memories. Sailing close hauled under decent wind was incredibly fun.
- imakesnowflakes 12y agoYou are welcome and thanks for the link. Really glad that you liked it.. )
- bicx 12y agoFun little sim, although a bit simplistic. Before I started sailing in real life, I used this Android app to build an understanding of sailing physics (which is quite difficult for some to understand until you see it): https://play.google.com/store/apps/details?id=com.mooncoder.sailor https://play.google.com/store/apps/details?id=com.mooncoder....
- adolph 12y agoThat's sweet! Kinda hard to tack tho.
- 3rd3 12y agoIt's kind of counter-intuitive that it's possible to sail against the wind.
- davewasthere 12y agoOr that a boat can sail faster than the wind, say on a broad reach. But it's what makes sailing fun...
- muyuu 12y agoYep, that's why early sail designs used to be square and looked to maximise sail area vs mast and boom (or frame). Ships can advance into the wind because of: - drag reduction (hull shape, keep, rudder) : sideways force translates to a diagonal forward movement - most importantly, lift: more than pushing the sail, the air pulls the sail sliding from the outter side of it (which is why a lot of the cloth doesn't actually suffer much forces in the middle of the sail which is what initial intuition would tell - by far the most tension happens in the corners). If push is stronger than lift, turbulence on the other side of the sail slows down your boat rather than speeding it up. "Tell tales" stuck in strategic points of the sails allow to quickly tell if the flow is correct, and therefore the trimming is good. Boat speed, flapping and shape also show these forces. http://i.imgur.com/hZlb34r.gif http://i.imgur.com/hZlb34r.gif http://i.imgur.com/uypQGJJ.jpg http://i.imgur.com/uypQGJJ.jpg http://i.imgur.com/5tJLUgF.jpg http://i.imgur.com/5tJLUgF.jpg I don't think there's sail shape or lift in the simulation, but I suspect that the drag is rather low or zero, which allows for some gains into the wind (but real boats do better).
- imakesnowflakes 12y ago>I don't think there's sail shape or lift in the simulation.. No. It is a very rough simulation (I am not sure if I can even call that). It only takes into account the force of the wind 'hitting' on the sail and the 'drag reduction'. I am not a physicist or have experience with sailing. I am just a freelance programmer (currently out of work) from India, which means I even haven't seen a real life sail boat. I made this using the stuff I got from Wikipedia and a bit of intuition. So I guess it shows. But I have a question regarding the boat traveling faster than the wind. Isn't it due to the fact that the lift is a constant force, regardless of the speed at which the boat is traveling? But a boat that is using the force of wind hitting the sails, can only sail as fast as the wind, because at that point, there is no wind hitting the sails.
- krschultz 12y agoA little improvement in the graphics would make this much more intuitive. #1) Which is the front end of the boat? Not that hard to have a pointed end and a not pointy end. #2) The sail shouldn't go all the way around, nor rotate around its center. If you are approximating something like a Laser it can go through about a 210 degree arc. Other boats, more like 120-160 degrees. #3) So the wind is coming from the left? Note that almost all things generally show the fluids as streamlines, so at first glance it seemed to me that the wind was coming from the top and the boat was moving to the left. #4) It's missing the force vector from the boat in the water. That's what really explains what is going on. The force vectors don't add up to the motion shown.
- jcampbell1 12y agoThis doesn't explain what is going on very well. A sail generates lift and drag (the power is perpendicular to the sail angle). The keel generates an opposing force that converts the lift into upwind travel. The only way I know how to explain a keel, is like ice skating. you plant one foot, and kick the other foot to the side and back, but the result is forward motion. Ice skating is impossible with just one leg, and sailing upwind is impossible without both a keel and a sail.
- Patrick_Devine 12y ago> Ice skating is impossible with just one leg ... Not true, it's just a little more difficult because it requires better balance. You can fairly easily do a swizzle on one foot shifting from your inside edge to your outside edge, similar to how a boat would tack. Yes, the blade of skate is acting similar to a keel, but no, you don't need two legs to feel the effect.
- imakesnowflakes 12y agoGreat suggestions. >It's missing the force vector from the boat in the water. That's what really explains what is going on. The force vectors don't add up to the motion shown. Yes. You see, I couldn't really isolate that vector. What I am doing is taking the force vector on the sail and taking the projection of it in the direction that the boat is facing. Actually, the forward force comes from the boat trying to move in the direction of the force of the sail. But ends up moving a bit forward because the keel is in a slanted direction to that movement. So even if I show that vector, the viewer probably wont still have any idea regarding where it came from.
- selmnoo 12y agoAbsolutely awesome. Makes me want to look into real sailing. Sadly season for sailing has pretty much ended -- will look into it next year then. Thanks for sharing, would love to see any improvements toward making it more realistic (as a teaching tool for sailing or something).
- imakesnowflakes 12y agoThankyou!
- millzlane 12y agoI think keyboard controls would make this easier to tack/navigate. Left and right to rotate boat and up down for sail. I could see this being a cool racing game with obstacles and changing wind direction. Thanks for sharing.
- ay 12y agoVery nice! A feature idea: would be cool to have a level with "increased difficulty/realism" with just one degree of freedom - the sail. In real world you can not turn the vessel on a whim. And the next level, make the wind gusty, and make it a requirement to keep a certain speed to avoid "drowning", and you have a rather fun windsurfing-simulator game :)
- imakesnowflakes 12y ago>In real world you can not turn the vessel on a whim.. Yes. I originally planned to let the boat turn only using the rudder (the blue line at the end of the boat). But after a while, I felt that it would make very difficult to get it working.
- bane 12y agoSail: 200 Boat: 130 beating to windward while close hauled wish I could see the keel forces pretty cool!
- deleted 12y ago[deleted]
- tehwalrus 12y agotook me quite a while to work out how to tack, with controls being so different to an actual sailing boat (mast pivot at centre rather than leading edge, and spinning the whole boat rather than the blue thing being the rudder.) However, I did manage to get a small resultant to the left, so woot! :)
- tiffanyh 12y agoFor those of you stating you'd like something a bit more realistic, try: http://www.thepirateking.com/ships/sail_simulator.htm http://www.thepirateking.com/ships/sail_simulator.htm @imakesnowflake, great work btw.
- jontas 12y agoThis isn't working for me (just hangs on Loading..) using up to date Chrome on OSX. Anyone else having better luck?
- bdunbar 12y agoEntertaining! It only lacks the whoosh-rush-boom I recall from turning my Sunfish sharply across the wind.
- deleted 12y ago[deleted]
- imakesnowflakes 12y agoThankyou.
- nzealand 12y agoNot realistic enough. Didn't capsize.
- jjallen 12y agoThank you for illustrating my favorite fact about sailing: that the fastest speed at which a sailboat can sail is actually upwind. I learned this from an awesome book, no doubt one that many on HN have heard of, Thinking Physics, by Lewis Carroll Epstein that is worth getting, especially if you have kids and they don't already know basic physics.
- theatgrex 12y agothe fastest point of sail is a beam reach or a broad reach (perpendicular to the wind) ...not upwind
- codeduck 12y agoThis depends entirely on the sail plan of the ship in question. An AC-72 might be fastest upwind, but a square-rigged ship definitely isn't.
- adrianpike 12y agoEven AC72s are fastest a ways off true because of how far forward it drags your apparent angle.
- Anderkent 12y agoAgainst water, or against wind? Sailing against the wind feels fastest, because your SoG adds to the relative wind; but sailing downwind is much faster. The more interesting part is that boats can actually sail faster than the wind that powers them! Depending on the surface, from 1.6 times the true wind speed in a catamaran on water, to 5 or more times the wind speed in an iceboat.
- matthieurouif 12y agoNice mechanics. However, it seems that you only take the drift into account where the physics behind sailing in these situation is the lift apply to the sail (which behaves like a wind)
- tomkarlo 12y agoThis would be more compelling and educational if the controls mapped closer to how the controls you have available on a traditional sailboat work: * Rudder position controls rate of rotation, not absolute heading, and doesn't work if you're not making way * Main sheet (sail control) just controls the maximum amount the sail can deviate from the center of the boat, not its absolute angle relative to the boat (and not which side of the centerline it is on.)
- dzhiurgis 12y agoEducation-wise I think would this can be quite useful to train for man overboard situations.
- tomkarlo 12y agoI have to disagree... in particular, the point of reference (absolute) is also all wrong. It's not going to teach you much about how to react to a man-over. There really isn't much substitute for actual drills at sea to simulate the real stress, surprise and difficulty of a MO where you don't have time to switch over to your engine. Anyone who is skippering (and most crew) should be able to handle an MO properly.
- nraynaud 12y agohttp://www.virtualregatta.com/index_vgv2012.php http://www.virtualregatta.com/index_vgv2012.php they did a huge hit with the virtual race during the Vendée Globe 2008
- shurcooL 12y agoVery neat. I was able to confirm and visualize my intuition on how sailboats work. It reminds me of a car parking simulator [1] I made a while ago. [1] https://dl.dropboxusercontent.com/u/8554242/dmitri/projects/CarSim/CarSim.html https://dl.dropboxusercontent.com/u/8554242/dmitri/projects/...
- couchand 12y agoOh, I was hoping for some crash effects!
- adamtj 12y agoThis seems wrong. The boat never moves when Sail Angle is 0. Boat Angles of 40 and 90 should cause motion with a Sail Angle of 0, but they don't.
- imakesnowflakes 12y agoThe idea is that, the boat will have a very large drag in the direction perpendicular to the keel. When you have 0 sail angle, the force on the sail is in a direction perpendicular to the direction that the boat is facing. So the drag is very large and so it does not move. Only when the force on the sail is at an slanting angle to the keel, the 'drag reduction' comes into play and boat moves at a direction of least resistance. I know that it is not even remotely accurate, as I think sailing involves a lot of complex forces. But it is how I have modeled it and the reason why you are seeing this behavior.
- readerrrr 12y agoId does look like a mistake but it isn't. I can tell you from experience that you get no meaningful push in that position when starting from zero velocity.
- joshuaheard 12y agoThis is a good start, but the physics of sailing is much more complex than presented in your app. For instance, a sailboat is not powered by the wind pushing on the sail. It works like this. The wind is split by the leading edge of the sail (the mast, headstay, or luff). It is split into two turbulent streams, one on each side of the sail. One stream has slightly less force on the sail so the sail begins to move in that direction. As the flow stabilizes over that side, the wind moves faster on that side than on the turbulent side. This creates lift like an airplane wing. So the wind is actually pulling the sail, not pushing it. Lift on the sail causes the boat to heel (lean over). Some of the lifting force is counterbalanced by the keel underwater keeping the boat upright. The remainder of the force pushes the boat downwind. However, the flat keel underwater prevents the boat from sliding downwind, with the result that the boat is forced forward. I recommend you read this book for your next version: http://www.amazon.com/Sail-Power-Complete-Guide-Handling/dp/0394727150 http://www.amazon.com/Sail-Power-Complete-Guide-Handling/dp/...
- arnarbi 12y agoLike an airplane wing, a sail generates most of its lift from deflection of air (air is accelerated towards "aft"), not the Bernoulli effect (pressure difference). http://amasci.com/wing/airfoil.html http://amasci.com/wing/airfoil.html > As the flow stabilizes over that side, the wind moves faster on that side than on the turbulent side. The most important rule of sail trim is to avoid turbulence on either side, __especially__ the leeward side. Laminar flow on the leeward side means the sail is deflecting air on that side as well, generating a "pull" in addition to the "push" on the windward side. The keel generates its righting moment through lift also and not only its wieght btw, since a sailboat moves through the water at a slight angle.
- theothermkn 12y ago> The keel generates its righting moment through lift also and not only its wieght btw, since a sailboat moves through the water at a slight angle. Actually, with the boat heeled over, the lift produced by the keel is both below the hull's center of pressure and producing lift to windward. Its lift would therefore contribute to heeling. > ...generating a "pull" in addition to the "push" on the windward side. I tried to overlook this because of the scare quotes around 'pull', but you put them around 'push,' too! :o) Probably the easiest thing to say is that the 'push' is real, and the 'pull' is just 'less push.' That is, air is still pushing on the leeward side of the sail, but with less pressure than on the windward side, and that this reduction in pressure is greater when the flow is attached, as you imply.
- demallien 12y agoWoah, a little trip down memory lane... This post made me think of this: http://www.mobygames.com/game/american-challenge-a-sailing-simulation http://www.mobygames.com/game/american-challenge-a-sailing-s... This was actually quite a reasonable sailing simulator if I remember correctly. Good enough that when I finally got a chance to sail for real a few years later, I knew what I needed to be doing in terms of positioning sails to obtain various points of sail. Of course, navigating without an overhead map being available, and knowing about ropes were two things that I still had to learn the old-fashioned way :)
- ljk 12y ago> green hexagon is the boat Isn't the boat a pentagon?
- imakesnowflakes 12y agoYes. it is now. It was a hexagon when I posted this. I changed it in response to this comment https://news.ycombinator.com/item?id=8427491 https://news.ycombinator.com/item?id=8427491 I have updated the page to read 'green polygon' now..)
- abecedarius 12y agoMy solar-sailing sim is similarly simple: http://wry.me/t/gravity/gravity.html http://wry.me/t/gravity/gravity.html
- symes 12y agoVery nice. You should give the boat a cat-rig like a laser to remove the mast in the middle. You may want to check out the guys at SailX. They are focusing on the simulation of sailboat racing, but they needs some of the same principles that you are trying to simulate. http://www.sailx.com/ http://www.sailx.com/ For instead of sail-power complete guide, take a look at Aero-Hydrodynamics and the Performance of Sailing Yachts. This is a fun tech-read. http://www.amazon.com/gp/product/0071629106/ref=pd_lpo_sbs_dp_ss_1?pf_rd_p=1944687562&pf_rd_s=lpo-top-stripe-1&pf_rd_t=201&pf_rd_i=1888671181&pf_rd_m=ATVPDKIKX0DER&pf_rd_r=1W6NHC5W3JX6EN8NTN56 http://www.amazon.com/gp/product/0071629106/ref=pd_lpo_sbs_d... To add to the discussion on sailing faster than the wind, I present Blackbird - which was a land yacht made to sail faster than the wind....DDW! The final design was able to sail 2x the speed of the wind. http://en.wikipedia.org/wiki/Blackbird_(land_yacht) http://en.wikipedia.org/wiki/Blackbird_(land_yacht)