dmlipinski / jsWAVES

A javascript code for solving and visualizing the shallow water equations
Other
6 stars 1 forks source link

proposal to be bound by a custom shape #2

Closed samccone closed 10 years ago

samccone commented 10 years ago

I am looking into the feasibility of bounding the shallow wave equation you have implemented here by a custom polygon (as compared to just a rectangle).

for context I am looking to implement something like this. http://grail.cs.washington.edu/projects/watercolor/paper_small.pdf/

Would love to chat about this.

dmlipinski commented 10 years ago

Are you at all familiar with numerical solutions to PDEs? The equations I'm solving are: dh/dt = -H*( du/dx + dv/dy ) du/dt = dh/dx dv/dt = dh/dy where H is the ambient water depth (just affects wave speed), h is the wave height, and u,v are the x,y velocities. These are the shallow water wave equations with some simplifications and can be solved in many ways on many different types of domains.

The code I wrote uses a very simple finite difference method on a rectangular grid in a rectangular domain with an assumed grid spacing of 1. This is basically the simplest possible case. If you want to solve this set of equations on a different domain, the main issues will be choosing a grid and applying boundary conditions. If you have a general polygon, a rectangular grid will not typically line up with your polygonal boundaries so you have to use a more complex method or just choose the closest point and put up with the resulting jagged boundary. If you do not use a rectangular grid then you need to choose something other than a finite difference method (probable finite volume) and generating and working with your grid will add significant complexity.

If you're hoping to implement something like the watercolor painting code in the paper you attached, I think there is actually no need to implement irregular domains unless you really want to have irregular paper shapes. Otherwise, it's much easier to just have rectangular paper and the watercolor stuff can happen anywhere on that paper. The algorithms they outline in the paper are all described in terms of a rectangular grid. Also, I don't think waves play any role in watercolor painting and they're not addressed in that paper at all.

Let me know a little more about what you actually want to do and what your background in this area is. I think the real key is to nail down exactly what you're hoping for.

samccone commented 10 years ago

Hey @dmlipinski I sent you an email so we can discuss this in a better format.

Closing this issue.