2

I am trying to solve the coupled Ekman layer solutions numerically, but I am not sure how to enter the boundary conditions or begin to define the equations and write my code. These are my equations and boundary conditions:

$ u''(z) + c [ v(z) - v_g ] = 0 $,

$ v''(z) + c [ u(z) - u_g ] = 0 $,

$ u = 0, \, v = 0 $ at $ z = 0 $,

$ u\to u_g, v\to v_g\ {\rm as}\ z\to\infty $.

This is the code I am using:

vg = 0;
ug = 5;
k = 0.1;
f = 0.006;
e = 
  NDSolve[
    {u''[z] == -(f/k)*(v[z] - vg]), 
     v''[z] == (f/k)*(u[z] - ug), 
     u[0] == 0, v[0] == 0, 
     u[Infinity] -> ug, v[Infinity] -> vg}, 
    {u, v}, {z, 0, 1000}]

I am getting errors because of the boundary/limit at infinity, but I am not sure how to address this.

I have values for k, f, ug and vg that I define earlier in the code.

The specific error is

Equation or list of equations expected instead of u[[Infinity]]->10 in the first argument

xzczd
  • 65,995
  • 9
  • 163
  • 468
vernigan
  • 21
  • 2
  • You need to clean up your syntax. On the rhs of each eq, u[z] and v[z] need to be expressed as functions of z just like on the left. We cannot test your code numerically without knowing f,k,ugandvg`. The equations can be solved analytically, but it is tough satisfying infinite boundary conditions. – Bill Watts Oct 23 '18 at 22:08
  • Thank you. That was a dumb mistake on my part. I've solved it analytically by hand, but I need to now solve it numerically for comparison to that solution. I'll update the code with example values of the variables. – vernigan Oct 23 '18 at 23:54
  • Related: https://mathematica.stackexchange.com/q/158578/1871 – xzczd Oct 24 '18 at 07:36

1 Answers1

2

As you have correctly pointed out that the problem is due the boundary conditions at the infinity. Lets make these conditions to be on a large finite value and see which large enough values gives a reasonable result.

vg = 0;
ug = 5;
k = 0.1;
f = 0.006;
N1 = 100;

sol = NDSolve[{u''[z] == -(f/k)*(v[z] - vg), 
   v''[z] == (f/k)*(u[z] - ug), u[0] == 0, v[0] == 0, u[N1] == ug, 
   v[N1] == vg}, {u, v}, {z, 0, N1}]

Plot[Evaluate[u[z] /. (sol)], {z, 0, N1}, PlotRange -> All, Frame -> True]

Just experiment with different values of N1 and see what happens.

zhk
  • 11,939
  • 1
  • 22
  • 38