Message Boards Message Boards

0
|
1977 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Writing a solution dependent coefficient in a PDE using Do & Table command

Posted 4 years ago

The goal is to find the displacement response of the following equation with the updating coefficient on the time and disp domain called diffusion coefficient 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 & interpolation 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}}}}]]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract