2
$\begingroup$

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

$\endgroup$
  • $\begingroup$ 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,ug` and vg. The equations can be solved analytically, but it is tough satisfying infinite boundary conditions. $\endgroup$ – Bill Watts Oct 23 '18 at 22:08
  • $\begingroup$ 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. $\endgroup$ – vernigan Oct 23 '18 at 23:54
  • $\begingroup$ Related: mathematica.stackexchange.com/q/158578/1871 $\endgroup$ – xzczd Oct 24 '18 at 7:36
2
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ This isn't a comment, it's a valid answer :) . $\endgroup$ – xzczd Oct 24 '18 at 7:38
  • $\begingroup$ @xzczd thanks for confidence. I wasn’t sure. $\endgroup$ – zhk Oct 24 '18 at 7:39
  • $\begingroup$ @xzczd please have a look at my problem in the chat area pdetoae. $\endgroup$ – zhk Oct 25 '18 at 3:22
  • $\begingroup$ Thank you! I think I have it now. $\endgroup$ – vernigan Nov 8 '18 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.