The goal is to find the displacement response of the following equation with the updating coefficient on the time and disp domain called difusion coeficient or Epsilon. For this purpose, Epsilon is considered to be zero at the moment of zero and at the other times with the relation e = 0.01u [x, t]. Also, the boundary conditions and the initial condition are given in the code.part of the my code is below:
Needs["NDSolve`FEM`"];
s[x_] := UnitBox[0.3 x - 1.5](* initial dispalacement *)
ics = {u[x, 0] == s[x]}
nr = ToNumericalRegion[FullRegion[1], {{0, 10}}]
mesh = ToElementMesh[nr, MaxCellMeasure -> 0.25]
pde=D[u[x,t],t]+D[u[x,t],x]==ϵ[x]*D[u[x,t],x,x]
The problem here is how to write this part of the code loop using the combination of table & do command It should be noted that I have already tried this section as follows:
data1 = Table[ {x,0.01*u[x,t]}, {x, 0, 10, 0.25}];
ϵ[x] = Interpolation[data1, InterpolationOrder -> 0]
I also tried to use the thread command to link this coefficient, which is on the disp domain, to the time domain, as shown below:
data2 = Table[t, {t, 0, 10, 0.001}];
Thread[{data1 -> data2}]
That doesn't seem to be true :-)
The solution command is also given in the following format, which gives us an interpolating function that represents the displacement response, and we need to update the Epsilon coefficient on each displacement mesh at each time step:
t0 = 2;
sol = First[NDSolve[{pde, ics, bcs}, u , x \[Element] mesh, {t, 0, t0, 0.001}, MaxSteps -> 1000,
Method -> {"PDEDiscretization" -> {"MethodOfLines","SpatialDiscretization" -> {"FiniteElement",
"MeshOptions" -> {"MaxCellMeasure" -> 0.25}}}}]]
Clear[ϵ]; ϵ[x_]=0.01*u[x,t]
? 2.{t, 0, t0, 0.001}
is obviously wrong,{t, 0, t0}
is the correct one. $\endgroup$NDSolve
automatically. $\endgroup$