# Newton Method Convergence Error

Dear @frederichecht Sir,
Based on the Steady NS Eqn, I am trying to solve a non-linear coupled equation. Unfortunately, my code is running but the relative error value is not decreasing after iteration.

Sir, can you comment on my problem and coding error.

Coupled Equation is:

A^2 * dxx( psi ) + dyy( psi ) = Ra * A * dx( T ) ------------------------------(1)

dx( psi ) * dy( T) - dy ( psi ) * dx( T) = dxx ( T) + (1/A^2)*dyy( T ) -------------------(2)

on a square unit, BC is:

psi = 0 , on all sides of the square domain,

T = 0 on x =1
T = 0 on x = 0

also, both upper and lower horizontal wall is adiabatic ( dT/dy = 0 ).

I have implemented the Newtons Method for eq (1 ) and ( 2) which is as:

``````int nn = 40;
real Ra = 1e2;
real A = 0.7;

real  ccc=1.5;//2.;
macro fff(x) ((1+tanh(ccc*(x*2-1))/tanh(ccc))/2)//
mesh Th = square(nn,nn,[ x, (y*(1-x*0.03) ) ]);

fespace Vh(Th, [P2, P2]);

Vh [S, T];
Vh [dS, dT];
Vh [v, w];

[S, T] = [0, 0];

real tol = 1e-8;
real err;
int step;

for(step = 0; step < 20; step++)
{

solve  stream([dS, dT], [v, w]) =
int2d(Th)( A^2*dx(S)*dx(v) + dy(S)*dy(v) + Ra*A*dx(T)*v  )
+ int2d(Th)( ( dx(S)*dy(T) - dy(S)*dx(T) )*w
+ dx(T)*dx(w) + (1/A^2)*dy(T)*dy(w) )

+ int2d(Th)( A^2*dx(dS)*dx(v) + dy(dS)*dy(v)
+ Ra*A*dx(dT)*v
+ (dx(dS)*dy(T) + dx(S)*dy(dT) )*w

- (dy(dS)*dx(T) + dy(S)* dx(dT))*w
+ (dx(dT)*dx(w) + (1/A^2)*dy(dT)*dy(w))
)
+ on(1,2,3,4, dS =S )
+ on(4, dT =1)
+ on(2, dT =T);

S[] -= dS[];

err = dS[].l2/S[].l2;  //

cout<< "step is =="<< step<< "  error is "<< err;

if (err < tol) break;
if (step > 15 && err > 10) break;

plot(S, T, wait = 0, cmm=step+"  Ra ="+Ra);
}

plot(S, T, wait = 0);
``````

Sir, kindly help me to figure it out or any webpage which covers mixed derivative type coupled equation problem.