Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Exemplo 1
In[11]:= Clear[u, r, t]
Dab = 1*^-10;
R = 0.025;
sR = 1*^-100;
eq = D[u[t, r], t] ⩵ Dab r D[r D[u[t, r], r], r];
c1 = u[0, r] == 0.98;
c2 = D[u[t, r], r] /. r → sR == 0;
c3 = u[t, R] == 0.5 + 0.48 Exp[-100 t];
sol1 = NDSolveValue[{eq, c1, c2, c3}, u, {t, 0, 3*^6}, {r, sR, R}]
Out[19]= InterpolatingFunction Domain: 0., 3.×106, 1.×10-100, 0.025Output: scalar
ContourPlot[sol1[t, r], {t, 0, 3*^6}, {r, sR, R},
AxesLabel → Automatic, ColorFunction → "SunsetColors",
PlotLegends → Automatic, FrameLabel → {"tempo", "raio"}]
0 500000 1.0×106 1.5×106 2.0×106 2.5×106 3.0×1060.000
0.005
0.010
0.015
0.020
0.025
tempo
raio
0.55
0.60
0.65
0.70
0.75
0.80
0.85
0.90
0.95
In[20]:= RowBarLegend[{Hue[#] &, {0.5, 0.98}}],
ManipulateGraphicsFlatten{Hue[sol1[t * 3600 * 24, #]], Disk[{0, 0}, #]} & /@
Reverse@Range[1*^-6, 0.025, 0.0001], {{t, 0, "dias"}, 0, 34}
Out[20]=
0.5
0.6
0.7
0.8
0.9
dias
34.
Exemplo 2
In[21]:= Clear[eq, u, t, z]
eq = D[u[t, z], t] ⩵ Dab D[u[t, z], z, z];
c1 = D[u[t, z], z] /. z → 0.005 ⩵ 0;
c2 = D[u[t, z], z] /. z → -0.005 ⩵ 0;
c3 = u[t, 0.005] ⩵ 0.5 + 0.48 * Exp[-1000 t] ;
c4 = u[t, -0.005] ⩵ 0.5 + 0.48 * Exp[-1000 t] ;
c5 = u[0, z] ⩵ 0.98 ;
Dab = 1*^-10;
sol2 = NDSolveValue[{eq, c3, c4, c5}, u, {t, 0, 3*^5}, {z, -0.005, 0.005}];
2 difusao.nb
In[30]:= ContourPlot[sol2[t, z], {t, 0, 3*^5}, {z, -0.005, 0.005}, ColorFunction → "SunsetColors",
PlotLegends → Automatic, FrameLabel → {"tempo", "altura"}]
Out[30]=
0 50000 100000 150000 200000 250000 300000
-0.004
-0.002
0.000
0.002
0.004
tempo
altura
0.55
0.60
0.65
0.70
0.75
0.80
0.85
0.90
0.95
Manipulate[
Plot[sol2[t * 3600 * 24, z], {z, -0.005, 0.005}, PlotRange → {0.4, 1}]
, {{t, 0, "dias"}, 0, 3.4}]
Out[31]=
dias
3.175
-0.004 -0.002 0.000 0.002 0.004
0.5
0.6
0.7
0.8
0.9
1.0
difusao.nb 3
Exemplo 3
In[1]:= Clear[u, t, z]
eq = D[u[t, z], t] ⩵ Dab D[u[t, z], z, z];
c1 = D[u[t, z], z] /. z → 0 ⩵ 0;
c2 = u[t, 0.01] ⩵ 0.5 + 0.48 * Exp[-100 t] ;
c3 = u[0, z] ⩵ 0.98 ;
Dab = 1*^-10;
sol3 = NDSolveValue[{eq, c1, c2, c3}, u, {t, 0, 2*^6}, {z, 0, 0.01}];
Plot3D[sol3[t, z], {t, 0, 2*^6}, {z, 0, 0.01}, AxesLabel → Automatic, PlotRange → All]
DensityPlot[sol3[t, r], {t, 0, 1*^6}, {r, 0, 0.01},
ColorFunction → "SunsetColors", PlotLegends → Automatic]
0.5
0.6
0.7
0.8
0.9
4 difusao.nb
ContourPlot[sol3[t, r], {t, 0, 1 100 000}, {r, 0, 0.01}, ColorFunction → "SunsetColors",
PlotLegends → Automatic, FrameLabel → {"tempo", "altura"}]
0 200000 400000 600000 800000 1×1060.000
0.002
0.004
0.006
0.008
0.010
tempo
altura
0.55
0.60
0.65
0.70
0.75
0.80
0.85
0.90
0.95
In[9]:= Manipulate[
Plot[sol3[t, z], {z, 0, 0.01}, PlotRange → {0.4, 1}]
, {t, 0, 2*^6}]
Out[9]=
t
0.000 0.002 0.004 0.006 0.008 0.010
0.5
0.6
0.7
0.8
0.9
1.0
difusao.nb 5
In[10]:= Manipulate[
BarLegend[{Blend[{Red, Orange, Yellow, Green, Blue, Purple, Black},
Rescale[sol3[t, #], {0.98, 0.5}]] &, {0, 0.01}}]
, {t, 0, 2*^6}]
Out[10]=
t
1.09679×
0
0.002
0.004
0.006
0.008
0.010
Outros
(* PH *)
ph = NDSolveValue[{D[u[t, x, y], t] ⩵ D[u[t, x, y], x, x] + D[u[t, x, y], y, y],
u[0, x, y] ⩵ If[-1 < x < 1 && -1 < y < 1, 0, 1],
u[t, -1, y] ⩵ u[t, 1, y] ⩵ u[t, x, -1] ⩵ u[t, x, 1] ⩵ 1,
WhenEvent[u[t, 0, 0] ⩵ .5, {T = t, "StopIntegration"}]},
u, {t, 0, 10}, {x, -1, 1}, {y, -1, 1}];
Plot3D[ph[T, x, y], {x, -1, 1}, {y, -1, 1}]
6 difusao.nb
(* Transferencia de Calor *)
Clear[u, x, y, t];
L1 = 2; L2 = 2; (* length and widht of the plate *)
eq = {D[u[x, y, t], t] ⩵ D[u[x, y, t], x, x] + D[u[x, y, t], y, y]};
c1 = {u[x, y, 0] ⩵ 0};
c2 = u[0, y, t] == Sint L1;
c3 = u[x, 0, t] ⩵ -Sint L2;
c4 = u[L1, y, t] ⩵ 0;
c5 = u[x, L2, t] ⩵ 0;
sol = NDSolveValue[ {eq, c1, c2, c3, c, c5}, u, {x, 0, 2}, {y, 0, 2}, {t, 0.01, 30}]
DensityPlot3D[sol[x, y, t], {x, 0, 2}, {y, 0, 2}, {t, 0.01, 30},
ColorFunction → "TemperatureMap", PlotLegends → Automatic,
AxesLabel → Automatic, AxesStyle → Directive[Black, Thick, 15]]
u → InterpolatingFunctionDomain: {{0., 2.}, {0., 2.}, {0.01, 30.}}Output: scalar
difusao.nb 7