"Sergey" wrote in message <email@example.com>... > Hi Torsten, > > Yes, you are right. In general case the problem should be solved on the free surface and the (2)nd and (3)d equations should be considered on z=Eta(x,t), but we consider the linear system of hydrodynamics. That means the amplitude of surface waves is negligible small, therefore all the equations can be considered on z=0 instead of z=Eta(x,t), which significantly simplifies the problem. > > -Sergey > > "Torsten" wrote in message <firstname.lastname@example.org>... > > "Sergey" wrote in message <email@example.com>... > > > Hi Bill and Torsten, > > > Thank you very much for the responds. > > > > > > Regarding my second question. Thanks for the suggestion about the "pdegrad", I didn't know about that function. Today I came to an another possible way to calculate dPhi/dz on the surface. I could use the "tri2grid" function to interpolate a solution of the Laplace equation to the rectangular grid and then calculate the derivative by the traditional finite difference scheme (Phi(2,1) - Phi(1,1))/dz. That method gives the approximate result as well. Anyway I'll try both of them and use the one with the best performance/accuracy. > > > > > > >> From: Torsten > > > >> The OP needs the gradient at the boundary surface z=0. This is also possible with pdegrad ? What about the accuracy ? > > > > > > I could get the gradient of the under-surface triangles, that would be the derivative of the potential function on the surface. It is almost the same as if I would calculate the derivative by the finite difference scheme. > > > > > > Concerning the first question. > > > >> From: Bill Greene > > > >> Regarding your first question, where are you stuck? If you post the code you have so far and describe the point of your confusion, we might be able to help. > > > > > > I've not started writing the code so far since I need to understand what algorithms I am able to use to start the development. So far I consider the following three ways of the future program: > > > 1) solve the whole system by means of PDE toolbox functionality only. > > > My first question was connected with this point. I was asking whether it was possible to solve the whole system: (1)st, (2)nd and (3)d equations altogether by means of the PDE functionality. But It seems to me, that it's impossible. Since there are 1D and 2D equations in the system and Pde toolbox supports the 2D equations only. Moreover in the future program the Bernoulli equation will be supplemented by additional terms like surface tension, for example. > > > 2) solve the Laplace equation only by means of the PDE toolbox, get the resulting potential and use it to solve the rest of the system by finite difference schemes. > > > This is the convenient and feasible method, since I don't have to develop the Laplace equation solver at all. > > > 3) develop all the system solving algorithm from the beginning. > > > It is the most inconvenient way, since the solution of the Laplace equation on an uneven topography is the most complicated part of the algorithm. > > > > > > If you have any suggestion regarding the 1st and the 2nd points, I'd be really glad to read it. > > > > > > Sincerely, > > > -Sergey > > > > > > "Bill Greene" wrote in message <firstname.lastname@example.org>... > > > > The answer to your second question is to call the pdegrad function with > > > > the solution vector. > > > > http://www.mathworks.com/help/pde/ug/pdegrad.html > > > > > > > > Regarding your first question, where are you stuck? If you post the code you > > > > have so far and describe the point of your confusion, we might be able to help. > > > > > > > > Bill > > > > > > > > "Sergey" wrote in message <email@example.com>... > > > > > Alright, If there is no idea how the problem can be solved directly (I've stuck as well) Maybe someone could tell me how to get the Phi_z (= dPhi / dz) from the solution of the Laplace equation of PDE toolbox? It gives result on the unstructured grid, that I can't directly differentiate by the usual scheme like (Phi(2,1) - Phi(1,1))/dz. > > > > > > > > > > "Sergey" wrote in message <firstname.lastname@example.org>... > > > > > > Dear Matlab users and developers, > > > > > > > > > > > > I need to solve the following PDE system in 2D space: > > > > > > (1) div(grad( Phi )) = 0 |any x, any z; > > > > > > (2) Eta_t = Phi_z | any x, z = 0; > > > > > > (3) Phi_t = -g*Eta | any x, z = 0. > > > > > > where "?_t" - time derivative, "?_z" - z - axis derivative, "div" - divergence operator, "grad" - gradient operator. > > > > > > (1) - simple Laplace equation for interior flow potential, > > > > > > (2) - surface elevation (Eta) and the potential (Phi) connection, > > > > > > (3) - linearized Bernoulli equation. > > > > > > It is the linearized equations of hydrodynamics. Of course I could solve it using just a FD scheme, but if there is a possibility to utilize some internal Matlab tools like PDE toolsbox, it is preferable to use, since it is already developed and verified. > > > > > > I know, that the PDE toolbox provide a possibility to solve the 2D Laplace equation. What about the rest of the system? Can I somehow couple all the equations by means of the PDE toolbox functionality? > > > > > > > > > > > > Sincerely, > > > > > > -Sergey > > > > Maybe I'm wrong with the interpretation of your equations, but I think you have a free-surface problem such that the last two equations are not given at z=0, but at z=Eta(x,t). This would mean that you have to solve your equation for the potential in a region changing with time. I doubt that this is possible with the PDE toolbox. > > > > Best wishes > > Torsten. > >
Then maybe the easiest way is to proceed like this: Given Phi(x,z,t), get Phi_z(x,z=0,t) from the evaluation of the potential field. Update Eta as Eta(x,z=0,t+dt) = Eta(x,z=0,t)+dt*Phi_z(x,z=0,t). Update Phi at z=0 as Phi(x,z=0,t+dt) = Phi(x,z=0,t)-dt*g*Eta(x,z=0,t+dt). Now calculate Phi(x,z,t+dt) with the new boundary condition Phi(x,z=0,t+dt) from the Laplace equation. And so on.