0
$\begingroup$

I have solved the following system of algebraic equations. The unknowns are

   a[n], wx[n], wy[n],
  cx[n], cy[n],σ[n], βx[n], βy[n], α[n]. 

I got the solutions and I plotted the graph. However, I have got the messages from Mathematica like this:

FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >>

FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >>

FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >>

General::stop: Further output of FindRoot::lstol will be suppressed during this calculation. >>

FindRoot::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations. >>

FindRoot::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations. >>

FindRoot::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations. >>

General::stop: Further output of FindRoot::cvmit will be suppressed during this calculation. >>

My question here how to avoid these messages? Many thanks.

Z = 100; NN := 10000; dz = Z/NN

Dx := 1; Dy := 1/5; q := 2; ν := 200;

f1 := (a[n] - a[n - 1])/dz - (-2 a[n] (Dx cx[n] + Dy cy[n]))

f2 := (wx[n] - wx[n - 1])/dz - 4 Dx cx[n] wx[n]

f3 := (wy[n] - wy[n - 1])/dz - 4 Dy cy[n] wy[n]

f4 := (cx[n] - cx[n - 1])/
dz - (-4 Dx cx[n]^2 + (4 Dx)/wx[n]^4 - (
4 E α[n] βx[n] βy[
  n] (3 wy[n]^2 βx[
     n]^2 + (wx[n]^2 + 8 βx[n]^2) βy[
     n]^2))/(π (wx[n]^2 + 2 βx[n]^2)^(
 5/2) (wy[n]^2 + 2 βy[n]^2)^(3/2)))

  f5 := (cy[n] - cy[n - 1])/
  dz - (4 Dy (-cy[n]^2 + 1/wy[n]^4) - (
  4 E α[n] βx[n] βy[
  n] (3 wx[n]^2 βy[n]^2 + βx[
     n]^2 (wy[n]^2 + 8 βy[n]^2)))/(π (wx[n]^2 + 
   2 βx[n]^2)^(3/2) (wy[n]^2 + 2 βy[n]^2)^(5/2)))

f6 := (σ[n] - σ[n - 1])/
dz - (-((2 Dx)/wx[n]^2) + (
2 E wx[n]^2 α[n] βx[n]^3 βy[
  n])/(π (wx[n]^2 + 2 βx[n]^2)^(5/2) Sqrt[
 wy[n]^2 + 
  2 βy[
    n]^2]) - (2 (-2 E wx[n]^2 wy[n]^6 α[n] βx[
       n]^3 βy[n] - 
     3 E wy[n]^6 α[n] βx[n]^5 βy[n] - 
     3 E wx[n]^4 wy[n]^4 α[n] βx[n] βy[n]^3 - 
     18 E wx[n]^2 wy[n]^4 α[n] βx[n]^3 βy[
       n]^3 - 20 E wy[n]^4 α[n] βx[n]^5 βy[
       n]^3 - 3 E wx[n]^4 wy[n]^2 α[n] βx[
       n] βy[n]^5 - 
     16 E wx[n]^2 wy[n]^2 α[n] βx[n]^3 βy[
       n]^5 - 16 E wy[n]^2 α[n] βx[n]^5 βy[
       n]^5 + Dy π (wx[n]^2 + 2 βx[n]^2)^(
      5/2) (wy[n]^2 + 2 βy[n]^2)^(5/2)))/(π wy[
    n]^2 (wx[n]^2 + 2 βx[n]^2)^(
   5/2) (wy[n]^2 + 2 βy[n]^2)^(5/2)))

equ1 := -((E^2 ν α[n] βx[n])/(2 βy[n]^3)) - ((
E^2 ν α[n] βy[n])/(2 βx[n]^3)) - 
E^2 q α[n] βx[n] βy[n] + ((
E a[n]^2 wx[n] wy[n] βx[n] βy[
n] (βx[n]^2/(wx[n]^2 + 2 βx[n]^2) + βy[n]^2/(
 wy[n]^2 + 2 βy[n]^2)))/
Sqrt[(wx[n]^2 + 2 βx[n]^2) (wy[n]^2 + 2 βy[n]^2)]) 

equ2 := -((E ν α[n])/(4 βy[n]^3)) - 
1/2 E q α[n] βy[n] + (
3 E ν α[n] βy[n])/(4 βx[n]^4) + 
a[n]^2 ((wx[n]^3 wy[n] βy[n]^3)/((wx[n]^2 + 2 βx[n]^2)^(
  3/2) (wy[n]^2 + 2 βy[n]^2)^(3/2)) + (
 3 wx[n]^3 wy[n] βx[n]^2 βy[
   n])/((wx[n]^2 + 2 βx[n]^2)^(5/2) Sqrt[
  wy[n]^2 + 2 βy[n]^2]))

equ3 := -((E ν α[n])/(4 βx[n]^3)) - 
1/2 E q α[n] βx[n] + (
3 E ν α[n] βx[n])/(4 βy[n]^4) + 
a[n]^2 ((3 wx[n] wy[n]^3 βx[n] βy[n]^2)/(
 Sqrt[wx[n]^2 + 2 βx[n]^2] (wy[n]^2 + 2 βy[n]^2)^(
  5/2)) + (
 wx[n] wy[n]^3 βx[n]^3)/((wx[n]^2 + 2 βx[n]^2)^(
  3/2) (wy[n]^2 + 2 βy[n]^2)^(3/2)))


FI[0] = {a[0] -> 1, wx[0] -> 4.5, wy[0] -> 4.5,  cx[0] -> 0, 
cy[0] -> 0, σ[0] -> 0}


tab = Union[{FI[0]}, 
Table[FI[n] = 
  FindRoot[{f1 == 0, f2 == 0, f3 == 0, f4 == 0, f5 == 0, f6 == 0, 
     equ1 == 0, equ2 == 0, equ3 == 0} /. 
    FI[n - 1], {{a[n], 1}, {wx[n], 4.5}, {wy[n], 4.5}, { cx[n], 
     0}, {cy[n], 0}, {σ[n], 0}, {βx[n], 
     5.7}, {βy[n], 5.36}, {α[n], 0.24}}], {n, 1, 
  NN}]] // Flatten;

ListPlot[Table[a[n], {n, 0, NN}] /. tab, Joined -> True, 
Axes -> False, Frame -> True, PlotRange -> All, 
FrameLabel -> {"n dz", "a"}]

The plotting of the first unknown against n.

$\endgroup$
  • $\begingroup$ It appears that you have discretized six first-order ODEs and are solving the resulting difference equations plus three algebraic equations a step at a time for NN steps. Instead, you might try using NDSolve to solve this differential-algebraic system directly. Often, it can. $\endgroup$ – bbgodfrey Sep 22 '17 at 4:43
  • $\begingroup$ Alternatively, with the present set of equations in the question, try using the solution from step n - 1 as the initial guess in FindRoot for step n. $\endgroup$ – bbgodfrey Sep 22 '17 at 4:45
  • $\begingroup$ Thank you dear bbgodfrey. I tried with using the solution from step n - 1 as the initial guess in FindRoot for step n. In[33]:= FI[0] = {a[0] -> 1, wx[0] -> 4.5, wy[0] -> 4.5, cx[0] -> 0, cy[0] -> 0, [Sigma][0] -> 0.01} Out[33]= {a[0] -> 1, wx[0] -> 4.5, wy[0] -> 4.5, cx[0] -> 0, cy[0] -> 0, [Sigma][0] -> 0.01} $\endgroup$ – Khaled Sep 22 '17 at 11:12
  • $\begingroup$ The input is : tab = Union[{FI[0]}, Table[FI[n] = FindRoot[{f1 == 0, f2 == 0, f3 == 0, f4 == 0, f5 == 0, f6 == 0, equ1 == 0, equ2 == 0, equ3 == 0} /. FI[n - 1], {{a[n], a[n - 1]}, {wx[n], wx[n - 1]}, {wy[n], wy[n - 1]}, { cx[n], cx[n - 1]}, {cy[n], cy[n - 1]}, {[Sigma][n], [Sigma][n - 1]}, {[Beta]x[ n], [Beta]x[n - 1]}, {[Beta]y[n], [Beta]y[ n - 1]}, {[Alpha][n], [Alpha][n - 1]}}], {n, 1, 1}]] $\endgroup$ – Khaled Sep 22 '17 at 11:13
  • $\begingroup$ The output is : {FindRoot[{f1 == 0, f2 == 0, f3 == 0, f4 == 0, f5 == 0, f6 == 0, equ1 == 0, equ2 == 0, equ3 == 0} /. FI[n - 1], {{a[n], a[n - 1]}, {wx[n], wx[n - 1]}, {wy[n], wy[n - 1]}, {cx[n], cx[n - 1]}, {cy[n], cy[n - 1]}, {[Sigma][n], [Sigma][n - 1]}, {[Beta]x[ n], [Beta]x[n - 1]}, {[Beta]y[n], [Beta]y[n - 1]}, {[Alpha][ n], [Alpha][n - 1]}}], {a[0] -> 1, wx[0] -> 4.5, wy[0] -> 4.5, cx[0] -> 0, cy[0] -> 0, [Sigma][0] -> 0.01}} $\endgroup$ – Khaled Sep 22 '17 at 11:14

Your Answer

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

Browse other questions tagged or ask your own question.