Originally Posted by
antillies
I'll be the first to admit that I'm more of a hobbyist programmer, not so much a professional like yourself, so some of the math terms went a bit over my head. Am I correct in understanding though your idea is not to "trace" currents, but to identify what portions of what coastlines would be affected by currents and then go from there (based on distance from the ocean, like you said)? If so, I'm glad, because it's one of the approaches I've been mulling over. Frankly, I don't really even care about displaying the currents since it's an intermediary step that ultimately is more illustrative than functional (though still interesting when it comes to world-building).
Would you mind expanding, however, on what you mean by "simple raster grid solver"? Do you mean simply computing values based one or more pixel grids?
Would you also mind if I ran what I think would be my general approach for this past you?
1. Find and eliminate blobs below a certain threshold to make sure we are only dealing with continents.
2. For each remaining blob, identify the coasts (possibly with edge tracing, possibly with distance transform).
3. Isolate coastlines that fall within specific latitudinal ranges (where currents would flow).
4. For these remaining coastline segments, use their position on their continent (east, west, etc.) to determine the type of current that would affect it (hot, cold).
I realize it's very simplistic, but a more robust simulation is outside my ability (and available time), plus I don't really think one is needed for the more generalized approach most of us are hoping to take.
Thank you in advance for reading over the above, if you have the willingness and chance. I appreciate getting the perspective of someone who's made software in the world-building area.
A grid solver in this case is basically just working with images (pixel grids). Those images might have vectors at each point (for example: a vector of red, green, blue, and opacity at each point for common color images or something like an XYZ direction vector for traditional vector fields) or simple scalar values (for example, a grayscale image interpreted as height values).
I suggested using a distance transform because they are fairly common tools out there these days and it's fairly simple to roll your own if not. Once you have a distance field, it lets you do lots of useful things. By finding the steepest direction downward at each point, you have the direction in which things move out of the distance field. At right angles to that downward direction left or right (counterclockwise or clockwise) would be the direction of an ocean current in the northern and southern hemispheres. You'd need to separate the major ocean areas and put a slice across the equator to get things moving correctly across the equator, but that should be fairly simple. Getting good blobs to start with is the hard part, but you can usually get that with a blur and a threshold (sometimes a few in sequence).
Edge tracing as you've described is probably a workable option if you're only interested in the one or two pixel distance along the coasts and are applying lots of simplifications like assuming earth-like worlds.
What I was describing was a quick way to initialize wind and water flows for what would be akin to a cellular automaton system. For each cell, quantities like terrain height, temperature, amount of water in the cell, and so on are kept and rules based on direction of wind and water flow move humidity and temperature to adjacent cells at each time step. Steps repeat, with the time step doing things like controlling the winter-summer cycles (basically the direction of axial tilt with respect to the sun). Iterating this sort of system to get a semi-stable situation is what would take a huge amount of computational power and some clever data structures.