I am trying to implement the following scheme mentioned in the paper
"NUMERICAL SOLUTIONS OF BENJAMIN-BONA-MAHONY-BURGERS EQUATION VIA NONSTANDARD FINITE DIFFERENCE SCHEME " What is mentioned in the paper for the BMMB Equation : http://math-frac.org/Journals/EJMAA/Vol6(2)_July_2018/Vol6(2)_Papers/21_EJMAA_Vol6(2)_July_2018_pp_237-245.pdf
I have tried this code in Mathematica
How to discretize a nonlinear PDE fast? nonlinear-pde-fast/28011 Code Edited following the post
NN = 8 ;
M = 8 ;
a = -10 ;
b = 10 ;
h = (b - a)/NN;
T = 0.5 ;
k = T/M ;
\[Phi][x_] = (E^(Sqrt[2] h/3) - 2 + E^(-Sqrt[2] h/3))/(2/9);
\[Psi][y_] = Sinh[y];
(*Defining the Grid points*)
Table[Subscript[x,i] = -10 + i h , {i , 0, M}];
Table[Subscript[t,j] = 0 + j k , {j , 0 , NN } ] ;
(*Defining the Initial Conditions*)
For[i = 0, i <= M, i++ ,Subscript[w , i , 0 ] = E^(-Subscript[x, i]*Subscript[x, i])];
(*Defining the Boundary Conditions*)
For [j = 0 , j <= NN , j++, Subscript[w, 0, j] = 0];
For[j = 0 , j <= NN , j++ ,Subscript[w, M, j] = 0];
(*Defining the nonlinear equations due to discritization*)
For[i = 1 , i <= NN,
i++ , {For [j = 1, j <= M - 1 , j++,
f[i, j] =
Subscript[w, i + 1,
j + 1]*(1/(2*\[Psi][k]*(\[Phi][h])^2) + 1/(
2 *(\[Phi][h])^2) -
1/(4*\[Phi][h])*(1 + (
Subscript[w, i, j + 1] + Subscript[w, i, j])/2))
- ((Subscript[w, i, j + 1] - Subscript[w, i, j - 1])/(
2* \[Psi][k]) - (-2 *Subscript[w, i, j + 1] +
Subscript[w, i - 1, j + 1] - Subscript[w, i + 1, j - 1] +
2*Subscript[w, i, j - 1] - Subscript[w, i - 1, j - 1])/(
2* \[Psi][k]*(\[Phi][h])^2)
- (-2*Subscript[w, i, j + 1] + Subscript[w, i - 1, j + 1] +
Subscript[w, i + 1, j - 1] - 2*Subscript[w, i, j - 1] +
Subscript[w, i - 1, j - 1])/(2*(\[Phi][h])^2
)
+ (1 + (Subscript[w, i, j + 1] + Subscript[w, i, j])/
2)*((-Subscript[w, i - 1, j + 1] + Subscript[w, i + 1, j] -
Subscript[w, i - 1, j])/(4*(\[Phi][h]))))]}];
Sys = Flatten[Table[f[i, j], {i, M - 1}, {j, NN }]]//FullSimplify;
Vec = Flatten[Table[Subscript[w, i, j], {i, M - 1}, {j, NN}]];
Sol = FindRoot[Sys, {#, 1} & /@ Vec]
I get an error with FindRoot
How can i fix my code to show the result For N=M=8 ?
NDSolve
? 1. Have you read this post?: mathematica.stackexchange.com/q/10453/1871 2.m
is undefined, please always pay attention to the color of the variable, them
is blue, which indicates it's "empty". 3./FullSimplify
is obviously wrong. 4. Think about what's wrong with the following:FindRoot[{x == 1, y == 2}, {{{x, 1}, {y, 2}}}]
Check the document ofFlatten
and think about how to fix the sample with this function. 5. Check what's insideGuess[[1, 1]]
and think about what's wrong. $\endgroup$NN-1
equation, because the scheme uses non-standard central difference formula in $t$ direction, too. In traditional finite difference method, the missing equation can be supplied by one-sided difference formula, perhaps the author of the paper has done something similar, but this doesn't seem to be explained in the paper. $\endgroup$