1

I am new to Mathematica, trying to solve two PDEs (for f[x,y] and g[x,y]) coupled through Grad[f[x,y]]. In the following code when n is set to 1, NDSolve seems to be able to solve for f[x,y] and g[x,y], and the two obtained functions seem to be coupled as expected. However, when n is set to 2, which is really the case I would like to study, an error message that begins with "NDSolve::femnonlinear: Nonlinear coefficients are not supported in this version of NDSolve. >>" and a bunch of others that follow this message appear. I would say that I understand what the main error message implies, but I would believe that there exists a solution to this issue. I would also think it might be just a simple thing I am missing (e.g. extra boundary conditions are required for n>=2, etc.). I read "Wolfram Mathematica Tutorial Collection/Advanced Numerical Differential Equation Solving in MATHEMATICA" and many posts that seemed to be related to this issue, but I still have not found a way to move forward, so I thought it's time to ask for help.

ClearAll[f, g, x, y, eq1, eq2, eq3, n]
n = 1;

eq1[f_] := Div[Grad[f[x, y], {x, y}], {x, y}]
eq2[g_] := Div[Grad[g[x, y], {x, y}], {x, y}]
eq3[f_] := Grad[f[x, y], {x, y}][[1]]^n + Grad[f[x, y], {x, y}][[2]]^n

sol = NDSolve[{eq1[f] == 0, eq2[g] - eq3[f] == 0, f[0, y] == 1, 
f[10, y] == 0, g[0, y] == 300, g[10, y] == 300}, {f[x, y], 
g[x, y]}, {x, 0, 10}, {y, 0, 5}];

{
 DensityPlot[f[x, y] /. sol, {x, 0, 10}, {y, 0, 5}, 
 PlotLegends -> Automatic, AspectRatio -> Automatic],
 DensityPlot[g[x, y] /. sol, {x, 0, 10}, {y, 0, 5}, 
 PlotLegends -> Automatic, AspectRatio -> Automatic]
}
  • Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the [faq]! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Dr. belisarius Mar 26 '16 at 20:54
  • your problem is the nonlinear term, even if you try to solve for just one function with the Grad^2 mathematica won't find the solution. I guess the documentation could be greatly improved if they had a list of what things you cannot do, so you don't waste time trying things that don't work. Also, your question has more to do with the nonlinear term rather than with solving two coupled functions, maybe consider changing the title? – tsuresuregusa Mar 27 '16 at 15:08
  • Dear "tsuresuregusa", thanks for your comment (BTW, I changed the title). If Mathematica will not be able to handle this type of operation including a non-linear coupling function, I would need to look for another route (or tool) to move forward. But, just before I move on, I tried yet another case by converting the original 2-dimensional case with f[x,y] and g[x,y] into a 1-dimensional case by dropping the y-coordinates (i.e. now using f[x] and g[x]). This simpler case seems to work with n=2, so I still wonder if there is any way to tackle the original case. – HighEntropy Mar 27 '16 at 20:09
  • I tried the 2D case with n = 1.0 that is with a floating point and not the integer value and there is also a problem... I guess that's easier to code a general nonlinear solver for 1d problems than for 2d. Before you move to the next tool check the fem capabilities http://mathematica.stackexchange.com/questions/94914/nonlinear-fem-solver-for-navier-stokes-equations-in-2d/96579#96579 – tsuresuregusa Mar 28 '16 at 00:27
  • Nonlinear partial differential equations are not supported by Mma as yet. I, personally, wait with a passion for the time it will be implemented. As much as I know the situation, not this year still. Let us wait together. What you can do presently is to reformulate your stationary problem as a limiting case of a time-dependent one. If you secceed, the latter can be treated by MethodOfLines. Have success! – Alexei Boulbitch Mar 28 '16 at 12:54
  • Hi tsuresuregusa, thanks for your time trying a couple ideas and providing me suggestions. This is a fun learning process of Mathematica! – HighEntropy Mar 30 '16 at 00:45
  • Hi Alexei, I am honored to have feedback from the Mathematica Instructor! Yes, let us wait for the day coming next year(?). A few months ago, two colleagues and I started efforts on modeling thermo-electro behavior of a type of solid-state devices known as memristor. The two are using COMSOL and MOOSE/mesher and I decided to explore Mathematica after I learned that ver 10 had an extensive FE capability - just thought you might be interested in as you live with solid state physics! I was hoping to have an easy ride, but as you suggest, I will try "Method of Line". Thanks for your guidance. – HighEntropy Mar 30 '16 at 01:02

0 Answers0