- Aug 15, 2006
- 375
- 1
- 81
I have a set of 2 coupled differential vector equations. When I expand them all out they form a set of 6 coupled 1st order DE's (they are complex).
This is a bit of a rehash of an earlier post from way back when.
Long story short, I've been working on solving these equations numerically using Fortran90 and I've been getting funny results. To test my solution I've been toying with Maple/Matlab/Mathematica to see if it can solve these equations, after posting a few times on their respective websites I've gotten nowhere. Only the Maple forums actually responded and basically told me that Maple was ill-suited to solve this problem.
Here is exactly what I've put into Mathematica and it yells at me for encountering non-numerical value for a derivative.
If Matlab can solve this quicker/easier I'm open to suggestions. Help is much appreciated.
Now I'll explain what everything is:
ux...uz are velocity components, bx..bz are magnetic field components
Q is a pressure, calculated from a divergence equation. It comes out as a solution to a Helmholtz equation and takes the form of an integral.
k is the constant for the green's function Q'' - k^2 Q = F
kappa and omega are parameters to be varied
x (really should be called r or something to be less confusing) is the spatial coordinate
sigma is just there for the boundary conditions
The boundary conditions are 0 everywhere, with a Gaussian in bx and a corresponding wiggle in by to make the divergence 0.
k := 2/3 * \[Omega] * Sqrt[1 + 1/\[Kappa]^2]
IC[x_] := E^(-(x^2)/2/\[Sigma]^2)
\[Sigma] := 10./(2.*Sqrt[2.*Log[2]])
dQ[x_] := Integrate[(2*k*uy[t, y]/3 + 2*I*\[Omega]*ux[t, y]/9)*
E^(-k*y), y]*E^(k*x) +
Integrate[(-2*k*uy[t, y]/3 + 2*I*\[Omega]*ux[t, y]/9)*E^(k*y), y]*
E^(-k*x) + 4*uy[t, x]/3
Q[x_] := Integrate[(2*uy[t, y]/3 + 2*I*\[Omega]*ux[t, y]/9/k)*
E^(-k*y), {y, x, 50}]*E^(k*x) +
Integrate[(2*uy[t, y]/3 - 2*I*\[Omega]*ux[t, y]/9/k)*
E^(k*y), {y, -50, x}]*E^(-k*x)
\[Kappa] := 0.01
\[Omega] := 0.01
sol = NDSolve[
{D[bx[t, x], t] == I*x*bx[t, x] + I*ux[t, x],
D[by[t, x], t] == I*x*by[t, x] + I*uy[t, x] - 3*bx[t, x]/\[Omega]/2,
D[bz[t, x], t] == I*x*bz[t, x] + I*uz[t, x],
D[ux[t, x], t] ==
I*x*ux[t, x] + I*bx[t, x] + 2*uy[t, x]/\[Omega] - 3*dQ/2/\[Omega],
D[uy[t, x], t] ==
I*x*uy[t, x] + I*by[t, x] - ux[t, x]/2/\[Omega] - I*Q,
D[uz[t, x], t] == I*x*uz[t, x] + I*bz[t, x] - I*Q/\[Kappa],
bx[0, x] == E^(-(x^2)/2/\[Sigma]^2),
by[0, x] == 3*I*D[E^(-(x^2)/2/\[Sigma]^2), x]/2/\[Omega],
bz[0, x] == ux[0, x] == uy[0, x] == uz[0, x] == 0},
{bx, by, bz, ux, uy, uz}, {t, 0, 10}, {x, -50, 50}]
This is a bit of a rehash of an earlier post from way back when.
Long story short, I've been working on solving these equations numerically using Fortran90 and I've been getting funny results. To test my solution I've been toying with Maple/Matlab/Mathematica to see if it can solve these equations, after posting a few times on their respective websites I've gotten nowhere. Only the Maple forums actually responded and basically told me that Maple was ill-suited to solve this problem.
Here is exactly what I've put into Mathematica and it yells at me for encountering non-numerical value for a derivative.
If Matlab can solve this quicker/easier I'm open to suggestions. Help is much appreciated.
Now I'll explain what everything is:
ux...uz are velocity components, bx..bz are magnetic field components
Q is a pressure, calculated from a divergence equation. It comes out as a solution to a Helmholtz equation and takes the form of an integral.
k is the constant for the green's function Q'' - k^2 Q = F
kappa and omega are parameters to be varied
x (really should be called r or something to be less confusing) is the spatial coordinate
sigma is just there for the boundary conditions
The boundary conditions are 0 everywhere, with a Gaussian in bx and a corresponding wiggle in by to make the divergence 0.
k := 2/3 * \[Omega] * Sqrt[1 + 1/\[Kappa]^2]
IC[x_] := E^(-(x^2)/2/\[Sigma]^2)
\[Sigma] := 10./(2.*Sqrt[2.*Log[2]])
dQ[x_] := Integrate[(2*k*uy[t, y]/3 + 2*I*\[Omega]*ux[t, y]/9)*
E^(-k*y), y]*E^(k*x) +
Integrate[(-2*k*uy[t, y]/3 + 2*I*\[Omega]*ux[t, y]/9)*E^(k*y), y]*
E^(-k*x) + 4*uy[t, x]/3
Q[x_] := Integrate[(2*uy[t, y]/3 + 2*I*\[Omega]*ux[t, y]/9/k)*
E^(-k*y), {y, x, 50}]*E^(k*x) +
Integrate[(2*uy[t, y]/3 - 2*I*\[Omega]*ux[t, y]/9/k)*
E^(k*y), {y, -50, x}]*E^(-k*x)
\[Kappa] := 0.01
\[Omega] := 0.01
sol = NDSolve[
{D[bx[t, x], t] == I*x*bx[t, x] + I*ux[t, x],
D[by[t, x], t] == I*x*by[t, x] + I*uy[t, x] - 3*bx[t, x]/\[Omega]/2,
D[bz[t, x], t] == I*x*bz[t, x] + I*uz[t, x],
D[ux[t, x], t] ==
I*x*ux[t, x] + I*bx[t, x] + 2*uy[t, x]/\[Omega] - 3*dQ/2/\[Omega],
D[uy[t, x], t] ==
I*x*uy[t, x] + I*by[t, x] - ux[t, x]/2/\[Omega] - I*Q,
D[uz[t, x], t] == I*x*uz[t, x] + I*bz[t, x] - I*Q/\[Kappa],
bx[0, x] == E^(-(x^2)/2/\[Sigma]^2),
by[0, x] == 3*I*D[E^(-(x^2)/2/\[Sigma]^2), x]/2/\[Omega],
bz[0, x] == ux[0, x] == uy[0, x] == uz[0, x] == 0},
{bx, by, bz, ux, uy, uz}, {t, 0, 10}, {x, -50, 50}]