Regarding my comment about pdegrad, it computes the gradients at the triangle centroids. If you need the gradients at z=0, where presumably there are some node points, you can call the function pdeprtni after pdegrad to interpolate from the centroids back to the nodes.
Regarding the larger question of how to solve these equations, I really don't understand the equations so can't comment on how to solve them. For example, you appear to have three equations and only two dependent variables.
PDE Toolbox has been used to solve the linear shallow water equations by first deriving a form of these equations that looks like a second-order wave equation-- e.g. like equation (41) in this set of notes: http://www.whoi.edu/fileserver.do?id=136564&pt=10&p=85713 That equation is straightforward to solve in PDE Toolbox using the hyperbolic function.
"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