# FindRoot error in NDSolve

I have two coupled differential equations as follows $$\frac{\partial }{\partial x}U(x,y) =2V(x,y),$$ $$\frac{\partial }{\partial y}V(x,y) =V(x,y)U(x,y)+1,$$

with conditions $$U(0,y)=sin(y),V(x,0)=0.$$

We want to solve these equations numerically with mathematics. I used the NDSolve command as follows

NDSolve[{D[U[x, y], x] == 2 V[x, y],D[V[x, y], y] == V[x, y] U[x, y] + 1, V[x, 0] == 0,U[0, y] == Sin[y]}, {U, V}, {x, 0, 2}, {y, 0, 2}]


Problem

When I run this, I recieve the following errors:

NDSolveFEMInitializePDECoefficients::femcscd: The PDE is convection dominated and the result may not be stable. Adding artificial diffusion may help.
FindRoot::stfail: The method AffineCovariantNewton failed to compute the next step.
FindRoot::sszero: The step size in the search has become less than the tolerance prescribed by the PrecisionGoal option, but the function value is still greater than the tolerance prescribed by the AccuracyGoal option.


Can you help me fix this?

• If you look at the first error message on your screen, you'll see a blue 'i' icion at the right. Click on that and it takes you to the error message description: FEMDocumentation/ref/message/InitializePDECoefficients/femcscd. If you scroll t the bottom, there is a recommendation to use a finer mesh, and an example of how to do so. The other FindRoot errors come later, probably as a consequence of the first two. So maybe try setting up a fine mesh x-y region, and see if that helps at all.
– user87932
Commented Jul 17, 2023 at 2:57
• Also, at the very top of the page, there's a link to "FEM Best Practices" which describes how to set up artificial diffusion, as suggested by the message. the example shows a set of first order equations for rho[x,t] and v[x,t], similar to yours (though without the nonlinear term). What is done is to add a small second order spatial derivative term (const rho[t,x],{x,2}] etc.) to each equation, adjusting the constants to smooth out the solution but keeping the extra terms as small as possible.
– user87932
Commented Jul 17, 2023 at 3:35
• @A.D Where do the equations come from? Commented Jul 19, 2023 at 8:19

I tried adding a pair of "artificial diffusion" terms, as described in my comment above. Your case differs from the example in FEM Best Practices. The exmaple uses two time derivatives, you use an x derivative for u and a y derivative for v. So, I'm not sure what I did is correct, but you can modify the code and try out different combinations to see what works and what doesn't.

I changed your variables to lower case, since a number of upper case single letter variables are reserved symbols in Mathematica. Not U,V as far as I know, but it's a good habit to avoid single letter upper case variable names in general.

The first two equations are artificial diffusion terms for u,v. 'cdif' is a constant to be varied. Add each term to the corresponding pde term, pick a value for cdif, and try running NDSolve. My initial choice was cdif = .01, but that failed inside FindRoot due to convergence difficulties. You might try setting up a plane region with a fine mesh to see if that helps.

adu = cdif D[u[x,y],{y,2}];

bc = {v[x,0]==0,u[0,y]==Sin[y]};


This didn't generate warnings. I'm not going to copy the InterpolatingFunctions over - they end up in OutputForm and are huge.

cdif=.1;NDSolve[Flatten[{pde,bc}],{u,v},{x,0,2},{y,0,2}]


Here are plots of u and v:

I have no idea if this is what your were expecting, but you have something to tweak.

EDIT: I tried experimenting with a finer mesh, and using different artificial diffusion terms, such as Div[Grad[u]], etc., but saw no improvement; if anything, it made things worse. I did find that cdif can be lowered to roughly 0.075 before DSolve fails, but the plots aren't too different.

The artificial diffusion approach is a somewhat standard method used in computational fluid dynamics. If your equations model a fluid, then you can justify adding such terms on physical grounds since a realistic fluid would exhibit such behavior. Since you're modifying the equations, you want to keep the added terms as small as possible to avoid corrupting your equations too much.

With that in mind, I took the solutions with cdif = 0.075 and made some plots to compare the relative sizes of various terms in the equation. It's not a comprehensive analysis by any means. I arbitrarily took a value of x -> 0.5, and plotted against y over the whole range.(1d plots are easier to read, at least for me.)

Plot[Evaluate[{u[x,y],v[x,y]}/.Flatten@nds/.x->.5],{y,0,2},PlotLegends->{"u","v"}]


Plot[Evaluate[{D[u[x,y],x],D[v[x,y],y]}/.Flatten@nds/.x->.5],{y,0,2},PlotLegends->{"du/dx","dv/dy"}]


Plot[Evaluate[{cdif D[u[x,y],{y,2}],cdif D[v[x,y],{x,2}]}/.Flatten@nds/.x->.5],{y,0,2},PlotLegends->{"d^2u/dy^2","d@v/dx^2"}]


The very tentative conclusion I draw is that the extra diffusion terms aren't small compared to u,v, but are small compared to the first derivatives. Unfortunately, as mentioned, I had no luck in shrinking them down further, without having NDSolve exit with no solution.

• It seems unusual to me to change a first order pde-system to a second order system with small parameter cdif. It looks like a singular system? Commented Jul 17, 2023 at 10:12
• @Ulrich Neumann It's numerically unstable, but not necessarily singular. You get a solution, but there's a big ridge on one boundary for u. I'm not very knowledgeable about this, but following the link from the error msg to the documentation, this (and using a finer mesh) seems to be the recommended solution.The error message suggests adding artificial diffusion, and adding a second order term is what's shown as the suggested approach. When I have time, I'll try to research this further and try to understand it better.
– user87932
Commented Jul 17, 2023 at 15:30
• Thanks for your reply, I'm very curious about the result Commented Jul 18, 2023 at 7:25
• Interesting edit! I tried to solve with a refined boundary mesh, but solution looks totally different Commented Jul 19, 2023 at 8:22
• @UlrichNeumann I just tried a simple rectangular mesh with finer spacing, but NDSolve failed to get anything. I've run out of ideas for the time being. If you're interested in this problem, maybe you'll find a way to improve on this. Good luck!
– user87932
Commented Jul 19, 2023 at 16:32