I try to simulate the special absorbing(?) boundary condition
`Derivative[1, 0][y][1, t] + Derivative[0, 1 ][y][1, t] == 0`
which only allows energy flow in positive x-direction.
I'm able to solve the problem using TensorPorductGrid
and MethodOfLines
:
sys = {D[y[x, t], {x, 2}] - D[y[x, t], {t, 2}] == 0,
y[x, 0] ==Which[ 4/10 <= x <= 5/10, 10 x - 4, 5/10 < x <= 6/10, 6 - 10 x,True, 0],
Derivative[0, 1][y][x, 0] == 0 ,
y [0, t] == 0,
Derivative[1, 0][y][1, t] + Derivative[0, 1 ][y][1, t] == 0}
Y = NDSolveValue[sys, y, {x, 0, 1}, {t, 0, 2},
Method -> {"MethodOfLines", "TemporalVariable" -> t,
"SpatialDiscretization" -> {"TensorProductGrid","MaxPoints" -> 200, "MinPoints" -> 200, "DifferenceOrder" -> 2}}]
Plot3D[Y[x, t], {x, 0, 1}, {t, 0, 2}, PlotRange -> All,PlotPoints -> 100, MeshFunctions -> {#2 &}]
But if I try to change the method to "FiniteElement"
Y = NDSolveValue[sys, y, {x, 0, 1}, {t, 0, 2},
Method -> {"MethodOfLines","TemporalVariable" -> t,
"SpatialDiscretization" ->{"FiniteElement"}}]
Mathematica gives error message
"NDSolveValue::fembdnl: The dependent variable in NDSolvey$1+(y^(1,0))[1,t]==0 in the boundary condition DirichletCondition[NDSolve
y$1+(y^(1,0))[1,t]==0,x==1.] needs to be linear."
which I don't understand.
The next attempt using NeumannValue
also went wrong:
Y = NDSolveValue[{D[y[x, t], {x, 2}] - D[y[x, t], {t, 2}] ==
NeumannValue[-Derivative[0, 1 ][y][1, t], x == 1],
y[x, 0] ==
Which[ 4/10 <= x <= 5/10, 10 x - 4, 5/10 < x <= 6/10, 6 - 10 x,
True, 0], Derivative[0, 1][y][x, 0] == 0 ,
y [0, t] == 0
}, y, {x, 0, 1}, {t, 0, 2},
Method -> {"MethodOfLines", "TemporalVariable" -> t,
"SpatialDiscretization" -> {"FiniteElement" }}, MaxStepSize -> .1]
and gives the not understandable message NDSolveValue::delpde: Delay partial differential equations are not currently supported by NDSolve.
Is it possible to avoid these messages and solve the problem with FEM?
Thanks!
solution
The helpful answer and comments led me to the FEM solution
NDSolveValue[{-D[y[x, t], {x, 2}] +D[y[x, t], {t, 2}] == NeumannValue[-Derivative[0, 1][y][x, t], x == 1],
y[x, 0] ==Which[4/10 <= x <= 5/10, 10 x - 4, 5/10 < x <= 6/10, 6 - 10 x,
True, 0],
Derivative[0, 1][y][x, 0] == 0,
y[0, t] == 0}, y, {x, 0,1}, {t, 0, 2},
Method -> {"MethodOfLines","TemporalVariable" -> t,
"SpatialDiscretization" ->{"FiniteElement","MeshOptions" ->{"MaxCellMeasure" -> 0.01}}}]
NDSolve`FEM`GetInactivePDE
can be used to analyze whatNeumannValue
should be set, here's an example: mathematica.stackexchange.com/a/245309/1871 $\endgroup$