I am trying to solve coupled sets of (partial) differential equations. For my ODE, I use
ti = 0;
tf = 5;
ri = 0;
rf = 1.5;
ai = 0;
af = 2;
sol[t_, x_, y_, z_,
a_] = {X[t, x, y, z, a], Y[t, x, y, z, a], Z[t, x, y, z, a]} /.
First[NDSolve[{ D[X[t, x, y, z, a], t] == Y[t, x, y, z, a] ,
D[Y[t, x, y, z, a], t] == Z[t, x, y, z, a] + 3.5 t,
D[Z[t, x, y, z, a], t] == X[t, x, y, z, a] + 2 Sin[a t] ,
X[0, x, y, z, a] == Sin[x + y],
Y[0, x, y, z, a] == Sin[2 z + y],
Z[0, x, y, z, a] == Sin[x + 0.5 z]}, {X, Y, Z}, {t, ti,
tf}, {x, ri, rf}, {y, ri, rf}, {z, ri, rf}, {a, ai, af},
MaxSteps -> \[Infinity]]]; // AbsoluteTiming
This solves these equations. Here my question is how to put {x,y,z}
, which are at the moment inside a cube, inside a particular manifold,e.q, inside a sphere with radius rf
.
For {X,Y,Z}
, I also should solve another set of partial differential equations. Here I implemented
sol[t_, x_, y_, z_,
a_] = {X[t, x, y, z, a], Y[t, x, y, z, a], Z[t, x, y, z, a]} /.
First[
NDSolve[{
D[X[t, x, y, z, a], t] ==
Y[t, x, y, z, a] + D[Z[t, x, y, z, a], y] + 0.5 t ,
D[Y[t, x, y, z, a], t] ==
Z[t, x, y, z, a] + D[X[t, x, y, z, a], z] ,
D[Z[t, x, y, z, a], t] ==
X[t, x, y, z, a] + D[Y[t, x, y, z, a], x] + 2 Sin[a t] ,
X[0, x, y, z, a] == Cos[a x + y],
Y[0, x, y, z, a] == Sin[z + y],
Z[0, x, y, z, a] == a Sin[x + z]}, {X, Y, Z}, {t, ti, tf}, {x,
ri, rf}, {y, ri, rf}, {z, ri, rf}, {a, ai, af},
MaxSteps -> \[Infinity],
Method -> {"MethodOfLines", "TemporalVariable" -> t,
"SpatialDiscretization" ->
"FiniteElement"}]]; // AbsoluteTiming
But this script is not fully correct as I get these errors
Do you have suggestions for resolving these issues?