Message Boards Message Boards

Errors trying to solve a differential equation using NDSolve[ ]?

Posted 2 years ago

Hello, I am new at this and have some problems solving a differential equation in Mathematica.

I want to solve this equation: Felectrical+Fsurfaceviscosity=ma

In which F_electrical is obtained from a partial derivative relative to xs. I have written my code bellow:

\[Epsilon]0 = 8.85*10^-12 ; \[Epsilon]g = 
 42*\[Epsilon]0; \[Xi] = 0.1; R1 = 50*10^-9;
\[Rho]ag = 10.49*10^3; cd = 0.5 10^-8;

\[Epsilon]rel = ((\[Epsilon]g - \[Epsilon]0)/(\[Epsilon]g + \
\[Epsilon]0));

x1 = 500 10^-9; z1 = 5 10^-9; z1s = -5 10^-9; zs = 
 5 10^-9; x2 = -500 10^-9; z2 = 5 10^-9; z2s = -5 10^-9;


U[xs_]:=(1/(Sqrt[(xs - x1)^2 + (zs - z1)^2])^3 - (
  3* (xs - x1)^2)/(Sqrt[(xs - x1)^2 + (zs - z1)^2])^5 + 
  1/(Sqrt[(xs - x2)^2 + (zs - z2)^2])^3 - (
  3* (xs - x2)^2)/(Sqrt[(xs - x2)^2 + (zs - z2)^2])^5)-\[Epsilon]rel*(1/(Sqrt[(xs - x1)^2 + (zs - z1s)^2])^3 - (
    3* (xs - x1)^2)/(Sqrt[(xs - x1)^2 + (zs - z1s)^2])^5 + 
    1/(Sqrt[(xs - x2)^2 + (zs - z2s)^2])^3 - (
    3* (xs - x2)^2)/(Sqrt[(xs - x2)^2 + (zs - z2s)^2])^5+1/(Sqrt[(zs - zss)^2])^3);

F_electrical=-U'[xs];
F_surfaceviscositi = -cd*xs'[t];
ma=4/3*\[Pi]*\[Xi]*(R1)^3*\[Rho]ag*xs''[t];

F_total=F_electrical+F_surfaceviscosity-ma;

NDSolve[{ftotal == 0, xs[0] == 100 10^-9 , 
  xs[2700] == 300 10^-9}, xs, {t, 0, 3031}] ;

When I try to plot this, I get tones of errors! I should mention that no boundary conditions are specified in the reference article and I have chosen them from the original graph itself which I have attached a picture of it. original graph

Does anyone have any idea how I can plot my graph?

POSTED BY: Katayoon Ghaemi
5 Replies

Actually no I am not sure, and as I am new in Mathematica, I really don't know if I have any other way to solve it! I would appreciate it if you could give me any hint.

POSTED BY: Katayoon Ghaemi

Are you sure you want a boundary value problem?

POSTED BY: Gianluca Gorni

Your equation is singular when xs[t] is plus or minus 100cd.

POSTED BY: Gianluca Gorni

Thanks for your reply, do you know any ways that I can resolve these numerical problems? Or maybe I should use some other code instead of NDSolve?

POSTED BY: Katayoon Ghaemi

Your code has some syntax problems. This makes sense:

\[Epsilon]0 = 8.85*10^-12; \[Epsilon]g = 
 42*\[Epsilon]0; \[Xi] = 0.1; R1 = 50*10^-9;
\[Rho]ag = 10.49*10^3; cd = 0.5 10^-8;

\[Epsilon]rel = ((\[Epsilon]g - \[Epsilon]0)/(\[Epsilon]g + \
\[Epsilon]0));

x1 = 500 10^-9; z1 = 5 10^-9; z1s = -5 10^-9; zs = 
 5 10^-9; x2 = -500 10^-9; z2 = 5 10^-9; z2s = -5 10^-9;


U[xs_] := (1/(Sqrt[(xs - x1)^2 + (zs - z1)^2])^3 - (3*(xs - 
           x1)^2)/(Sqrt[(xs - x1)^2 + (zs - z1)^2])^5 + 
     1/(Sqrt[(xs - x2)^2 + (zs - z2)^2])^3 - (3*(xs - 
           x2)^2)/(Sqrt[(xs - x2)^2 + (zs - 
             z2)^2])^5) - \[Epsilon]rel*(1/(Sqrt[(xs - x1)^2 + (zs - 
              z1s)^2])^3 - (3*(xs - 
            x1)^2)/(Sqrt[(xs - x1)^2 + (zs - z1s)^2])^5 + 
      1/(Sqrt[(xs - x2)^2 + (zs - z2s)^2])^3 - (3*(xs - 
            x2)^2)/(Sqrt[(xs - x2)^2 + (zs - z2s)^2])^5 + 
      1/(Sqrt[(zs - zss)^2])^3);

Felectrical = -U'[xs[t]];
Fsurfaceviscosity = -cd*xs'[t];
ma = 4/3*\[Pi]*\[Xi]*(R1)^3*\[Rho]ag*xs''[t];

Ftotal = Felectrical + Fsurfaceviscosity - ma;

NDSolve[{Ftotal == 0, xs[0] == 100 10^-9, 
  xs[2700] == 300 10^-9}, xs, {t, 0, 3031}]

but it may not be what you meant. However, it does not compute, because of numerical problems.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract